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-10-26 14:52:55 +09:00
parent 2ecbc35520
commit aaf6763a5d
3 changed files with 11 additions and 6 deletions

View File

@ -30,12 +30,10 @@ void InputSection::scan_relocations() {
return;
for (const ELF64LE::Rela &rel : rels) {
int idx = rel.getSymbol(false);
if (idx < file->first_global)
Symbol *sym = file->get_symbol(rel.getSymbol(false));
if (!sym)
continue;
Symbol *sym = file->symbols[idx - file->first_global];
switch (rel.getType(false)) {
case R_X86_64_GOTPCREL:
case R_X86_64_TLSGD:

View File

@ -394,6 +394,7 @@ int main(int argc, char **argv) {
{
MyTimer t("sym_addr");
for_each(files, [](ObjectFile *file) {
});
}

10
mold.h
View File

@ -400,8 +400,11 @@ public:
StringRef get_filename();
bool is_in_archive();
std::vector<Symbol *> symbols;
int first_global = 0;
Symbol *get_symbol(uint32_t idx) {
if (idx < first_global)
return nullptr;
return symbols[first_global - idx];
}
std::vector<InputSection *> sections;
StringRef archive_name;
@ -420,6 +423,9 @@ private:
std::vector<StringPiece *> merged_strings_alloc;
std::vector<StringPiece *> merged_strings_noalloc;
std::vector<Symbol *> symbols;
int first_global = 0;
ArrayRef<ELF64LE::Shdr> elf_sections;
ArrayRef<ELF64LE::Sym> elf_syms;
StringRef string_table;