diff options
author | Nick Clifton <nickc@redhat.com> | 2018-01-12 08:15:55 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-01-12 08:15:55 +0000 |
commit | 97a232d7335f3bd0231fd9cd39455bde1d563922 (patch) | |
tree | 60131664a4a1c9c1903114bed7570ab4f0279aa8 /ld/ld.texinfo | |
parent | 33eff4ce18fbee82ef39838b7c8623aed17dea60 (diff) | |
download | gdb-97a232d7335f3bd0231fd9cd39455bde1d563922.zip gdb-97a232d7335f3bd0231fd9cd39455bde1d563922.tar.gz gdb-97a232d7335f3bd0231fd9cd39455bde1d563922.tar.bz2 |
Add -z undefs option to the ELF linker.
Currently we have no obvious way to revert the action of the "-z defs"
command line option. The "--unresolved-symbols=ignore-in-object-files"
does pretty much what is needed, but it is non-obvious and it also
touches the setting for reporting unresolved symbol references from
shared libraries. So I am proposing adding a "-z undefs" option to be
the inverse of "-z defs". (I thought that "-z nodefs" might be
confusing since it implies banning all definitions, rather than
allowing them).
In addition the description of the "-z defs" option in the linker
documentation is misleading in one place, where it says:
'defs'
Disallows undefined symbols in object files. Undefined
symbols in shared libraries are still allowed.
whereas later on it gets it right:
'-z defs'
Report unresolved symbol references from regular object files.
This is done even if the linker is creating a non-symbolic shared
library. The switch '--[no-]allow-shlib-undefined' controls the
behaviour for reporting unresolved references found in shared
libraries being linked in.
* emultempl/elf32.em (_handle_option): Add support for "-z undefs"
as the opposite of "-z defs".
* ld.texinfo: Document the new option. Update the description of
the -z defs option to make it clear that it does generate an error
if an undefined symbol reference is found in an object file whilst
creating a shared library.
* NEWS: Document this new feature.
Diffstat (limited to 'ld/ld.texinfo')
-rw-r--r-- | ld/ld.texinfo | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 8cd2bed..94d340c 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1147,8 +1147,9 @@ layout will be optimized to minimize memory pages if the system is using pages of this size. @item defs -Disallows undefined symbols in object files. Undefined symbols in -shared libraries are still allowed. +Report unresolved symbol references from regular object files. This +is done even if the linker is creating a non-symbolic shared library. +This option is the inverse of @samp{-z undefs}. @item dynamic-undefined-weak @itemx nodynamic-undefined-weak @@ -1288,6 +1289,11 @@ Report an error if DT_TEXTREL is set, i.e., if the binary has dynamic relocations in read-only sections. Don't report an error if @samp{notext} or @samp{textoff}. +@item undefs +Do not report unresolved symbol references from regular object files, +either when creating an executable, or when creating a shared library. +This option is the inverse of @samp{-z defs}. + @end table Other keywords are ignored for Solaris compatibility. @@ -1693,6 +1699,7 @@ while linking a large executable. @kindex --no-undefined @kindex -z defs +@kindex -z undefs @item --no-undefined @itemx -z defs Report unresolved symbol references from regular object files. This @@ -1701,6 +1708,8 @@ The switch @option{--[no-]allow-shlib-undefined} controls the behaviour for reporting unresolved references found in shared libraries being linked in. +The effects of this option can be reverted by using @code{-z undefs}. + @kindex --allow-multiple-definition @kindex -z muldefs @item --allow-multiple-definition |