Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2334112f46a02a15b4e7594462ffa476a300167b

>---------------------------------------------------------------

commit 2334112f46a02a15b4e7594462ffa476a300167b
Author: PHO <p...@cielonegro.org>
Date:   Sat Nov 24 20:07:27 2012 +0900

    Fix broken -fPIC on Darwin/PPC (#7442)
    
    The workaround described in note [darwin-x86-pic] applies to Darwin/PPC too.

>---------------------------------------------------------------

 compiler/cmm/CmmPipeline.hs |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/compiler/cmm/CmmPipeline.hs b/compiler/cmm/CmmPipeline.hs
index 4e9a90a..159a31d 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



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to