Lookup _GLOBAL_OFFSET_TABLE by symbol->addr when doing relocations
authorEdward Amsden <edward.amsden@plowtech.net>
Thu, 16 May 2019 23:41:30 +0000 (19:41 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 2 Jul 2019 20:18:05 +0000 (16:18 -0400)
rts/linker/Elf.c

index 7e5386e..6495ce1 100644 (file)
@@ -1060,7 +1060,7 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
        } else {
            symbol = &stab->symbols[ELF_R_SYM(info)];
            /* First see if it is a local symbol. */
-           if (ELF_ST_BIND(symbol->elf_sym->st_info) == STB_LOCAL) {
+           if (ELF_ST_BIND(symbol->elf_sym->st_info) == STB_LOCAL || strncmp(symbol->name, "_GLOBAL_OFFSET_TABLE_", 21) == 0) {
                S = (Elf_Addr)symbol->addr;
            } else {
                S_tmp = lookupSymbol_( symbol->name );