[PATCH] [lld][ELF] Implement relocations.
Michael Spencer
bigcheesegs at gmail.com
Sun Feb 3 18:57:22 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;
}
----------------
Shankar Kalpathi Easwaran wrote:
> So does this make TP relative ? The sequence of instructions might be useful on what is it replacing with.
The comment says. It's just a very large mov %fs:0, %rax. %fs:0 holds the virtual address of %fs:0.
================
Comment at: lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp:166
@@ +165,3 @@
+
+ virtual Alignment alignment() const { return Alignment(0); }
+
----------------
Shankar Kalpathi Easwaran wrote:
> Why is the alignment 0 ?
Because it has no content.
http://llvm-reviews.chandlerc.com/D366
More information about the llvm-commits
mailing list