|
From: | Nick Clifton |
Subject: | Re: as/ld silently creates programs with undefined references/symbols |
Date: | Fri, 02 Jul 2004 12:18:20 +0100 |
User-agent: | Mozilla Thunderbird 0.7 (X11/20040615) |
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.
Nick, thanks - this patch solves the assembler problem. It correctly issues an error thusly: t.s: Assembler messages: t.s:3: Error: undefined symbol UNDEFINED_SYMBOL used as an immediate value
Great - I will check the patch into the mainline sources. Cheers Nick
[Prev in Thread] | Current Thread | [Next in Thread] |