[commit: ghc] master: Fix #7722: iOS runtime loader quirk. (d6a6974)

David Terei davidterei at gmail.com
Thu Mar 7 22:30:03 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d6a6974f3b88417fcc0d780d164251331bcf9309

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

commit d6a6974f3b88417fcc0d780d164251331bcf9309
Author: David Terei <davidterei at gmail.com>
Date:   Thu Mar 7 13:29:00 2013 -0800

    Fix #7722: iOS runtime loader quirk.
    
    Patch from Stephen Blackheath!

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

 compiler/main/DriverPipeline.hs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 0782845..f2fba96 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1445,9 +1445,12 @@ runPhase LlvmLlc input_fn dflags
 
     let lc_opts = getOpts dflags opt_lc
         opt_lvl = max 0 (min 2 $ optLevel dflags)
-        rmodel | gopt Opt_PIC dflags          = "pic"
-               | not (gopt Opt_Static dflags) = "dynamic-no-pic"
-               | otherwise                    = "static"
+        -- iOS requires external references to be loaded indirectly from the
+        -- DATA segment or dyld traps at runtime writing into TEXT: see #7722
+        rmodel | platformOS (targetPlatform dflags) == OSiOS = "dynamic-no-pic"
+               | gopt Opt_PIC dflags                         = "pic"
+               | not (gopt Opt_Static dflags)                = "dynamic-no-pic"
+               | otherwise                                   = "static"
         tbaa | ver < 29                 = "" -- no tbaa in 2.8 and earlier
              | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
              | otherwise                = "--enable-tbaa=false"





More information about the ghc-commits mailing list