From a8b15c483e4f98d5619c8012d5f9d9d8b11c0a4f Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 3 Nov 2020 15:16:54 +0900 Subject: [PATCH] temporary --- input_sections.cc | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/input_sections.cc b/input_sections.cc index 4edddd25..6ed8c023 100644 --- a/input_sections.cc +++ b/input_sections.cc @@ -131,35 +131,9 @@ void InputSection::relocate(u8 *buf) { case R_X86_64_DTPOFF32: // TODO break; - case R_X86_64_GOTTPOFF: { - if (sym) { - *(u32 *)loc = sym->gottp_offset + GOT + A - P; - break; - } - - if (loc[-3] == 0x48 && loc[-2] == 0x8b) { - // Rewrite `movq foo@gottpoff(%rip), %r[8-15]` to `movq $foo, %r[8-15]` - loc[-3] = 0x48; - loc[-2] = 0xc7; - loc[-1] = 0xc0 | (loc[-1] >> 3); - *(u32 *)loc = S - out::tls_end; - break; - } - - if (loc[-3] == 0x4c && loc[-2] == 0x8b) { - // Rewrite `movq foo@gottpoff(%rip), %reg` to `movq $foo, %reg` - loc[-3] = 0x49; - loc[-2] = 0xc7; - loc[-1] = 0xc0 | (loc[-1] >> 3); - *(u32 *)loc = S - out::tls_end; - break; - } - - llvm::errs() << format("unsupported GOTTPOFF: 0x%02x 0x%02x 0x%02x\n", - loc[-3], loc[-2], loc[-1]); - error(toString(this)); + case R_X86_64_GOTTPOFF: + *(u32 *)loc = sym->gottp_offset + GOT + A - P; break; - } case R_X86_64_TPOFF32: *(u32 *)loc = S - out::tls_end; break;