summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/PositionIndependentCode.hs
diff options
context:
space:
mode:
authorwolfgang.thaller@gmx.net <unknown>2006-11-20 17:25:16 +0000
committerwolfgang.thaller@gmx.net <unknown>2006-11-20 17:25:16 +0000
commit5cfeedcc9f3ad65283d98063f0b228edca9990b2 (patch)
tree02d902860eb706a41bb4e05b57b4d55454416f89 /compiler/nativeGen/PositionIndependentCode.hs
parent91d2dae62cc0249671f00db03e9be330a0a586a0 (diff)
downloadhaskell-5cfeedcc9f3ad65283d98063f0b228edca9990b2.tar.gz
i386-darwin: disable use of code stubs for dynamic linking
We can't use lazy binding for tail-calls accross shared libraries, because dyld will crash due to incorrect stack layout. We can't get the stack alignment right for both cross-library tailcalls and foreign calls, so we have to bypass the stub code altogether and load the address to branch to from the non-lazy pointer table.
Diffstat (limited to 'compiler/nativeGen/PositionIndependentCode.hs')
-rw-r--r--compiler/nativeGen/PositionIndependentCode.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/nativeGen/PositionIndependentCode.hs b/compiler/nativeGen/PositionIndependentCode.hs
index 0daccb6530..ffd65773c7 100644
--- a/compiler/nativeGen/PositionIndependentCode.hs
+++ b/compiler/nativeGen/PositionIndependentCode.hs
@@ -175,6 +175,11 @@ howToAccessLabel _ lbl | labelDynamic lbl = AccessViaSymbolPtr
-- It is always possible to access something indirectly,
-- even when it's not necessary.
+#if powerpc_TARGET_ARCH || powerpc64_TARGET_ARCH
+ -- on i386 and probably also on x86_64, dyld code stubs don't
+ -- work for tailcalls because the stack alignment is only right
+ -- for regular calls.
+
howToAccessLabel True lbl
-- jumps to a dynamic library go via a symbol stub
| labelDynamic lbl = AccessViaStub
@@ -186,7 +191,8 @@ howToAccessLabel True lbl
-- we'd need to pass the current Module all the way in to
-- this function.
| opt_PIC && externallyVisibleCLabel lbl = AccessViaStub
-howToAccessLabel False lbl
+#endif
+howToAccessLabel _ lbl
-- data access to a dynamic library goes via a symbol pointer
| labelDynamic lbl = AccessViaSymbolPtr
-- cross-module PIC references: same as above