1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-28 19:04:27 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-02 14:10:39 +09:00
parent 05f17b9a48
commit 8f27c88db3
2 changed files with 23 additions and 1 deletions

View File

@ -139,7 +139,25 @@ void InputSection::relocate(u8 *buf) {
<< " P=" << Twine::utohexstr(P) << " P=" << Twine::utohexstr(P)
<< "\n"; << "\n";
#endif #endif
*(u32 *)loc = (sym ? sym->gottp_offset : 0) + GOT + A - P; if (loc[-3] == 0x48 && loc[-2] == 0x8b) {
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) {
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; break;
case R_X86_64_TPOFF32: case R_X86_64_TPOFF32:
*(u32 *)loc = S - out::tls_end; *(u32 *)loc = S - out::tls_end;

View File

@ -338,9 +338,13 @@ static u64 set_osec_offsets(ArrayRef<OutputChunk *> output_chunks) {
if (!chunk->is_bss()) if (!chunk->is_bss())
fileoff += chunk->get_size(); fileoff += chunk->get_size();
#if 0
bool is_tbss = chunk->is_bss() && (chunk->shdr.sh_flags & SHF_TLS); bool is_tbss = chunk->is_bss() && (chunk->shdr.sh_flags & SHF_TLS);
if (!is_tbss) if (!is_tbss)
vaddr += chunk->get_size(); vaddr += chunk->get_size();
#else
vaddr += chunk->get_size();
#endif
} }
return fileoff; return fileoff;
} }