diff options
-rw-r--r-- | rts/linker/elf_got.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rts/linker/elf_got.c b/rts/linker/elf_got.c index b3b8c1a554..ae75329295 100644 --- a/rts/linker/elf_got.c +++ b/rts/linker/elf_got.c @@ -19,7 +19,11 @@ needGotSlot(Elf_Sym * symbol) { * in a smaller GOT, which is preferrable. */ return ELF_ST_BIND(symbol->st_info) == STB_GLOBAL - || ELF_ST_BIND(symbol->st_info) == STB_WEAK; + || ELF_ST_BIND(symbol->st_info) == STB_WEAK + // Section symbols exist primarily for relocation + // and as such may need a GOT slot. + || ELF_ST_TYPE(symbol->st_info) == STT_SECTION; + } bool @@ -82,6 +86,8 @@ fillGot(ObjectCode * oc) { if(needGotSlot(symbol->elf_sym)) { /* no type are undefined symbols */ + // Note STT_SECTION symbols should have their addres + // set prior to the fillGot call in ocResolve_ELF. if( STT_NOTYPE == ELF_ST_TYPE(symbol->elf_sym->st_info) || STB_WEAK == ELF_ST_BIND(symbol->elf_sym->st_info)) { if(0x0 == symbol->addr) { |