[PATCH] D14713: [ELF2] - Optimization for R_X86_64_GOTTPOFF relocation.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 17 10:20:49 PST 2015
grimar added inline comments.
================
Comment at: ELF/Target.cpp:375-378
@@ +374,6 @@
+ bool IsMovOp = *Instruct == 0x8b;
+ if (*Prefix == 0x4c)
+ *Prefix = IsMovOp ? 0x49 : 0x4D;
+ *Instruct = IsMovOp ? 0xc7 : 0x8d;
+ *RegSlot = IsMovOp ? (0xc0 | Reg) : (0x80 | Reg | (Reg << 3));
+ relocateOne(Loc, BufEnd, R_X86_64_TPOFF32, P, SA);
----------------
ruiu wrote:
> Does this handle SP register?
No. As I wrote in comments it will enlarge that code, but I can do that. Should I ?
================
Comment at: ELF/Target.cpp:379
@@ +378,3 @@
+ *RegSlot = IsMovOp ? (0xc0 | Reg) : (0x80 | Reg | (Reg << 3));
+ relocateOne(Loc, BufEnd, R_X86_64_TPOFF32, P, SA);
+}
----------------
ruiu wrote:
> I think the original code was better
>
> write32le(Loc, SA - Out<ELF64LE>::TlsPhdr->p_memsz);
According to manual its optimized exactly to R_X86_64_TPOFF32. Not sure how important skipped in that case OOR check as well:
```
case R_X86_64_TPOFF32:
if (!isInt<32>(Val))
error("R_X86_64_TPOFF32 out of range");
```
http://reviews.llvm.org/D14713
More information about the llvm-commits
mailing list