summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-12-28 13:53:25 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2021-01-30 09:54:37 +0000
commitf8153b536170f72d88012a48180e1e32ee92091d (patch)
treee786c342f20e3c0597c7f7a926cef2eb5a2995eb /eclass
parentapp-text/xpdf: version bump (diff)
downloadgentoo-f8153b536170f72d88012a48180e1e32ee92091d.tar.gz
gentoo-f8153b536170f72d88012a48180e1e32ee92091d.tar.bz2
gentoo-f8153b536170f72d88012a48180e1e32ee92091d.zip
haskell-cabal.eclass: filter out -flto|-flto=* flags
`ghc` uses partial linking to glue together object files produced by `gcc` and `ghc`. In case of -flto* flags we have a chance to mix IR section incorrectly due to ld deficiency: https://sourceware.org/PR12291 Let's filter out -flto-related flags until binutils is ready. Reported-by: matoro Closes: https://github.com/gentoo-haskell/gentoo-haskell/issues/1110 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/haskell-cabal.eclass30
1 files changed, 27 insertions, 3 deletions
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 4908e4491e60..8706cc99478e 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -342,10 +342,34 @@ cabal-configure() {
fi
# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
- # so translate LDFLAGS to ghc parameters (without filtering)
+ # so translate LDFLAGS to ghc parameters (with mild filtering).
local flag
- for flag in $CFLAGS; do cabalconf+=(--ghc-option="-optc$flag"); done
- for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done
+ for flag in $CFLAGS; do
+ case "${flag}" in
+ -flto|-flto=*)
+ # binutils does not support partial linking yet:
+ # https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
+ # https://sourceware.org/PR12291
+ einfo "Filter '${flag}' out of CFLAGS (avoid lto partial linking)"
+ continue
+ ;;
+ esac
+
+ cabalconf+=(--ghc-option="-optc$flag")
+ done
+ for flag in $LDFLAGS; do
+ case "${flag}" in
+ -flto|-flto=*)
+ # binutils does not support partial linking yet:
+ # https://github.com/gentoo-haskell/gentoo-haskell/issues/1110
+ # https://sourceware.org/PR12291
+ einfo "Filter '${flag}' out of LDFLAGS (avoid lto partial linking)"
+ continue
+ ;;
+ esac
+
+ cabalconf+=(--ghc-option="-optl$flag")
+ done
# disable executable stripping for the executables, as portage will
# strip by itself, and pre-stripping gives a QA warning.