From: wolfgang.thaller@gmx.net Date: Mon, 20 Nov 2006 17:25:16 +0000 (+0000) Subject: i386-darwin: disable use of code stubs for dynamic linking X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=5cfeedcc9f3ad65283d98063f0b228edca9990b2;p=ghc-hetmet.git 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. --- diff --git a/compiler/nativeGen/PositionIndependentCode.hs b/compiler/nativeGen/PositionIndependentCode.hs index 0daccb6..ffd6577 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