+2004-07-12 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>
+
+ * dlltool.c (ext_prefix_alias): New global variable.
+ (make_one_lib_file): Add aliases with prefixes for external
+ and import definitions.
+ (usage): Document -p option.
+ (long_options): Add --ext-prefix-alias option.
+ (main): Handle -p.
+ * doc/binutils.texi: Document new switch.
+ * NEWS: Mention new switch.
+
2004-07-09 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>
* binutils/dlltool.c (asm_prefix): Add parameter: name.
-*- text -*-
+* dlltool has a switch "--ext-prefix-alias <prefix>" to generate additional
+ import and export symbols with <preifx> prepended to them.
+
+Changes in 2.15:
+
* objcopy and strip can now take wildcard patterns in symbol names specified on
the command line provided that the --wildcard switch is used to enable them.
static int machine;
static int killat;
static int add_stdcall_alias;
+static const char *ext_prefix_alias;
static int verbose;
static FILE *output_def;
static FILE *base_file;
asymbol * exp_label;
asymbol * iname = 0;
asymbol * iname2;
+ asymbol * iname2_pre = 0;
asymbol * iname_lab;
asymbol ** iname_lab_pp;
asymbol ** iname_pp;
#endif
asymbol * ptrs[NSECS + 4 + EXTRA + 1];
flagword applicable;
-
char * outname = xmalloc (strlen (TMP_STUB) + 10);
int oidx = 0;
for (i = 0; i < NSECS; i++)
{
sinfo *si = secdata + i;
+
if (si->id != i)
abort();
si->sec = bfd_make_section_old_way (abfd, si->name);
bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC);
#endif
ptrs[oidx++] = exp_label;
+
+ if (ext_prefix_alias)
+ {
+ asymbol * exp_label_pre;
+
+ exp_label_pre = bfd_make_empty_symbol (abfd);
+ exp_label_pre->name
+ = make_imp_label (ext_prefix_alias, exp->name);
+ exp_label_pre->section = exp_label->section;
+ exp_label_pre->flags = exp_label->flags;
+ exp_label_pre->value = exp_label->value;
+#ifdef DLLTOOL_ARM
+ if (machine == MTHUMB)
+ bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC);
+#endif
+ ptrs[oidx++] = exp_label_pre;
+ }
}
/* Generate imp symbols with one underscore for Microsoft
iname2->flags = BSF_GLOBAL;
iname2->value = 0;
- iname_lab = bfd_make_empty_symbol(abfd);
+ if (ext_prefix_alias)
+ {
+ char *pre_name;
+
+ iname2_pre = bfd_make_empty_symbol (abfd);
+ pre_name = xmalloc (strlen (ext_prefix_alias) + 7);
+ sprintf(pre_name, "__imp_%s", ext_prefix_alias);
+ iname2_pre->name = make_imp_label (pre_name, exp->name);
+ iname2_pre->section = iname2->section;
+ iname2_pre->flags = iname2->flags;
+ iname2_pre->value = iname2->value;
+ }
+
+ iname_lab = bfd_make_empty_symbol (abfd);
iname_lab->name = head_label;
- iname_lab->section = (asection *)&bfd_und_section;
+ iname_lab->section = (asection *) &bfd_und_section;
iname_lab->flags = 0;
iname_lab->value = 0;
if (create_compat_implib)
ptrs[oidx++] = iname;
ptrs[oidx++] = iname2;
+ if (ext_prefix_alias)
+ ptrs[oidx++] = iname2_pre;
iname_lab_pp = ptrs + oidx;
ptrs[oidx++] = iname_lab;
fprintf (file, _(" -U --add-underscore Add underscores to symbols in interface library.\n"));
fprintf (file, _(" -k --kill-at Kill @<n> from exported names.\n"));
fprintf (file, _(" -A --add-stdcall-alias Add aliases without @<n>.\n"));
+ fprintf (file, _(" -p --ext-prefix-alias <prefix> Add aliases with <prefix>.\n"));
fprintf (file, _(" -S --as <name> Use <name> for assembler.\n"));
fprintf (file, _(" -f --as-flags <flags> Pass <flags> to the assembler.\n"));
fprintf (file, _(" -C --compat-implib Create backward compatible import library.\n"));
{"add-underscore", no_argument, NULL, 'U'},
{"kill-at", no_argument, NULL, 'k'},
{"add-stdcall-alias", no_argument, NULL, 'A'},
+ {"ext-prefix-alias", required_argument, NULL, 'p'},
{"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
while ((c = getopt_long (ac, av,
#ifdef DLLTOOL_MCORE_ELF
- "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHhM:L:F:",
+ "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHhM:L:F:",
#else
- "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHh",
+ "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHh",
#endif
long_options, 0))
!= EOF)
case 'A':
add_stdcall_alias = 1;
break;
+ case 'p':
+ ext_prefix_alias = optarg;
+ break;
case 'd':
def_file = optarg;
break;
\input texinfo @c -*- Texinfo -*-
@setfilename binutils.info
-@c Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+@c Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
@include config.texi
@ifinfo
@c man begin COPYRIGHT
Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
-2001, 2002, 2003 Free Software Foundation, Inc.
+2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
@c "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib".
@c
@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001,
-@c 2002, 2003 Free Software Foundation, Inc.
+@c 2002, 2003, 2004 Free Software Foundation, Inc.
@c
@c This text may be freely distributed under the terms of the GNU
@c Free Documentation License.
@vskip 0pt plus 1filll
Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998, 2000, 2001,
-2002, 2003 Free Software Foundation, Inc.
+2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
[@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
[@option{-a}|@option{--add-indirect}] [@option{-U}|@option{--add-underscore}] [@option{-k}|@option{--kill-at}]
[@option{-A}|@option{--add-stdcall-alias}]
+ [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
[@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}] [@option{-i}|@option{--interwork}]
[@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
[@option{-v}|@option{--verbose}]
should add aliases for stdcall symbols without @samp{@@ <number>}
in addition to the symbols with @samp{@@ <number>}.
+@item -p
+@itemx --ext-prefix-alias @var{prefix}
+Causes @command{dlltool} to create external aliases for all DLL
+imports with the specified prefix. The aliases are created for both
+external and import symbols with no leading underscore.
+
@item -x
@itemx --no-idata4
Specifies that when @command{dlltool} is creating the exports and library
+2004-07-12 Nick Clifton <nickc@redhat.com>
+
+ * binutils-all/dlltool.exp: Check that the -p switch is not
+ rejected.
+
2004-07-09 Andreas Schwab <schwab@suse.de>
* binutils-all/m68k/movem.s: New file.
}
pass "dlltool (fastcall export)"
+
+verbose "$DLLTOOL -p foo -d $srcdir/$subdir/fastcall.def" 1
+catch "exec $DLLTOOL -p foo -d $srcdir/$subdir/fastcall.def" err
+
+if ![string match "" $err] then {
+ send_log "$err\n"
+ verbose "$err" 1
+ fail "dlltool (aliased export)"
+ continue
+}
+
+pass "dlltool (aliased export)"