[Git][ghc/ghc][wip/T18857] Fixup SymbolExtras
Moritz Angermann
gitlab at gitlab.haskell.org
Tue Nov 17 03:34:36 UTC 2020
Moritz Angermann pushed to branch wip/T18857 at Glasgow Haskell Compiler / GHC
Commits:
a2bc2220 by Moritz Angermann at 2020-11-17T03:33:50+00:00
Fixup SymbolExtras
- - - - -
4 changed files:
- rts/LinkerInternals.h
- rts/linker/Elf.c
- rts/linker/SymbolExtras.c
- rts/linker/elf_reloc_aarch64.c
Changes:
=====================================
rts/LinkerInternals.h
=====================================
@@ -141,7 +141,7 @@ typedef struct _Segment {
int n_sections;
} Segment;
-#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
#define NEED_SYMBOL_EXTRAS 1
#endif
=====================================
rts/linker/Elf.c
=====================================
@@ -940,7 +940,7 @@ ocGetNames_ELF ( ObjectCode* oc )
symbol->addr = (SymbolAddr*)(
(intptr_t) oc->sections[secno].start +
(intptr_t) symbol->elf_sym->st_value);
-
+ ASSERT(symbol->addr != 0x0);
if (ELF_ST_BIND(symbol->elf_sym->st_info) == STB_LOCAL) {
isLocal = true;
isWeak = false;
@@ -1867,6 +1867,7 @@ ocResolve_ELF ( ObjectCode* oc )
#endif
ASSERT(symbol->elf_sym->st_name == 0);
ASSERT(symbol->elf_sym->st_value == 0);
+ ASSERT(0x0 != oc->sections[ secno ].start);
symbol->addr = oc->sections[ secno ].start;
}
}
@@ -1940,6 +1941,7 @@ int ocRunInit_ELF( ObjectCode *oc )
init_start = (init_t*)init_startC;
init_end = (init_t*)(init_startC + shdr[i].sh_size);
for (init = init_start; init < init_end; init++) {
+ ASSERT(0x0 != *init);
(*init)(argc, argv, envv);
}
}
=====================================
rts/linker/SymbolExtras.c
=====================================
@@ -140,7 +140,12 @@ void ocProtectExtras(ObjectCode* oc)
* non-executable.
*/
} else if (USE_CONTIGUOUS_MMAP || RtsFlags.MiscFlags.linkerAlwaysPic) {
- mmapForLinkerMarkExecutable(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras);
+ // XXX I'm not sure how this is supposed to work.
+ // XXX
+ // XXX oc->symbol_extras would need to be assigned on page boundaries, and mmaped
+ // XXX but this is not guaranteed in any form or fashion?
+ // XXX
+ // mmapForLinkerMarkExecutable(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras);
} else {
/*
* The symbol extras were allocated via m32. They will be protected when
=====================================
rts/linker/elf_reloc_aarch64.c
=====================================
@@ -297,7 +297,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) {
relTab->sectionHeader->sh_link,
ELF64_R_SYM((Elf64_Xword)rel->r_info));
- assert(symbol != NULL);
+ assert(0x0 != symbol);
/* decode implicit addend */
int64_t addend = decodeAddendAarch64(targetSection, rel);
@@ -324,6 +324,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) {
ELF64_R_SYM((Elf64_Xword)rel->r_info));
assert(0x0 != symbol);
+ assert(0x0 != symbol->addr);
/* take explicit addend */
int64_t addend = rel->r_addend;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a2bc22207f09d8fc8837f2f33452f85d0d4ed688
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a2bc22207f09d8fc8837f2f33452f85d0d4ed688
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201116/30fd0f2c/attachment-0001.html>
More information about the ghc-commits
mailing list