1 |
commit: f8153b536170f72d88012a48180e1e32ee92091d |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 28 13:53:25 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 30 09:54:37 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8153b53 |
7 |
|
8 |
haskell-cabal.eclass: filter out -flto|-flto=* flags |
9 |
|
10 |
`ghc` uses partial linking to glue together object |
11 |
files produced by `gcc` and `ghc`. In case of -flto* |
12 |
flags we have a chance to mix IR section incorrectly |
13 |
due to ld deficiency: https://sourceware.org/PR12291 |
14 |
|
15 |
Let's filter out -flto-related flags until binutils is |
16 |
ready. |
17 |
|
18 |
Reported-by: matoro |
19 |
Closes: https://github.com/gentoo-haskell/gentoo-haskell/issues/1110 |
20 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
21 |
|
22 |
eclass/haskell-cabal.eclass | 30 +++++++++++++++++++++++++++--- |
23 |
1 file changed, 27 insertions(+), 3 deletions(-) |
24 |
|
25 |
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass |
26 |
index 4908e4491e6..8706cc99478 100644 |
27 |
--- a/eclass/haskell-cabal.eclass |
28 |
+++ b/eclass/haskell-cabal.eclass |
29 |
@@ -342,10 +342,34 @@ cabal-configure() { |
30 |
fi |
31 |
|
32 |
# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217) |
33 |
- # so translate LDFLAGS to ghc parameters (without filtering) |
34 |
+ # so translate LDFLAGS to ghc parameters (with mild filtering). |
35 |
local flag |
36 |
- for flag in $CFLAGS; do cabalconf+=(--ghc-option="-optc$flag"); done |
37 |
- for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done |
38 |
+ for flag in $CFLAGS; do |
39 |
+ case "${flag}" in |
40 |
+ -flto|-flto=*) |
41 |
+ # binutils does not support partial linking yet: |
42 |
+ # https://github.com/gentoo-haskell/gentoo-haskell/issues/1110 |
43 |
+ # https://sourceware.org/PR12291 |
44 |
+ einfo "Filter '${flag}' out of CFLAGS (avoid lto partial linking)" |
45 |
+ continue |
46 |
+ ;; |
47 |
+ esac |
48 |
+ |
49 |
+ cabalconf+=(--ghc-option="-optc$flag") |
50 |
+ done |
51 |
+ for flag in $LDFLAGS; do |
52 |
+ case "${flag}" in |
53 |
+ -flto|-flto=*) |
54 |
+ # binutils does not support partial linking yet: |
55 |
+ # https://github.com/gentoo-haskell/gentoo-haskell/issues/1110 |
56 |
+ # https://sourceware.org/PR12291 |
57 |
+ einfo "Filter '${flag}' out of LDFLAGS (avoid lto partial linking)" |
58 |
+ continue |
59 |
+ ;; |
60 |
+ esac |
61 |
+ |
62 |
+ cabalconf+=(--ghc-option="-optl$flag") |
63 |
+ done |
64 |
|
65 |
# disable executable stripping for the executables, as portage will |
66 |
# strip by itself, and pre-stripping gives a QA warning. |