Link with hpc even if GhcWithInterpreter is not set
[ghc-hetmet.git] / compiler / nativeGen / PositionIndependentCode.hs
index 80023e1..6a94de2 100644 (file)
@@ -131,7 +131,7 @@ cmmMakePicReference :: CLabel -> CmmExpr
         -- everything gets relocated at runtime
 
 cmmMakePicReference lbl
-    | opt_PIC && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [
+    | (opt_PIC || not opt_Static) && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [
             CmmReg (CmmGlobal PicBaseReg),
             CmmLit $ picRelative lbl
         ]
@@ -200,7 +200,7 @@ howToAccessLabel DataReference lbl
     | otherwise = AccessDirectly
 
 
-#if x86_TARGET_ARCH || x86_64_TARGET_ARCH
+#if i386_TARGET_ARCH || x86_64_TARGET_ARCH
     -- dyld code stubs don't work for tailcalls because the
     -- stack alignment is only right for regular calls.
     -- Therefore, we have to go via a symbol pointer:
@@ -372,6 +372,9 @@ pprGotDeclaration = Pretty.empty
 -- On Darwin, we have to generate our own stub code for lazy binding..
 -- For each processor architecture, there are two versions, one for PIC
 -- and one for non-PIC.
+--
+-- Whenever you change something in this assembler output, make sure
+-- the splitter in driver/split/ghc-split.lprl recognizes the new output
 pprImportedSymbol importedLbl
 #if powerpc_TARGET_ARCH
     | Just (CodeStub, lbl) <- dynamicLinkerLabelInfo importedLbl