1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-10-30 17:59:45 +09:00
parent 53bae89117
commit fecd09d055
3 changed files with 9 additions and 8 deletions

View File

@ -68,7 +68,7 @@ void InputSection::relocate(u8 *buf) {
Symbol *sym = file->get_symbol(sym_idx);
u8 *loc = buf + output_section->shdr.sh_offset + offset + rel.r_offset;
u64 G = sym ? sym->got_addr : 0;
u64 G = sym ? sym->got_offset : 0;
u64 GOT = out::got->shdr.sh_addr;
u64 S = sym ? sym->addr : file->get_symbol_addr(sym_idx);
i64 A = rel.r_addend;
@ -113,7 +113,7 @@ void InputSection::relocate(u8 *buf) {
case R_X86_64_DTPOFF32:
break;
case R_X86_64_GOTTPOFF:
*(u32 *)loc = (sym ? sym->gottp_addr : 0) + GOT + A - P;
*(u32 *)loc = (sym ? sym->gottp_offset : 0) + GOT + A - P;
break;
case R_X86_64_TPOFF32:
*(u32 *)loc = S - out::tls_end;

View File

@ -532,11 +532,11 @@ int main(int argc, char **argv) {
if (sym->needs_got) {
out::got->symbols.push_back({GotSection::REGULAR, sym});
sym->got_addr = offset;
sym->got_offset = offset;
offset += 8;
} else if (sym->needs_gottp) {
out::got->symbols.push_back({GotSection::TP, sym});
sym->gottp_addr = offset;
sym->gottp_offset = offset;
offset += 8;
}
}

9
mold.h
View File

@ -185,11 +185,12 @@ public:
InputSection *input_section = nullptr;
u64 addr = 0;
u64 got_addr = 0;
u64 gottp_addr = 0;
u64 plt_addr = 0;
u64 value;
u32 got_offset = 0;
u32 gottp_offset = 0;
u32 plt_offset = 0;
u8 visibility = 0;
bool is_weak = false;
bool is_undef_weak = false;