Get linker flags correctly from GHC ≥ 7.8
authorAnders Kaseorg <andersk@mit.edu>
Thu, 19 May 2016 07:18:02 +0000 (03:18 -0400)
committerClint Adams <clint@debian.org>
Mon, 14 Nov 2016 16:35:40 +0000 (16:35 +0000)
GHC 7.8 renamed "Gcc Linker flags" to "C compiler link flags" and "Ld
Linker flags" to "ld flags"
(https://ghc.haskell.org/trac/ghc/ticket/4862).

Without this corresponding fix in Cabal, the old-time package fails to
compile on Ubuntu yakkety amd64, where the system GCC now defaults to
-pie and GHC has

    $ ghc --info | grep -i pie
     ,("C compiler flags","-fno-PIE -fno-stack-protector")
     ,("C compiler link flags","-no-pie")
     ,("ld flags","-no-pie")

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
(cherry picked from commit c993a0c6660aa10d8c79ed0cc4961c59acfc91c8)

Gbp-Pq: Name get-linker-flags-correctly

libraries/Cabal/Cabal/Distribution/Simple/GHC/Internal.hs

index 53f7d8ebbee74a2538e8003aa92de718236dffbf..d995d4c5aaeaeaaeb69de83e8f4abfbe09103cb9 100644 (file)
@@ -139,8 +139,10 @@ configureToolchain implInfo ghcProg ghcInfo =
     mbStripLocation = M.lookup "strip command" ghcInfo
 
     ccFlags        = getFlags "C compiler flags"
-    gccLinkerFlags = getFlags "Gcc Linker flags"
-    ldLinkerFlags  = getFlags "Ld Linker flags"
+    -- GHC 7.8 renamed "Gcc Linker flags" to "C compiler link flags"
+    -- and "Ld Linker flags" to "ld flags" (GHC #4862).
+    gccLinkerFlags = getFlags "Gcc Linker flags" ++ getFlags "C compiler link flags"
+    ldLinkerFlags  = getFlags "Ld Linker flags" ++ getFlags "ld flags"
 
     -- It appears that GHC 7.6 and earlier encode the tokenized flags as a
     -- [String] in these settings whereas later versions just encode the flags as