summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2013-09-06 11:08:38 -0400
committerPatrick Palka <patrick@parcs.ath.cx>2013-09-06 11:08:38 -0400
commit67d1d4edd5943f4425578a87e6f0940a442b3892 (patch)
treebb83a454f677b372c4f82502d2ff5edf92f34d65 /compiler
parent1f5338e7b71f56c6d2451b9b23608c851bf90c8a (diff)
parentdf614779c356ea6aef29367a8dd1ca819b03a1d1 (diff)
downloadhaskell-67d1d4edd5943f4425578a87e6f0940a442b3892.tar.gz
Merge remote-tracking branch 'origin/master' into ghc-parmake-gsoc
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ghc.mk17
-rw-r--r--compiler/main/DriverPipeline.hs15
-rw-r--r--compiler/main/SysTools.lhs3
-rw-r--r--compiler/parser/Parser.y.pp18
-rw-r--r--compiler/stranal/WwLib.lhs7
5 files changed, 37 insertions, 23 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index af289d436c..caf491e4c1 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -347,8 +347,23 @@ else
compiler_CONFIGURE_OPTS += --ghc-option=-DNO_REGS
endif
-ifeq "$(GhcProfiled)" "YES"
+# If we're bootstrapping the compiler during stage2, or we're being
+# built by a GHC whose version is > 7.8, we need -fcmm-sink to be
+# passed to the compiler. This is required on x86 to avoid the
+# register allocator running out of stack slots when compiling this
+# module with -fPIC -dynamic.
+ifeq "$(CMM_SINK_BOOTSTRAP_IS_NEEDED)" "YES"
+compiler/stage1/build/Parser_HC_OPTS += -fcmm-sink
+endif
+# However, we may be using e.g. 7.6, and thus the bootstrap compiler
+# does not need to pass -fcmm-sink, but stage1+ does!
+# We pass -fcmm-sink to every stage != 1
+# See #8182 for all the details
+compiler/stage2/build/Parser_HC_OPTS += -fcmm-sink
+compiler/stage3/build/Parser_HC_OPTS += -fcmm-sink
+
+ifeq "$(GhcProfiled)" "YES"
# If we're profiling GHC then we want SCCs. However, adding -auto-all
# everywhere tends to give a hard-to-read profile, and adds lots of
# overhead. A better approach is to proceed top-down; identify the
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 8fc44ed81f..7c5bc90647 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1917,11 +1917,22 @@ linkBinary' staticLink dflags o_files dep_packages = do
-- on x86.
++ (if sLdSupportsCompactUnwind mySettings &&
not staticLink &&
- platformOS platform == OSDarwin &&
- platformArch platform `elem` [ArchX86, ArchX86_64]
+ (platformOS platform == OSDarwin || platformOS platform == OSiOS) &&
+ case platformArch platform of
+ ArchX86 -> True
+ ArchX86_64 -> True
+ ArchARM {} -> True
+ _ -> False
then ["-Wl,-no_compact_unwind"]
else [])
+ -- '-no_pie'
+ -- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722
+ ++ (if platformOS platform == OSiOS &&
+ not staticLink
+ then ["-Wl,-no_pie"]
+ else [])
+
-- '-Wl,-read_only_relocs,suppress'
-- ld gives loads of warnings like:
-- ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index 1b83592118..0db5e06ed6 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -681,6 +681,9 @@ getLinkerInfo' dflags = do
-- that doesn't support --version. We can just assume that's
-- what we're using.
return $ DarwinLD []
+ OSiOS ->
+ -- Ditto for iOS
+ return $ DarwinLD []
OSMinGW32 ->
-- GHC doesn't support anything but GNU ld on Windows anyway.
-- Process creation is also fairly expensive on win32, so
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index 489b5affa4..634d3c76f0 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -24,24 +24,6 @@ to inline certain key external functions, so we instruct GHC not to
throw away inlinings as it would normally do in -O0 mode.
-}
--- CPP tricks because we want the directives in the output of the
--- first CPP pass.
---
--- Clang note, 6/17/2013 by aseipp: It is *extremely* important (for
--- some reason) that there be a line of whitespace between the two
--- definitions here, and the subsequent use of __IF_GHC_77__ - this
--- seems to be a bug in clang or something, where having the line of
--- whitespace will make the preprocessor correctly format the rendered
--- lines in the 'two step' CPP pass. No, this is not a joke.
-#define __IF_GHC_77__ #if __GLASGOW_HASKELL__ >= 707
-#define __ENDIF__ #endif
-
-__IF_GHC_77__
--- Required on x86 to avoid the register allocator running out of
--- stack slots when compiling this module with -fPIC -dynamic.
-{-# OPTIONS_GHC -fcmm-sink #-}
-__ENDIF__
-
module Parser ( parseModule, parseStmt, parseIdentifier, parseType,
parseHeader ) where
diff --git a/compiler/stranal/WwLib.lhs b/compiler/stranal/WwLib.lhs
index ca64a7fbce..2ab4bd9ba0 100644
--- a/compiler/stranal/WwLib.lhs
+++ b/compiler/stranal/WwLib.lhs
@@ -214,8 +214,11 @@ the sharing of E. Since absence analysis and worker-wrapper are keen
to remove such unused arguments, we add in a void argument to prevent
the function from becoming a thunk.
-The user can avoid that argument with the -ffun-to-thunk
-flag. However, removing all the value argus may introduce space leaks.
+The user can avoid adding the void argument with the -ffun-to-thunk
+flag. However, this can create sharing, which may be bad in two ways. 1) It can
+create a space leak. 2) It can prevent inlining *under a lambda*. If w/w
+removes the last argument from a function f, then f now looks like a thunk, and
+so f can't be inlined *under a lambda*.
Note [All One-Shot Arguments of a Worker]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~