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 2021-01-14 20:31:39 +09:00
parent b384d87495
commit 8e334e6616
3 changed files with 9 additions and 8 deletions

View File

@ -368,8 +368,8 @@ static void scan_rels() {
for (Symbol *alias : ((SharedFile *)sym->file)->find_aliases(sym)) {
if (sym == alias)
continue;
assert(alias->copyrel_offset == -1);
alias->copyrel_offset = sym->copyrel_offset;
alias->has_copyrel = true;
alias->value = sym->value;
out::dynsym->add_symbol(alias);
}
}

6
mold.h
View File

@ -261,7 +261,6 @@ public:
u32 tlsgd_idx = -1;
u32 plt_idx = -1;
u32 dynsym_idx = -1;
u32 copyrel_offset = -1;
u16 shndx = 0;
u16 ver_idx = 0;
@ -277,6 +276,7 @@ public:
u8 write_symtab : 1 = false;
u8 traced : 1 = false;
u8 has_relplt : 1 = false;
u8 has_copyrel : 1 = false;
};
//
@ -1037,8 +1037,8 @@ inline u64 Symbol::get_addr() const {
if (piece_ref.piece)
return piece_ref.piece->get_addr() + piece_ref.addend;
if (copyrel_offset != -1)
return out::copyrel->shdr.sh_addr + copyrel_offset;
if (has_copyrel)
return out::copyrel->shdr.sh_addr + value;
if (input_section) {
if (!input_section->is_alive) {

View File

@ -600,7 +600,7 @@ void DynsymSection::copy_buf() {
esym.st_bind = sym.esym->st_bind;
esym.st_size = sym.esym->st_size;
if (sym.copyrel_offset != -1) {
if (sym.has_copyrel) {
esym.st_shndx = out::copyrel->shndx;
esym.st_value = sym.get_addr();
} else if (sym.is_imported || sym.esym->is_undef()) {
@ -685,11 +685,12 @@ void MergedSection::copy_buf() {
void CopyrelSection::add_symbol(Symbol *sym) {
assert(sym->is_imported);
if (sym->copyrel_offset != -1)
if (sym->has_copyrel)
return;
shdr.sh_size = align_to(shdr.sh_size, shdr.sh_addralign);
sym->copyrel_offset = shdr.sh_size;
sym->value = shdr.sh_size;
sym->has_copyrel = true;
shdr.sh_size += sym->esym->st_size;
symbols.push_back(sym);
out::dynsym->add_symbol(sym);