This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86-64: support newer relocation types


>> 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 also occured to me that the RIP-relative addressing makes a difference here. So I guess I'll have to add such code to the disp parser. However, the similar code in the immediate parser doesn't need to be changed (because in an immediate there cannot be any RIP-relative). Hopefully I'll have a revised patch later today...

Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]