about Reloc Type: BFD_RELOC_8/16/32

daniel tian daniel.xntian@gmail.com
Thu Oct 29 08:25:00 GMT 2009


2009/10/28 Nick Clifton <nickc@redhat.com>:
> 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
>
Thanks.
Is there any reference (like howto manual) tells me how to deal with
those kind of symbol?
like this:
	.file	"test_lib.c"
	.section .mdebug.abi32
	.section	.debug_abbrev,"",@progbits
.Ldebug_abbrev0:
	.section	.debug_info,"",@progbits
.Ldebug_info0:
	.section	.debug_line,"",@progbits
.Ldebug_line0:

There is relocation symbol ".debug_abbrev", how do I resolve this type
of relocation?

Or just leave them. Because now I haven't ported gdb yet.

Any suggestion is appreciation.
Thanks very much.
                                                                    daniel.tian



More information about the Binutils mailing list