public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Relocation data value adjust
@ 2010-05-21 10:05 daniel tian
  2010-05-21 11:13 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: daniel tian @ 2010-05-21 10:05 UTC (permalink / raw)
  To: binutils; +Cc: peng.zheng

hi, guys:
    I have a problem in my binutils porting. Here is the example:
                .file	"mtable.c"
	.globl	funpointer
	.data
	.align	4
	.type	funpointer, @object
	.size	funpointer, 8
funpointer:
	.long	{a, c}
	.text
	.align	4
	.globl	main
	.type	main, @function
main:
	NOP
a:
                NOP
c:	
                NOP
	.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.

             daniel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relocation data value adjust
  2010-05-21 10:05 Relocation data value adjust daniel tian
@ 2010-05-21 11:13 ` Andreas Schwab
  2010-05-25  3:23   ` daniel tian
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2010-05-21 11:13 UTC (permalink / raw)
  To: daniel tian; +Cc: binutils, peng.zheng

daniel tian <daniel.xntian@gmail.com> writes:

> 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.

Qualify the expression by using something like a@fptr and attach a
different relocation type to it.  See the powerpc port for an example.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relocation data value adjust
  2010-05-21 11:13 ` Andreas Schwab
@ 2010-05-25  3:23   ` daniel tian
  2010-05-25  5:44     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: daniel tian @ 2010-05-25  3:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils, peng.zheng

2010/5/21 Andreas Schwab <schwab@redhat.com>:
> daniel tian <daniel.xntian@gmail.com> writes:
>
>> 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.
>
> Qualify the expression by using something like a@fptr and attach a
> different relocation type to it.  See the powerpc port for an example.
>
> Andreas.

hi, Andreas:
  I checked the as-internal document, there is no something like fptr
stuff, or this is a self defined thing to handle some special
relocation type, right?
Because I don't know the powerpc assemble language, do you mind to
give me a little more detail about @fptr thing?

Thanks very much.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relocation data value adjust
  2010-05-25  3:23   ` daniel tian
@ 2010-05-25  5:44     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2010-05-25  5:44 UTC (permalink / raw)
  To: daniel tian; +Cc: Andreas Schwab, binutils, peng.zheng

On Tue, May 25, 2010 at 11:22:55AM +0800, daniel tian wrote:
> 2010/5/21 Andreas Schwab <schwab@redhat.com>:
> > Qualify the expression by using something like a@fptr and attach a
> > different relocation type to it.  See the powerpc port for an example.
> 
> Because I don't know the powerpc assemble language, do you mind to
> give me a little more detail about @fptr thing?

Have a look at gas/config/tc-ppc.c:ppc_elf_suffix and the places that
this function is called.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-25  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-21 10:05 Relocation data value adjust daniel tian
2010-05-21 11:13 ` Andreas Schwab
2010-05-25  3:23   ` daniel tian
2010-05-25  5:44     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).