Relocation data value adjust

daniel tian
Fri May 21 10:05:00 GMT 2010

hi, guys:
    I have a problem in my binutils porting. Here is the example:
                .file	"mtable.c"
	.globl	funpointer
	.align	4
	.type	funpointer, @object
	.size	funpointer, 8
	.long	{a, c}
	.align	4
	.globl	main
	.type	main, @function
	.size	main, .-main
	.ident	"GCC: (GNU) 4.3.0"
the label a and c will be 4, 8.
Because of the instruction being aligned with 4bytes, I wanna those
two label value right shift 2bit (the result will be 1, 2).

I digged the write.c, and still being puzzled. The difficulty I met is
how I could distinguish those two labels  being in funpointer (data
section) from like "JMP @a" (in .text section, because in jmp section,
there will be a fixup, and it will be resolved in md_apply_fix, the
"a" address value will be right shifted two bit in this function.).
and I noticed "a, c"  reloc_type is BFD_RELOC_32 (TC_CONS_FIX_NEW is
not defined in my target.), So I wonder whether I chould identitify
"a,c" with BFD_RELOC_32. Because when gcc will generate lots of debug
info with "-g", and BFD_RELOC_32/16/8 also exist in those debug info.

Can anyone give me some advice?
Thank you very much.


More information about the Binutils mailing list