diff options
author | Nick Clifton <nickc@redhat.com> | 2004-07-12 17:07:55 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2004-07-12 17:07:55 +0000 |
commit | 607dea976448c7af523547e62d37eba4975c3f94 (patch) | |
tree | 5bb69a7151e894375f80d418fc8bfc194f12e173 | |
parent | 7865082976ae440b7b8e884b24a74a2eff29781a (diff) | |
download | gdb-607dea976448c7af523547e62d37eba4975c3f94.zip gdb-607dea976448c7af523547e62d37eba4975c3f94.tar.gz gdb-607dea976448c7af523547e62d37eba4975c3f94.tar.bz2 |
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.
-rw-r--r-- | binutils/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/NEWS | 5 | ||||
-rw-r--r-- | binutils/dlltool.c | 49 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 15 | ||||
-rw-r--r-- | binutils/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/dlltool.exp | 12 |
6 files changed, 88 insertions, 9 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b54692e..2f1b733 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +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. diff --git a/binutils/NEWS b/binutils/NEWS index a72826ef..a753312 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,10 @@ -*- 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. diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 9153910..2f82928 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -382,6 +382,7 @@ extern char * program_name; 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; @@ -2247,6 +2248,7 @@ make_one_lib_file (export_type *exp, int i) asymbol * exp_label; asymbol * iname = 0; asymbol * iname2; + asymbol * iname2_pre = 0; asymbol * iname_lab; asymbol ** iname_lab_pp; asymbol ** iname_pp; @@ -2260,7 +2262,6 @@ make_one_lib_file (export_type *exp, int i) #endif asymbol * ptrs[NSECS + 4 + EXTRA + 1]; flagword applicable; - char * outname = xmalloc (strlen (TMP_STUB) + 10); int oidx = 0; @@ -2290,6 +2291,7 @@ make_one_lib_file (export_type *exp, int i) 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); @@ -2336,6 +2338,23 @@ make_one_lib_file (export_type *exp, int i) 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 @@ -2356,10 +2375,23 @@ make_one_lib_file (export_type *exp, int i) 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; @@ -2367,6 +2399,8 @@ make_one_lib_file (export_type *exp, int i) 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; @@ -3129,6 +3163,7 @@ usage (FILE *file, int status) 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")); @@ -3168,6 +3203,7 @@ static const struct option long_options[] = {"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'}, @@ -3204,9 +3240,9 @@ main (int ac, char **av) 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) @@ -3281,6 +3317,9 @@ main (int ac, char **av) case 'A': add_stdcall_alias = 1; break; + case 'p': + ext_prefix_alias = optarg; + break; case 'd': def_file = optarg; break; diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index c27c627..f92252d 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1,6 +1,6 @@ \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 @@ -30,7 +30,7 @@ END-INFO-DIR-ENTRY @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 @@ -55,7 +55,7 @@ notice identical to this one except for the removal of this paragraph @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. @@ -81,7 +81,7 @@ notice identical to this one except for the removal of this paragraph @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 @@ -2866,6 +2866,7 @@ dlltool [@option{-d}|@option{--input-def} @var{def-file-name}] [@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}] @@ -3055,6 +3056,12 @@ Specifies that when @command{dlltool} is creating the exports file it 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 diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 8f3473a..6e1d33d 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/binutils/testsuite/binutils-all/dlltool.exp b/binutils/testsuite/binutils-all/dlltool.exp index f061ab8..ba758df 100644 --- a/binutils/testsuite/binutils-all/dlltool.exp +++ b/binutils/testsuite/binutils-all/dlltool.exp @@ -45,3 +45,15 @@ if ![string match "" $err] then { } 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)" |