This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bfd/binutils inconsistency re: *UND* and *ABS* and relocs against dummy (STT_NOTYPE) symbol entries in elf symbol tables!?
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Dave Korn" <dk at artimi dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: 03 Mar 2004 14:58:59 -0500
- Subject: Re: Bfd/binutils inconsistency re: *UND* and *ABS* and relocs against dummy (STT_NOTYPE) symbol entries in elf symbol tables!?
- References: <NUTMEGreBBsQwY6YHki0000007f@NUTMEG.CAM.ARTIMI.COM>
"Dave Korn" <dk@artimi.com> writes:
> Mmm. But what I'm now wondering is whether I should special case r_symndx
> == 0 by replacing the assignment of sec (in XXX_relocate_section) like this:
>
> > > sec = r_symndx ? local_sections[r_symndx] : bfd_abs_sec_ptr;
>
> or whether I should find the code that sets up the local_sections and
> local_syms arrays, and make sure it sets entry zero to the ABS rather than
> UND section.
>
> The second way of doing it seems more correct to me: since the dummy
> symbol actually represents an absolute zero, the local_sections[0] entry
> corresponding to the local_syms[0] entry for it should point to ABS, not
> UND, because that's what section the symbol is actually in. It's misleading
> to claim the zero symbol is undefined: it isn't.
I agree.
> However, it also seems to me that there might be other bits of code which
> expect local_sections[0] to point to UND despite the zero symbol not
> actually being undefined, and changing this might inadvertently break them.
> So the safety-first approach leads me to consider just using the ternary
> expression above.
It's not used in very many places. It's set up in
elf_link_input_bfd() in elflink.h. It should be easy to double-check
the uses other than relocation_section to make sure. They should all
be in that file, I think.
Ian