diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2021-03-01 22:33:58 +0800 |
---|---|---|
committer | Moritz Angermann <moritz.angermann@gmail.com> | 2021-03-30 00:48:06 -0400 |
commit | 0e046cdd4d5f5bb227e510008a7d6b6aa03c8a95 (patch) | |
tree | ef92aaa18d3f2159633d1fc924947b876a1f9e76 | |
parent | 3c92fc1f0590759c815abd65e48e1df1b62a5df2 (diff) | |
download | haskell-0e046cdd4d5f5bb227e510008a7d6b6aa03c8a95.tar.gz |
[linker/aarch64-elf] support section symbols for GOT relocation
(cherry picked from commit df0cb80073e962c8d2b144638e788eb11ca0d42e)
-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) { |