Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix broken -fPIC on Darwin/PPC (#7442)

The workaround described in note [darwin-x86-pic] applies to Darwin/PPC too.
  • Loading branch information...
commit 2334112f46a02a15b4e7594462ffa476a300167b 1 parent 6eb0341
@phonohawk authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 compiler/cmm/CmmPipeline.hs
View
16 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
Please sign in to comment.
Something went wrong with that request. Please try again.