This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: gld not complaining about undefined symbols
Ian Lance Taylor wrote:
> Date: Thu, 06 Jan 2000 16:24:22 -0600
> From: Eric DeVolder <devolder@evsx.com>
>
> Now then, the original code in bfd_perform_relocation() looks like:
>
> if (bfd_is_und_section (symbol->section))
> && (symbol->flags & BSF_WEAK) == 0
> && output_bfd == (bfd *) NULL)
> return bfd_reloc_undefined;
>
> The above code happens right before the call to the howto. Since this
> code does not catch the
> undefined symbol, does this mean that my GAS is flagging symbols as
> weak? If so, how does this
> happen, as I am not doing this intentionally.
>
> I don't see any such code in bfd_perform_relocation. The code I see
> looks like this:
>
> /* If we are not producing relocateable output, return an error if
> the symbol is not defined. An undefined weak symbol is
> considered to have a value of zero (SVR4 ABI, p. 4-27). */
> if (bfd_is_und_section (symbol->section)
> && (symbol->flags & BSF_WEAK) == 0
> && output_bfd == (bfd *) NULL)
> flag = bfd_reloc_undefined;
>
> Then the variable flag becomes the return value if nothing else
> unusual happens.
My apologies, as I was a bit too liberal with my cut and paste. Yes, I see
the same code in bfd_perform_relocation() as you illustrate above.
> In your case, it sounds like a howto function is being called, and
> that howto function is returning something other than
> bfd_reloc_continue, so whatever it returns becomes the return value
> from bfd_perform_relocation.
I now see that the code above only sets a flag, it doesn't actually return
immediately, and thus the howto is always called.
I appreciate your help. I have either been staring at this too long or not
long enough.
Eric
>
>
> What sources are you looking at?
>
> Ian