summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-02-28 21:03:40 +0800
committerMoritz Angermann <moritz.angermann@gmail.com>2021-03-07 22:19:19 +0800
commitd857c81052d03b8897a661ec1da98bb82a28306a (patch)
treeadf246aad15846b2fe2d67cbd7c4f7cb23db3631
parent398994e19699f788a7810b4044e7aa817a10e73e (diff)
downloadhaskell-d857c81052d03b8897a661ec1da98bb82a28306a.tar.gz
[aarch64/elf] be more informative.
-rw-r--r--rts/linker/elf_reloc_aarch64.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/rts/linker/elf_reloc_aarch64.c b/rts/linker/elf_reloc_aarch64.c
index 8cffb9f03e..0e11585e87 100644
--- a/rts/linker/elf_reloc_aarch64.c
+++ b/rts/linker/elf_reloc_aarch64.c
@@ -182,7 +182,7 @@ encodeAddendAarch64(Section * section, Elf_Rel * rel, int64_t addend) {
* @return The new computed addend.
*/
static int64_t
-computeAddend(Section * section, Elf_Rel * rel,
+computeAddend(ObjectCode * oc, Section * section, Elf_Rel * rel,
ElfSymbol * symbol, int64_t addend) {
/* Position where something is relocated */
@@ -266,11 +266,17 @@ computeAddend(Section * section, Elf_Rel * rel,
// TODO: fix this story proper, so that the transformation
// makes sense without resorting to: everyone else
// does it like this as well.
+ if (0x0 == GOT_S) {
+ barf("PAGE: No GOT address for %s in %s for section type: %d and size: %lu.\n", symbol->name, OC_INFORMATIVE_FILENAME(oc), section->kind, section->size);
+ }
assert(0x0 != GOT_S);
return Page(GOT_S+A) - Page(P);
}
case COMPAT_R_AARCH64_LD64_GOT_LO12_NC: {
// G(GDAT(S+A))
+ if (0x0 == GOT_S) {
+ barf("LO12_NC: No GOT address for %s in %s for section type: %d and size: %lu.\n", symbol->name, OC_INFORMATIVE_FILENAME(oc), section->kind, section->size);
+ }
assert(0x0 != GOT_S);
return (GOT_S + A) & 0xfff;
}
@@ -302,7 +308,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) {
/* decode implicit addend */
int64_t addend = decodeAddendAarch64(targetSection, rel);
- addend = computeAddend(targetSection, rel, symbol, addend);
+ addend = computeAddend(oc, targetSection, rel, symbol, addend);
encodeAddendAarch64(targetSection, rel, addend);
}
}
@@ -329,7 +335,7 @@ relocateObjectCodeAarch64(ObjectCode * oc) {
/* take explicit addend */
int64_t addend = rel->r_addend;
- addend = computeAddend(targetSection, (Elf_Rel*)rel,
+ addend = computeAddend(oc, targetSection, (Elf_Rel*)rel,
symbol, addend);
encodeAddendAarch64(targetSection, (Elf_Rel*)rel, addend);
}