Move linker flags into the settings file; fixes #4862
authorIan Lynagh <ian@well-typed.com>
Sun, 5 Aug 2012 17:08:22 +0000 (18:08 +0100)
committerIan Lynagh <ian@well-typed.com>
Sun, 5 Aug 2012 17:08:22 +0000 (18:08 +0100)
They were getting baked into Config.hs before.

aclocal.m4
compiler/ghc.mk
compiler/main/DriverPipeline.hs
compiler/main/DynFlags.hs
settings.in

index a43b24a..c2eb103 100644 (file)
@@ -365,7 +365,6 @@ AC_DEFUN([FP_SETTINGS],
     then
         mingw_bin_prefix=mingw/bin/
         SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe"
-        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 $CONF_GCC_LINKER_OPTS_STAGE2"
         SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe"
         SettingsPerlCommand='$topdir/../perl/perl.exe'
         SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe"
@@ -373,7 +372,6 @@ AC_DEFUN([FP_SETTINGS],
         SettingsTouchCommand='$topdir/touchy.exe'
     else
         SettingsCCompilerCommand="$WhatGccIsCalled"
-        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 $CONF_GCC_LINKER_OPTS_STAGE2"
         SettingsArCommand="$ArCmd"
         SettingsPerlCommand="$PerlCmd"
         SettingsDllWrapCommand="/bin/false"
@@ -392,8 +390,11 @@ AC_DEFUN([FP_SETTINGS],
           SettingsOptCommand="$OptCmd"
         fi
     fi
+    SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 $CONF_GCC_LINKER_OPTS_STAGE2"
+    SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
     AC_SUBST(SettingsCCompilerCommand)
     AC_SUBST(SettingsCCompilerFlags)
+    AC_SUBST(SettingsLdFlags)
     AC_SUBST(SettingsArCommand)
     AC_SUBST(SettingsPerlCommand)
     AC_SUBST(SettingsDllWrapCommand)
index 1ea6159..f5330c0 100644 (file)
@@ -71,10 +71,6 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
        @echo 'cBooterVersion        = "$(GhcVersion)"'                     >> $@
        @echo 'cStage                :: String'                             >> $@
        @echo 'cStage                = show (STAGE :: Int)'                 >> $@
-       @echo 'cGccLinkerOpts        :: [String]'                           >> $@
-       @echo 'cGccLinkerOpts        = words "$(CONF_GCC_LINKER_OPTS_STAGE$*)"' >> $@
-       @echo 'cLdLinkerOpts         :: [String]'                           >> $@
-       @echo 'cLdLinkerOpts         = words "$(CONF_LD_LINKER_OPTS_STAGE$*)"'  >> $@
        @echo 'cIntegerLibrary       :: String'                             >> $@
        @echo 'cIntegerLibrary       = "$(INTEGER_LIBRARY)"'                >> $@
        @echo 'cIntegerLibraryType   :: IntegerLibrary'                     >> $@
index 14fff98..84b7f6a 100644 (file)
@@ -1175,10 +1175,8 @@ runPhase As input_fn dflags
                         = do
                             llvmVer <- io $ figureLlvmVersion dflags
                             return $ case llvmVer of
-                                -- using cGccLinkerOpts here but not clear if
-                                -- opt_c isn't a better choice
                                 Just n | n >= 30 ->
-                                    (SysTools.runClang, cGccLinkerOpts)
+                                    (SysTools.runClang, getOpts dflags opt_c)
 
                                 _ -> (SysTools.runAs, getOpts dflags opt_a)
 
index 415fef2..dcb3188 100644 (file)
@@ -2907,7 +2907,6 @@ compilerInfo dflags
        ("Debug on",                    show debugIsOn),
        ("LibDir",                      topDir dflags),
        ("Global Package DB",           systemPackageConfig dflags),
-       ("Gcc Linker flags",            show cGccLinkerOpts),
        ("Ld Linker flags",             show cLdLinkerOpts)
       ]
 
index 80741ab..d6245d6 100644 (file)
@@ -1,6 +1,7 @@
 [("GCC extra via C opts", "@GccExtraViaCOpts@"),
  ("C compiler command", "@SettingsCCompilerCommand@"),
  ("C compiler flags", "@SettingsCCompilerFlags@"),
+ ("ld flags", "@SettingsLdFlags@"),
  ("ar command", "@SettingsArCommand@"),
  ("ar flags", "@ArArgs@"),
  ("ar supports at file", "@ArSupportsAtFile@"),