From 22294cdadb1ebb72aaffe3922010b810fec0530d Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 19 Aug 2010 23:37:43 +0000 Subject: [PATCH] Remove some duplication of C flags We now use the CONF_CC_OPTS_STAGEn C flags in machdepCCOpts, rather than repeating them there. --- compiler/ghc.mk | 4 ++++ compiler/main/DynFlags.hs | 25 ++++++++----------------- mk/config.mk.in | 3 ++- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 60123e9..7eaa158 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -70,6 +70,10 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/. @echo 'cBooterVersion = "$(GhcVersion)"' >> $@ @echo 'cStage :: String' >> $@ @echo 'cStage = show (STAGE :: Int)' >> $@ + @echo 'cCcOpts :: [String]' >> $@ + @echo 'cCcOpts = words "$(CONF_CC_OPTS_STAGE$*)"' >> $@ + @echo 'cLdOpts :: [String]' >> $@ + @echo 'cLdOpts = words "$(CONF_LD_OPTS_STAGE$*)"' >> $@ @echo 'cIntegerLibrary :: String' >> $@ @echo 'cIntegerLibrary = "$(INTEGER_LIBRARY)"' >> $@ @echo 'cSplitObjs :: String' >> $@ diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 1775bbf..b00424c 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -2138,7 +2138,12 @@ setOptHpcDir arg = upd $ \ d -> d{hpcDir = arg} machdepCCOpts :: DynFlags -> ([String], -- flags for all C compilations [String]) -- for registerised HC compilations -machdepCCOpts _dflags +machdepCCOpts dflags = let (flagsAll, flagsRegHc) = machdepCCOpts' dflags + in (cCcOpts ++ flagsAll, flagsRegHc) + +machdepCCOpts' :: DynFlags -> ([String], -- flags for all C compilations + [String]) -- for registerised HC compilations +machdepCCOpts' _dflags #if alpha_TARGET_ARCH = ( ["-w", "-mieee" #ifdef HAVE_THREADED_RTS_SUPPORT @@ -2173,19 +2178,9 @@ machdepCCOpts _dflags -- the fp (%ebp) for our register maps. = let n_regs = stolen_x86_regs _dflags in - ( -#if darwin_TARGET_OS - -- By default, gcc on OS X will generate SSE - -- instructions, which need things 16-byte aligned, - -- but we don't 16-byte align things. Thus drop - -- back to generic i686 compatibility. Trac #2983. - -- - -- Since Snow Leopard (10.6), gcc defaults to x86_64. - ["-march=i686", "-m32"], -#else + ( [ if opt_Static then "-DDONT_WANT_WIN32_DLL_SUPPORT" else "" ], -#endif [ "-fno-defer-pop", "-fomit-frame-pointer", -- we want -fno-builtin, because when gcc inlines @@ -2200,11 +2195,7 @@ machdepCCOpts _dflags #elif x86_64_TARGET_ARCH = ( -#if darwin_TARGET_OS - ["-m64"], -#else - [], -#endif + [], ["-fomit-frame-pointer", "-fno-asynchronous-unwind-tables", -- the unwind tables are unnecessary for HC code, diff --git a/mk/config.mk.in b/mk/config.mk.in index 8cc3d2e..6871d7e 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -536,7 +536,8 @@ endif endif # C compiler and linker flags from configure (e.g. -m to select -# correct C compiler backend). +# correct C compiler backend). The stage number is the stage of GHC +# that is being used to compile with. CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@ CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@ CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@ -- 1.7.10.4