Bfd/binutils inconsistency re: *UND* and *ABS* and relocs against dummy (STT_NOTYPE) symbol entries in elf symbol tables!?

Ian Lance Taylor ian@wasabisystems.com
Wed Mar 3 19:59:00 GMT 2004


"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



More information about the Binutils mailing list