H.J. Lu
unread,Oct 7, 2015, 11:25:55 AM10/7/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to x86-6...@googlegroups.com
X86 instruction encoding supports converting some instructions on memory
operand with GOTPCREL relocation against symbol, foo, into a different
form on immediate operand if foo is defined locally. Those instructions
are:
call *foo@GOTPCREL(%rip) => nop call foo or call foo nop
jmp *foo@GOTPCREL(%rip) => jmp foo nop
mov foo@GOTPCREL(%rip), %reg => lea foo(%rip), %reg
When PIC is false,
test %reg, foo@GOTPCREL(%rip) => test $foo, %reg
binop foo@GOTPCREL(%rip), %reg => binop $foo, %reg
where binop is one of adc, add, and, cmp, or, sbb, sub, xor instructions.
I am proposing to add 2 new relocations, R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX, to x86-64 psABI. Instead of generating
R_X86_64_GOTPCREL relocation agasint foo for foo@GOTPCREL(%rip),
we generate R_X86_64_GOTPCRELX or R_X86_64_REX_GOTPCRELX if there
is a REX prefix. Linker can treat them the same as R_X86_64_GOTPCREL
or it can perform the transformations listed above.
Any feedbacks?
Thanks.
--
H.J.