[Top][All Lists]

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

Re: as/ld silently creates programs with undefined references/symbols

From: Russell King
Subject: Re: as/ld silently creates programs with undefined references/symbols
Date: Fri, 2 Jul 2004 12:37:10 +0100
User-agent: Mutt/

On Fri, Jul 02, 2004 at 12:18:20PM +0100, Nick Clifton wrote:
> Hi Russell,
> > However, I'm still concerned that ld was able to successfully link to a
> > binary with --no-undefined, and the resulting binary still had undefined
> > symbols.
> > 
> > Could someone explain why --no-undefined didn't catch the problem?
> Because "--no-undefined" actually means "do not allow any references to 
> undefined symbols" rather than "do not allow any undefined symbols".
> What was happening was that the code in GAS was silently converting the 
> reference to the undefined symbol into the value 0.  ie it was not 
> generating a reloc against the undefined symbol, it was just ignoring 
> it.  Thus the object file did not contain any relocations and so the 
> linker did not encounter any references to undefined symbols, and so no 
> warnings or errors were produced.

Can you estimate how long this bug has been in binutils?  I'm aware of
versions from around 2.13 which is about 2 years old, and I know that
2.11 worked correctly.

As I suspected, the only reliable way to detect this failure is to run
an extra step after the final link to detect undefined symbols in the
final object:

        arm-linux-nm $@ | grep '^ *U '

and force build failure if any are found.

Given that it will be a while until people are using a fixed toolchain,
and the range of binutils versions affected, I think it's important to
have a way to detect this failure such that kernel developers can filter
out the incorrectly built kernels.

Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

reply via email to

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