1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 02:20:51 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-16 13:13:57 +09:00
parent 242d042c20
commit e66a70ebd1
2 changed files with 13 additions and 3 deletions

View File

@ -52,10 +52,10 @@ void InputSection::copy_to(u8 *buf) {
*(u64 *)loc = sym.get_got_addr() - GOT + A;
break;
case R_X86_64_PLT32:
if (config.is_static && sym.type != STT_GNU_IFUNC)
*(u32 *)loc = S + A - P; // todo
else
if (sym.type == STT_GNU_IFUNC || (!config.is_static && !sym.file->is_dso))
*(u32 *)loc = sym.get_plt_addr() + A - P;
else
*(u32 *)loc = S + A - P; // todo
break;
case R_X86_64_GOTPCREL:
*(u32 *)loc = sym.get_got_addr() + A - P;

10
main.cc
View File

@ -516,6 +516,16 @@ static void write_got(u8 *buf, ArrayRef<ObjectFile *> files) {
esym.setType(sym->type);
esym.setBinding(sym->esym->getBinding());
if (sym->file->is_dso) {
esym.st_shndx = SHN_UNDEF;
} else if (!sym->input_section) {
esym.st_shndx = SHN_ABS;
esym.st_value = sym->get_addr();
} else {
esym.st_shndx = sym->input_section->output_section->shndx;
esym.st_value = sym->get_addr();
}
// Write to .dynstr
write_string(dynstr_buf + dynstr_offset, sym->name);
dynstr_offset += sym->name.size() + 1;