[project @ 2005-01-14 22:12:54 by wolfgang]
[ghc-hetmet.git] / ghc / compiler / nativeGen / PprMach.hs
index 846a855..a807cc2 100644 (file)
@@ -34,7 +34,7 @@ import Pretty
 import FastString
 import qualified Outputable
 
-import CmdLineOpts      ( opt_PIC )
+import CmdLineOpts      ( opt_PIC, opt_Static )
 
 #if __GLASGOW_HASKELL__ >= 504
 import Data.Array.ST
@@ -512,6 +512,15 @@ pprAddr (AddrRegImm r1 imm) = hcat [ pprImm imm, char '(', pprReg r1, char ')' ]
 -- -----------------------------------------------------------------------------
 -- pprData: print a 'CmmStatic'
 
+#if defined(linux_TARGET_OS)
+#if defined(powerpc_TARGET_ARCH) || defined(i386_TARGET_ARCH)
+    -- Hack to make dynamic linking work
+pprSectionHeader ReadOnlyData
+    | not opt_PIC && not opt_Static
+    = pprSectionHeader Data
+#endif
+#endif
+
 pprSectionHeader Text
     = ptext
        IF_ARCH_alpha(SLIT("\t.text\n\t.align 3") {-word boundary-}