This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC/PATCH: ld falsely issues .gnu.warning message for unreferenced dynamic symbols


On Thu, Feb 15, 2007 at 05:20:43PM +0300, Grigory Zagorodnev wrote:
> 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.

Please open a bug report at

http://www.sourceware.org/bugzilla/

> 
> 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.
> 

The problem is linker doesn't check if a dynamic definition is
referenced within the DSO where it is defined. Your patch won't
issue a warning for the enclosed testcase.


H.J.

Attachment: bug.test.bz2
Description: BZip2 compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]