1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-14 16:31:42 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-03 15:16:54 +09:00
parent a0eff16290
commit a8b15c483e

View File

@ -131,35 +131,9 @@ void InputSection::relocate(u8 *buf) {
case R_X86_64_DTPOFF32: case R_X86_64_DTPOFF32:
// TODO // TODO
break; break;
case R_X86_64_GOTTPOFF: { case R_X86_64_GOTTPOFF:
if (sym) {
*(u32 *)loc = sym->gottp_offset + GOT + A - P; *(u32 *)loc = sym->gottp_offset + GOT + A - P;
break; 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));
break;
}
case R_X86_64_TPOFF32: case R_X86_64_TPOFF32:
*(u32 *)loc = S - out::tls_end; *(u32 *)loc = S - out::tls_end;
break; break;