about Reloc Type: BFD_RELOC_8/16/32

Nick Clifton nickc@redhat.com
Wed Oct 28 11:59:00 GMT 2009


Hi Daniel,

>      After adding the parameter "-g" into gcc, there are lots of data
> generated from gcc, and I guess this is for debug.

Correct.

> And the " .4byte	$LECIE0-$LSCIE0" code will cause the function
> "emit_expr_fix" in read.c.
> This is where generate the relocation type "BFD_RELOC_8/16/32", I just
> don't know what those relocation is.

OK, what these relocations say is that a 8-bit, 16-bit or 32-bit value 
needs to be inserted at the location pointed to by the reloc.  The value 
to be inserted is the value/address of the symbol associated with the 
reloc, plus whatever addend the reloc may have.  The value is an 
absolute value, not a PC relative one.

It is not clear however why gas should be generating one of these relocs 
for the ".4byte $LECIE0 - $LSCIE0" expression.  Normally they are only 
generated when one symbol is involved, not two.  Usually the difference 
of two symbols in the same section can be computed at assembly time, so 
there is no need to generate a reloc to resolve the expression at link 
time.  The exception to this is ports which perform link-time relaxation 
where the addresses of symbols in the same section could change because 
of changes in code size.

Cheers
   Nick




More information about the Binutils mailing list