Force -fPIC when linking against dynamic libraries on Mac OS/X.
authorStephen Blackheath <oversensitive.pastors.stephen@blacksapphire.com>
Mon, 28 Sep 2009 20:38:00 +0000 (20:38 +0000)
committerStephen Blackheath <oversensitive.pastors.stephen@blacksapphire.com>
Mon, 28 Sep 2009 20:38:00 +0000 (20:38 +0000)
Otherwise you get
/tmp/ghc7602_0/ghc7602_0.s:207:0:
   non-relocatable subtraction expression, "___stginit_Lib_dyn" minus "L1x2;4"
/tmp/ghc7602_0/ghc7602_0.s:207:0:
   symbol: "___stginit_Lib_dyn" can't be undefined in a subtraction expression

compiler/main/StaticFlags.hs

index 9553081..d57ca18 100644 (file)
@@ -271,6 +271,8 @@ opt_UF_DearOp            = ( 4 :: Int)
 opt_PIC :: Bool
 #if darwin_TARGET_OS && x86_64_TARGET_ARCH
 opt_PIC                         = True
 opt_PIC :: Bool
 #if darwin_TARGET_OS && x86_64_TARGET_ARCH
 opt_PIC                         = True
+#elif darwin_TARGET_OS
+opt_PIC                         = lookUp (fsLit "-fPIC") || not opt_Static
 #else
 opt_PIC                         = lookUp (fsLit "-fPIC")
 #endif
 #else
 opt_PIC                         = lookUp (fsLit "-fPIC")
 #endif