1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-11 05:46:58 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-24 19:47:30 +09:00
parent 333e6c3f99
commit aa21e71218
2 changed files with 16 additions and 5 deletions

View File

@ -28,6 +28,8 @@ void InputSection::copy_buf() {
u64 sh_addr = output_section->shdr.sh_addr + offset;
u64 GOT = out::got->shdr.sh_addr;
bool debug = (file->name == "setup.o");
for (int i = 0; i < rels.size(); i++) {
const ELF64LE::Rela &rel = rels[i];
StringPieceRef &ref = rel_pieces[i];

View File

@ -212,7 +212,6 @@ void ObjectFile::initialize_mergeable_sections() {
ArrayRef<u8> contents = CHECK(obj.getSectionContents(isec->shdr), this);
mergeable_sections.emplace_back(isec, contents);
isec->mergeable = &mergeable_sections.back();
sections[i] = nullptr;
}
}
@ -258,6 +257,8 @@ void ObjectFile::initialize_mergeable_sections() {
}
}
bool debug = (name == "setup.o");
// Initialize sym_pieces
sym_pieces.resize(elf_syms.size());
@ -267,17 +268,25 @@ void ObjectFile::initialize_mergeable_sections() {
continue;
InputSection *isec = sections[esym.st_shndx];
if (!isec || isec->kind != InputChunk::MERGEABLE)
if (!isec || !isec->mergeable)
continue;
ArrayRef<StringPieceRef> pieces = ((MergeableSection *)isec)->pieces;
ArrayRef<StringPieceRef> pieces = isec->mergeable->pieces;
const StringPieceRef *ref = binary_search(pieces, esym.st_value);
if (!ref)
error(toString(this) + ": bad symbol value");
sym_pieces[i].piece = ref->piece;
sym_pieces[i].addend = esym.st_value - ref->input_offset;
if (i < first_global) {
local_symbols[i].piece_ref = *ref;
} else {
sym_pieces[i].piece = ref->piece;
sym_pieces[i].addend = esym.st_value - ref->input_offset;
}
}
for (int i = 0; i < sections.size(); i++)
if (sections[i] && sections[i]->mergeable)
sections[i] = nullptr;
}
void ObjectFile::parse() {