diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2021-03-01 22:33:58 +0800 |
---|---|---|
committer | Zubin <zubin.duggal@gmail.com> | 2021-10-11 15:39:42 +0000 |
commit | 755380c741e3f826ddd08adf01e66501053ccba8 (patch) | |
tree | 1fb906aae7d8b53dc84e5dbc2b840d0348fe5d43 | |
parent | f25ec9ce6af3b0ab17f113e9e58d59a9a2c2b04b (diff) | |
download | haskell-755380c741e3f826ddd08adf01e66501053ccba8.tar.gz |
[linker/aarch64-elf] support section symbols for GOT relocation
(cherry picked from commit e72a2f770853c96f530423f0e3738aef193543b5)
-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 18f36ac3dc..f68675d35e 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 @@ -85,6 +89,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) { |