bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in cref-listing (GNU ld/binutils-2.1[34]) and fix


From: Michael Schumacher
Subject: Bug in cref-listing (GNU ld/binutils-2.1[34]) and fix
Date: Thu, 4 Sep 2003 16:47:19 +0200
User-agent: KMail/1.4.3

Hello,

when the linker is directed to produce a cross reference table
(--cref), it fails to report undefined or absolutely defined
symbols.  According to the documentation, the first file listed
after a symbol should contain the definition, while the following
files contain references.  However, if a symbol is undefined,
there is obviously no definition, so the linker erroneously
prints the first file that contains a reference to the symbol
as if it would contain the definition.  For instance, say both
"c.o" and "c2.o" reference the undefined symbol "foo", then ld
would produce:

foo    c.o
       c2.o

IOW, you can't tell from the cross reference table whether a symbol
is defined or not (the latter may easily happen with "ld -r").

A similar problem arises if an undefined symbol is defined via
ld's --defsym option or via an assignment statement in a linker
script.  In the example above, if you would add the option
"--defsym foo=0xdeadbeef", the linker would still produce the
output as shown above, thus confusing the user into thinking
that "c.o" would contain the actual definition of "foo".

Please find attached a small patch that should be applied to
ld/ldcref.c (tested with binutils-2.13 and -2.14).  It addresses
both problems by either printing "*UND*" or "*ABS*" as the first
file (i.e., the defining module).


Cheers,
mike

-- 
Michael Schumacher
HighTec EDV-Systeme GmbH

Attachment: mydiff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]