Don't use -Bsymbolic when linking the RTS
authorIan Lynagh <igloo@earth.li>
Tue, 16 Mar 2010 23:33:57 +0000 (23:33 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 16 Mar 2010 23:33:57 +0000 (23:33 +0000)
This makes the RTS hooks work when doing dynamic linking

compiler/main/DriverPipeline.hs
rts/ghc.mk

index 0ca76a2..12925ad 100644 (file)
@@ -1731,6 +1731,14 @@ linkDynLib dflags o_files dep_packages = do
     -----------------------------------------------------------------------------
 
     let output_fn = case o_file of { Just s -> s; Nothing -> "a.out"; }
+    let buildingRts = thisPackage dflags == rtsPackageId
+    let bsymbolicFlag = if buildingRts
+                        then -- -Bsymbolic breaks the way we implement
+                             -- hooks in the RTS
+                             []
+                        else -- we need symbolic linking to resolve
+                             -- non-PIC intra-package-relocations
+                             ["-Wl,-Bsymbolic"]
 
     SysTools.runLink dflags
         ([ SysTools.Option verb
@@ -1740,7 +1748,8 @@ linkDynLib dflags o_files dep_packages = do
         ++ map SysTools.Option (
            md_c_flags
         ++ o_files
-        ++ [ "-shared", "-Wl,-Bsymbolic" ] -- we need symbolic linking to resolve non-PIC intra-package-relocations
+        ++ [ "-shared" ]
+        ++ bsymbolicFlag
          ++ [ "-Wl,-soname," ++ takeFileName output_fn ] -- set the library soname
         ++ extra_ld_inputs
         ++ lib_path_opts
index b238728..a7a2c11 100644 (file)
@@ -165,7 +165,7 @@ ifneq "$$(findstring dyn, $1)" ""
 ifeq "$$(HOSTPLATFORM)" "i386-unknown-mingw32"
 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
        "$$(RM)" $$(RM_OPTS) $$@
-       "$$(rts_dist_HC)" -shared -dynamic -dynload deploy \
+       "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
          -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
 ifeq "$$(darwin_TARGET_OS)" "1"
        # Ensure library's install name is correct before anyone links with it.
@@ -174,7 +174,7 @@ endif
 else
 $$(rts_$1_LIB) : $$(rts_$1_OBJS) rts/libs.depend
        "$$(RM)" $$(RM_OPTS) $$@
-       "$$(rts_dist_HC)" -shared -dynamic -dynload deploy \
+       "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
          -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) -o $$@
 endif
 else