From 40d0595755c28294233dde78874f49a9b4d91e9a Mon Sep 17 00:00:00 2001 From: Stephen Blackheath Date: Mon, 28 Sep 2009 20:38:00 +0000 Subject: [PATCH] Force -fPIC when linking against dynamic libraries on Mac OS/X. 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 9553081..d57ca18 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -271,6 +271,8 @@ opt_UF_DearOp = ( 4 :: Int) 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 -- 1.7.10.4