summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmPipeline.hs
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2012-11-24 20:07:27 +0900
committerPHO <pho@cielonegro.org>2012-11-24 20:07:27 +0900
commit2334112f46a02a15b4e7594462ffa476a300167b (patch)
treeef2e7884c93bd0074868b23876929180b9fa0868 /compiler/cmm/CmmPipeline.hs
parent6eb0341c83975b6d9112d55b0f6a39460c8ffdf9 (diff)
downloadhaskell-2334112f46a02a15b4e7594462ffa476a300167b.tar.gz
Fix broken -fPIC on Darwin/PPC (#7442)
The workaround described in note [darwin-x86-pic] applies to Darwin/PPC too.
Diffstat (limited to 'compiler/cmm/CmmPipeline.hs')
-rw-r--r--compiler/cmm/CmmPipeline.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs
index 4e9a90a153..159a31de11 100644
--- a/compiler/cmm/CmmPipeline.hs
+++ b/compiler/cmm/CmmPipeline.hs
@@ -183,10 +183,12 @@ cpsTop hsc_env proc =
-- the entry point.
splitting_proc_points = hscTarget dflags /= HscAsm
|| not (tablesNextToCode dflags)
- || usingDarwinX86Pic -- Note [darwin-x86-pic]
- usingDarwinX86Pic = platformArch platform == ArchX86
- && platformOS platform == OSDarwin
- && gopt Opt_PIC dflags
+ || usingInconsistentPicReg -- Note [darwin-x86-pic]
+ usingInconsistentPicReg = ( platformArch platform == ArchX86 ||
+ platformArch platform == ArchPPC
+ )
+ && platformOS platform == OSDarwin
+ && gopt Opt_PIC dflags
{- Note [darwin-x86-pic]
@@ -205,6 +207,12 @@ points, then at the join point we don't have a consistent value for
Hence, on x86/Darwin, we have to split proc points, and then each proc
point will get its own PIC initialisation sequence.
+The situation is the same for ppc/Darwin. We use essentially the same
+sequence to load the program counter onto reg:
+
+ bcl 20,31,1f
+ 1: mflr reg
+
This isn't an issue on x86/ELF, where the sequence is
call 1f