[project @ 2004-10-07 15:54:03 by wolfgang]
[ghc-hetmet.git] / ghc / compiler / main / DriverFlags.hs
index c09e43a..b3bda23 100644 (file)
@@ -621,11 +621,20 @@ machdepCCOpts
       --     for "normal" programs, but it doesn't support register variable
       --     declarations.
       -- -mdynamic-no-pic:
-      --     As we don't support haskell code in shared libraries anyway,
-      --     we might as well turn of PIC code generation and save space and time.
-      --     This is completely optional.
-       = return ( ["-no-cpp-precomp","-mdynamic-no-pic"], [] )
-
+      --     Turn off PIC code generation to save space and time.
+      -- -fno-common:
+      --     Don't generate "common" symbols - these are unwanted
+      --     in dynamic libraries.
+
+        = if opt_PIC
+            then return ( ["-no-cpp-precomp", "-fno-common"],
+                          ["-fno-common"] )
+            else return ( ["-no-cpp-precomp", "-mdynamic-no-pic"],
+                          ["-mdynamic-no-pic"] )
+
+   | prefixMatch "powerpc" cTARGETPLATFORM && opt_PIC
+        = return ( ["-fPIC"], ["-fPIC"] )
+  
    | otherwise
        = return ( [], [] )