RFC/PATCH: ld falsely issues .gnu.warning message for unreferenced dynamic symbols
Grigory Zagorodnev
grigory_zagorodnev@linux.intel.com
Thu Feb 15 14:32:00 GMT 2007
Hi!
In the conditions described below, ld 2.17.50.0.13 falsely issues
warning message associated with a symbol via .gnu.warning extension.
Test-case illustrating the problem and a fix proposal are attached to
this mail.
I'd appreciate any help in reviewing the problem and proposed patch.
Conditions:
Main executable is linked against two dynamic libraries libcall.so and
libstub.so. First library (libcall.so) is linked against third dynamic
library liberal.so. Two of these libraries, libstub and libreal, define
symbol "func2". Neither executable nor any shared library reference this
symbol.
The problem:
While building executable, ld emits warning message, defined in
.gnu.warning.func2 section of libstub.so, regardless of missing
references to this symbol. That seems to be wrong.
The test-case:
Run make to see the message "libreal.so: warning: warning: func2 is not
implemented and will always fail". This message is unexpected.
Proposed solution:
In order to ignore multiple definitions of a dynamic symbol, for any
extra copy if the symbol, linker replaces its definition section with
"*UND*" stub. Thus this symbol is treated as undefined later on.
Proposed fix uses BSF_GLOBAL flag to distinguish between naturally
undefined symbols and synthetically undefined.
Patch applied to ld version 2.17.50.0.13 20070212, bootstrapped and
regtested at x86_64-redhat-linux.
Once again, both the problem and proposed patch needs to be reviewed.
I'd appreciate any help on this.
- Grigory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def_warn_test.tgz
Type: application/octet-stream
Size: 674 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20070215/b172e8b1/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: def_warn.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20070215/b172e8b1/attachment.ksh>
More information about the Binutils
mailing list