diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 17 | ||||
-rw-r--r-- | binutils/NEWS | 5 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 19 | ||||
-rw-r--r-- | binutils/objcopy.c | 58 |
4 files changed, 81 insertions, 18 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 2c302ca..d78dca0 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,20 @@ +2005-03-15 Daniel Marques <marques@cs.cornell.edu> + Nick Clifton <nickc@redhat.com> + + * objcopy.c (globalize_specific_list): New linked list of symbols + to convert from local binding into global binding. + (command_line_switch): Add OPTION_GLOBALIZE_SYMBOL and + OPTION_GLOBALIZE_SYMBOLS. + (copy_options): Add "globalize-symbol" and "globalize-symbols". + (copy_usage): Document the new switches. + (filter_symbols): Convert defined local symbols mentioned on the + globalize_specific_list into global symbols. + (copy_object): Perform actions if the globalize_specific_list is + not empty. + (copy_main): Handle new switches. + * NEWS: Mention new feature. + * doc/binutils.texi: Document new switches. + 2005-03-15 Alan Modra <amodra@bigpond.net.au> * po/es.po: Commit new Spanish translation. diff --git a/binutils/NEWS b/binutils/NEWS index 8677cb7..e083502 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,10 @@ -*- text -*- +* Add "--globalize-symbol <name>" and "--globalize-symbols <filename>" switches + to objcopy to convert local symbols into global symbols. + +Changes in 2.16: + * objcopy recognizes two new options --strip-unneeded-symbol and --strip-unneeded-symbols, namely for use together with the wildcard matching the original --strip-symbol/--strip-symbols provided, but diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 1d90bba..0b558fb 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -30,7 +30,7 @@ END-INFO-DIR-ENTRY @ifinfo @c man begin COPYRIGHT Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +2000, 2001, 2002, 2003, 2004, 2005 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, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -@c 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +@c 2000, 2001, 2002, 2003, 2004, 2005 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, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +2000, 2001, 2002, 2003, 2004, 2005 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 @@ -950,6 +950,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{--strip-unneeded-symbol=}@var{symbolname}] [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}] [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}] + [@option{--globalize-symbol=}@var{symbolname}] [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}] [@option{-w}|@option{--wildcard}] [@option{-x}|@option{--discard-all}] @@ -982,6 +983,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{--strip-unneeded-symbols=}@var{filename}] [@option{--keep-global-symbols=}@var{filename}] [@option{--localize-symbols=}@var{filename}] + [@option{--globalize-symbols=}@var{filename}] [@option{--weaken-symbols=}@var{filename}] [@option{--alt-machine-code=}@var{index}] [@option{--prefix-symbols=}@var{string}] @@ -1127,6 +1129,11 @@ visible externally. This option may be given more than once. @itemx --weaken-symbol=@var{symbolname} Make symbol @var{symbolname} weak. This option may be given more than once. +@item --globalize-symbol=@var{symbolname} +Give symbol @var{symbolname} global scoping so that it is visible +outside of the file in which it is defined. This option may be given +more than once. + @item -w @itemx --wildcard Permit regular expressions in @var{symbolname}s used in other command @@ -1371,6 +1378,12 @@ Apply @option{--localize-symbol} option to each symbol listed in the file name per line. Line comments may be introduced by the hash character. This option may be given more than once. +@item --globalize-symbols=@var{filename} +Apply @option{--globalize-symbol} option to each symbol listed in the file +@var{filename}. @var{filename} is simply a flat file, with one symbol +name per line. Line comments may be introduced by the hash character. +This option may be given more than once. + @item --weaken-symbols=@var{filename} Apply @option{--weaken-symbol} option to each symbol listed in the file @var{filename}. @var{filename} is simply a flat file, with one symbol diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 675b122..2d25b13 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -195,6 +195,7 @@ static struct symlist *strip_specific_list = NULL; static struct symlist *strip_unneeded_list = NULL; static struct symlist *keep_specific_list = NULL; static struct symlist *localize_specific_list = NULL; +static struct symlist *globalize_specific_list = NULL; static struct symlist *keepglobal_specific_list = NULL; static struct symlist *weaken_specific_list = NULL; static struct redefine_node *redefine_sym_list = NULL; @@ -236,6 +237,8 @@ enum command_line_switch OPTION_STRIP_UNNEEDED_SYMBOLS, OPTION_KEEP_SYMBOLS, OPTION_LOCALIZE_SYMBOLS, + OPTION_GLOBALIZE_SYMBOL, + OPTION_GLOBALIZE_SYMBOLS, OPTION_KEEPGLOBAL_SYMBOLS, OPTION_WEAKEN_SYMBOLS, OPTION_RENAME_SECTION, @@ -306,6 +309,8 @@ static struct option copy_options[] = {"discard-locals", no_argument, 0, 'X'}, {"format", required_argument, 0, 'F'}, /* Obsolete */ {"gap-fill", required_argument, 0, OPTION_GAP_FILL}, + {"globalize-symbol", required_argument, 0, OPTION_GLOBALIZE_SYMBOL}, + {"globalize-symbols", required_argument, 0, OPTION_GLOBALIZE_SYMBOLS}, {"help", no_argument, 0, 'h'}, {"impure", no_argument, 0, OPTION_IMPURE}, {"info", no_argument, 0, OPTION_FORMATS_INFO}, @@ -416,6 +421,7 @@ copy_usage (FILE *stream, int exit_status) --only-keep-debug Strip everything but the debug information\n\ -K --keep-symbol <name> Only copy symbol <name>\n\ -L --localize-symbol <name> Force symbol <name> to be marked as a local\n\ + --globalize-symbol <name> Force symbol <name> to be marked as a global\n\ -G --keep-global-symbol <name> Localize all symbols except <name>\n\ -W --weaken-symbol <name> Force symbol <name> to be marked as a weak\n\ --weaken Force all global symbols to be marked as weak\n\ @@ -456,6 +462,7 @@ copy_usage (FILE *stream, int exit_status) in <file>\n\ --keep-symbols <file> -K for all symbols listed in <file>\n\ --localize-symbols <file> -L for all symbols listed in <file>\n\ + --globalize-symbols <file> --globalize-symbol for all in <file>\n\ --keep-global-symbols <file> -G for all symbols listed in <file>\n\ --weaken-symbols <file> -W for all symbols listed in <file>\n\ --alt-machine-code <index> Use alternate machine code for output\n\ @@ -923,23 +930,35 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms, if (keep && is_strip_section (abfd, bfd_get_section (sym))) keep = 0; - if (keep && (flags & BSF_GLOBAL) != 0 - && (weaken || is_specified_symbol (name, weaken_specific_list))) - { - sym->flags &=~ BSF_GLOBAL; - sym->flags |= BSF_WEAK; - } - if (keep && !undefined && (flags & (BSF_GLOBAL | BSF_WEAK)) - && (is_specified_symbol (name, localize_specific_list) - || (keepglobal_specific_list != NULL - && ! is_specified_symbol (name, keepglobal_specific_list)))) + if (keep) { - sym->flags &= ~(BSF_GLOBAL | BSF_WEAK); - sym->flags |= BSF_LOCAL; - } + if ((flags & BSF_GLOBAL) != 0 + && (weaken || is_specified_symbol (name, weaken_specific_list))) + { + sym->flags &= ~ BSF_GLOBAL; + sym->flags |= BSF_WEAK; + } - if (keep) - to[dst_count++] = sym; + if (!undefined + && (flags & (BSF_GLOBAL | BSF_WEAK)) + && (is_specified_symbol (name, localize_specific_list) + || (keepglobal_specific_list != NULL + && ! is_specified_symbol (name, keepglobal_specific_list)))) + { + sym->flags &= ~ (BSF_GLOBAL | BSF_WEAK); + sym->flags |= BSF_LOCAL; + } + + if (!undefined + && (flags & BSF_LOCAL) + && is_specified_symbol (name, globalize_specific_list)) + { + sym->flags &= ~ BSF_LOCAL; + sym->flags |= BSF_GLOBAL; + } + + to[dst_count++] = sym; + } } to[dst_count] = NULL; @@ -1389,6 +1408,7 @@ copy_object (bfd *ibfd, bfd *obfd) || strip_specific_list != NULL || keep_specific_list != NULL || localize_specific_list != NULL + || globalize_specific_list != NULL || keepglobal_specific_list != NULL || weaken_specific_list != NULL || prefix_symbols_string @@ -2548,6 +2568,10 @@ copy_main (int argc, char *argv[]) add_specific_symbol (optarg, &localize_specific_list); break; + case OPTION_GLOBALIZE_SYMBOL: + add_specific_symbol (optarg, &globalize_specific_list); + break; + case 'G': add_specific_symbol (optarg, &keepglobal_specific_list); break; @@ -2889,6 +2913,10 @@ copy_main (int argc, char *argv[]) add_specific_symbols (optarg, &localize_specific_list); break; + case OPTION_GLOBALIZE_SYMBOLS: + add_specific_symbols (optarg, &globalize_specific_list); + break; + case OPTION_KEEPGLOBAL_SYMBOLS: add_specific_symbols (optarg, &keepglobal_specific_list); break; |