summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-02-18 12:32:55 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-25 21:10:57 -0500
commitf35aca4d0612063155792587482a7905981c7070 (patch)
tree6a9941012c0b3d0af23555cc912debd4fd8dd101
parent4ad8ce0b5c741862e2f94fd362077068b9b669d3 (diff)
downloadhaskell-f35aca4d0612063155792587482a7905981c7070.tar.gz
rts/adjustor: Always place adjustor templates in data section
@nrnrnr points out that on his machine ld.lld rejects text relocations. Generalize the Darwin text-relocation avoidance logic to account for this.
-rw-r--r--rts/adjustor/NativeAmd64Asm.S12
1 files changed, 8 insertions, 4 deletions
diff --git a/rts/adjustor/NativeAmd64Asm.S b/rts/adjustor/NativeAmd64Asm.S
index 32e8da50fd..a4b0c9b484 100644
--- a/rts/adjustor/NativeAmd64Asm.S
+++ b/rts/adjustor/NativeAmd64Asm.S
@@ -14,11 +14,10 @@
CSYM(x):
-#if defined(darwin_HOST_OS)
/*
- * Note [Adjustor templates live in data section on Darwin]
+ * Note [Adjustor templates live in data section]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * Apple Darwin's linker does not allow relocations in the text section; in
+ * Some linkers (namely Apple's ld64 and some ld.lld configurations on Linux) do not allow relocations in the text section; in
* principle this should be mitigated by only using local symbol references, as
* described in Note [Adjustors: Local symbol references]. However, for reasons
* that remain a mystery the assembler produces a relocations regardless.
@@ -26,7 +25,10 @@
* we will never execute it here; it will always be copied to an executable
* page first.
*/
+#if defined(darwin_HOST_OS)
.section __DATA,__data
+#elif defined(linux_HOST_OS)
+.section .data
#endif
/*
@@ -84,9 +86,11 @@ lcl_complex_ccall_adjustor_context: // See Note [Adjustors: Local symbol referen
DECLARE_CSYM(complex_ccall_adjustor_end)
+/* See Note [Adjustor templates live in data section]. */
#if defined(darwin_HOST_OS)
-/* See Note [Adjustor templates live in data section on Darwin]. */
.section __TEXT,__text
+#elif defined(linux_HOST_OS)
+.section .text
#endif
/*