This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] x86-64: support newer relocation types
- From: Jan Hubicka <jh at suse dot cz>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: Jan Beulich <JBeulich at novell dot com>, binutils at sources dot redhat dot com,hubicka at ucw dot cz
- Date: Thu, 16 Jun 2005 13:29:04 +0200
- Subject: Re: [PATCH] x86-64: support newer relocation types
- References: <s2b0cc2d.097@lyle.provo.novell.com> <20050616112003.GE8728@kam.mff.cuni.cz>
> > >> If so, this would seem to be an unrelated change, as the GOTPC32 reloc in my
> > >>patch is handled exactly like the i386 one (which of course is very broken, but
> > >>obviously cannot be fixed). Or maybe I don't see how you would see
> > >>BFD_RELOC_32_PCREL to end up here.
> > >
> > >i386 GOT relocation is different from GOTPC32 in a way that one is IP
> > >relative and other not.
> > >I386 way of encoding GOT relocation is:
> > > addl $_GLOBAL_OFFSET_TABLE_+[.-.L2], %ebx
> > >While for x86-64 we want something like:
> > > leaq _GLOBAL_OFFSET_TABLE_(%rip), %rbx
> > >So the expression to match needs tobe slightly different.
> >
> > While the explanation is only partly right (we're talking about i386's
> > GOTPC vs. x86-64's GOTPC32 here, which have identical semantics), it
>
> Oops, sorry. I forgot that the i386 equivalent also ends up in PC
> relative relocation despite the lack of harware support, but anyway I
> would like to have the RIP relative syntax instead of having to invent
> new labels to encode GOTPC32
Not quite right either - extra label is not needed here, but
leaq _GLOBAL_OFFSET_TABLE_-., %rbx would be absolute addressing and
leaq _GLOBAL_OFFSET_TABLE_-.(%rip), %rbx would be IP relative
addressing to the same address as line above, so there would be no way
to encode IP relative addressing to _GLOBAL_OFFSET_TABLE_ via this kind
of arithmetics...
Honza