aboutsummaryrefslogtreecommitdiff
path: root/binutils/doc
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-10-11 11:38:10 +0100
committerNick Clifton <nickc@redhat.com>2018-10-11 11:38:10 +0100
commitde564eb5cc8c67fc38f9910937935eef5ebc17d8 (patch)
tree8586b85602d6752c61d991f8fe5d759760e992d6 /binutils/doc
parentfbe61a3661b083a666e6550b3b0c2de364e6d4a6 (diff)
downloadgdb-de564eb5cc8c67fc38f9910937935eef5ebc17d8.zip
gdb-de564eb5cc8c67fc38f9910937935eef5ebc17d8.tar.gz
gdb-de564eb5cc8c67fc38f9910937935eef5ebc17d8.tar.bz2
Prevent the --keep-global-symbol and --globalize-symbol options from being used together.
This is the result of an email thread starting here: https://sourceware.org/ml/binutils/2018-09/msg00031.html The main point of the thread is this observation: * Supposing we had an object file with two globals, SomeGlobal and SomeOtherGlobal, if one were to do "--globalize-symbol SomeGlobal --keep-global-symbol SomeOtherGlobal", you might expect that both SomeGlobal and SomeOtherGlobal are global in the output file... but it isn't. Because --keep-global-symbol is set and doesn't include SomeGlobal, SomeGlobal will be demoted to a local symbol. And because the check to see if we should apply the --globalize-symbol flag checks "flags" (the original flag set), and not "sym->flags", it decides not to do anything, so SomeGlobal remains a local symbol. Although this is a weird edge case, should this be changed so that --keep-global-symbol implicitly keeps anything also specified via --globalize-symbol? (The code seems technically correct with respect to the documentation, but IMO the behavior is counter-intuitive). binutils* objcopy.c (copy_main): Issue a fata error if the --keep-global-symbol(s) and the --globalize-symbol(s) options are used together. * doc/binutils.texi: Document that the two options are incompatible. * testsuite/binutils-all/copy-5.d: New test. * testsuite/binutils-all/objcopy.exp: Run the new test.
Diffstat (limited to 'binutils/doc')
-rw-r--r--binutils/doc/binutils.texi13
1 files changed, 9 insertions, 4 deletions
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 76cbed0..cd70791 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -1129,6 +1129,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{--localize-hidden}]
[@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
[@option{--globalize-symbol=}@var{symbolname}]
+ [@option{--globalize-symbols=}@var{filename}]
[@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
[@option{-w}|@option{--wildcard}]
[@option{-x}|@option{--discard-all}]
@@ -1169,7 +1170,6 @@ 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{--add-symbol} @var{name}=[@var{section}:]@var{value}[,@var{flags}]]
[@option{--alt-machine-code=}@var{index}]
@@ -1380,7 +1380,9 @@ by a relocation. This option may be given more than once.
@itemx --keep-global-symbol=@var{symbolname}
Keep only symbol @var{symbolname} global. Make all other symbols local
to the file, so that they are not visible externally. This option may
-be given more than once.
+be given more than once. Note: this option cannot be used in
+conjunction with the @option{--globalize-symbol} or
+@option{--globalize-symbols} options.
@item --localize-hidden
In an ELF object, mark all symbols that have hidden or internal visibility
@@ -1400,7 +1402,8 @@ 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.
+more than once. Note: this option cannot be used in conjunction with
+the @option{-G} or @option{--keep-global-symbol} options.
@item -w
@itemx --wildcard
@@ -1774,7 +1777,9 @@ This option may be given more than once.
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.
+This option may be given more than once. Note: this option cannot be
+used in conjunction with the @option{-G} or @option{--keep-global-symbol}
+options.
@item --weaken-symbols=@var{filename}
Apply @option{--weaken-symbol} option to each symbol listed in the file