diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2021-03-01 22:33:58 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-29 17:25:49 -0400 |
commit | e72a2f770853c96f530423f0e3738aef193543b5 (patch) | |
tree | f78f00cf742afdc548dad343bb190ff5ec878ec8 /rts/linker/elf_got.c | |
parent | 710ef9d253c6f35eed4139f585230428fa042194 (diff) | |
download | haskell-e72a2f770853c96f530423f0e3738aef193543b5.tar.gz |
[linker/aarch64-elf] support section symbols for GOT relocation
Diffstat (limited to 'rts/linker/elf_got.c')
-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) { |