[PATCH] D15292: [ELF] - optimizations for x86 tls relocations implemented.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 11:00:58 PST 2015


ruiu added a comment.

Please fix the spelling error in the commit message. It's better to make it a bit more descriptive.

Implement the TLS relocation optimization for 32-bit x86 that is described in
"ELF Handling For Thread-Local Storage" by Ulrich Drepper, chapter 5,
"IA-32 Linker Optimizations". Specifically, this patch implements these
optimizations: LD->LE, GD->IE, GD->LD, and IE->LE.


================
Comment at: ELF/Target.cpp:391
@@ +390,3 @@
+  switch (Type) {
+  case R_386_TLS_GD: {
+    if (canBePreempted(&S, true))
----------------
Remove {}.

================
Comment at: ELF/Target.cpp:453-459
@@ +452,9 @@
+
+// LD can be optimized to LE:
+// leal foo(%reg), %eax
+// call ___tls_get_addr
+// Is converted to:
+// movl %gs:0,%eax
+// nop
+// leal 0(%esi,1),%esi
+void X86TargetInfo::relocateTlsLdToLe(uint8_t *Loc, uint8_t *BufEnd, uint64_t P,
----------------
Indent consistently.


http://reviews.llvm.org/D15292





More information about the llvm-commits mailing list