From 348e3f8eea84bdbfa2f3a8adc772c4b67c27f756 Mon Sep 17 00:00:00 2001
From: Edward Amsden <edward.amsden@plowtech.net>
Date: Thu, 16 May 2019 19:41:30 -0400
Subject: [PATCH] Lookup _GLOBAL_OFFSET_TABLE by symbol->addr when doing
 relocations

---
 rts/linker/Elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index 7e5386e1789..6495ce1d65d 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -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 );
-- 
GitLab