Package: ghc / 8.0.1-17

get-linker-flags-correctly Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From c30b179a73d9fd3f6edcdda5e881523cd6edd46a Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Thu, 19 May 2016 03:18:02 -0400
Subject: [PATCH] =?utf8?q?Get=20linker=20flags=20correctly=20from=20GHC=20?=
 =?utf8?q?=E2=89=A5=207.8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

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)
---
 libraries/Cabal/Cabal/Distribution/Simple/GHC/Internal.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/libraries/Cabal/Cabal/Distribution/Simple/GHC/Internal.hs
+++ b/libraries/Cabal/Cabal/Distribution/Simple/GHC/Internal.hs
@@ -139,8 +139,10 @@
     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