g77 pic case vs. binutils & readelf

Nick Clifton nickc@cygnus.com
Fri Jun 4 12:33:00 GMT 1999

Hi Robert,

: > Could it be a case of REL vs RELA somewhere ?
: I don't really know what that means. dump_relocations() in readelf.c is
: called with "is_rela" = 0.

Hmm.  OK that theory was probably a wild goose chase then, especially
since the first few relocs appear to be correct.  Relocations in an
ELF file can be held in two different sized structures, one called
'rel' and one called 'rela'.  [Ignoring 64 bit ELF for now... :-)]
Anyway if the section is called '.rel.got' then that implies that the
relocations inside it were stored using the 'rel' structure.  If
however something had put 'rela' structures into the '.rel.got'
section then all kinds of bad things would happen.  Readelf and
friends would be expecting to see a new relocation every 8 bytes but
in fact the relocations would each be occupying 12 bytes.

: Relocation section '.rel.got' at offset 0x7b4 contains 4 entries:
:   Offset    Info  Type            Symbol's Value  Symbol's Name
:   0805582c  02206 R_386_GLOB_DAT        00000000  errno                    
:   0805586c  02b06 R_386_GLOB_DAT        08048ab4  ungetc                   
:   00000000  00000 R_386_NONE           
:   00000000  452b28 unrecognised: 28      bad symbol index: 0000452b
: Is there any way can we find the file that delivered that symbol to us?

Probably.  How did you create this "bad" file in the first place ?


More information about the Gcc mailing list