[PATCH] [lld][ELF] Implement relocations.

Shankar Kalpathi Easwaran shankarke at gmail.com
Sun Feb 3 18:52:25 PST 2013



================
Comment at: lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp:92-97
@@ -99,1 +91,8 @@
+  case R_X86_64_TLSLD:
+    // Rewrite to move %fs:0 into %rax. Technically we should verify that the
+    // next relocation is a PC32 to __tls_get_addr...
+    static uint8_t instr[] = { 0x66, 0x66, 0x66, 0x64, 0x48, 0x8b, 0x04, 0x25,
+                               0x00, 0x00, 0x00, 0x00 };
+    std::memcpy(location - 3, instr, sizeof(instr));
+    break;
   }
----------------
So does this make TP relative ? The sequence of instructions might be useful on what is it replacing with.

================
Comment at: lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp:166
@@ +165,3 @@
+
+  virtual Alignment alignment() const { return Alignment(0); }
+
----------------
Why is the alignment 0 ?


http://llvm-reviews.chandlerc.com/D366



More information about the llvm-commits mailing list