ghc: spell '-nopie' as '-no-pie' for gcc-6.3.0, bug #606666
authorSergei Trofimovich <slyfox@gentoo.org>
Tue, 14 Feb 2017 10:01:08 +0000 (10:01 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Tue, 14 Feb 2017 22:16:39 +0000 (22:16 +0000)
Gentoo upstreamed -pie/-nopie patch to GCC upstream but
there is a twist: '-nopie' gentoo flag became '-no-pie'.

But at least '-no-pie' is accessible in both vanilla
and hardened profiles of gcc-6.3.0.

Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/606666
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
dev-lang/ghc/ghc-7.10.3.ebuild
dev-lang/ghc/ghc-8.0.2.ebuild

index ac9989cf6e5caf4b4f6c0e14f4eff5db224a386e..a963d059c61c836b17bcbf93cfd1412f3075e81f 100644 (file)
@@ -244,9 +244,15 @@ ghc_setup_cflags() {
                append-ghc-cflags link ${flag}
        done
 
-       # hardened-gcc needs to be disabled, because the mangler doesn't accept
-       # its output.
+       # hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
+       # are not built with fPIC, bug #606666
        gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
+       tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
+               # gcc-6.3 has support for -no-pie upstream, but spelling differs from
+               # gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
+               # hardened users try '-pie' in USE=ghcbootstrap mode.
+               append-ghc-cflags persistent compile link -no-pie
+       fi
        gcc-specs-ssp && append-ghc-cflags persistent compile      -fno-stack-protector
 
        # prevent from failind building unregisterised ghc:
index e6dc320cb76ad49cdffdee2f49e4a35e2081d1aa..e5abb43d9463e476dc605e2faa4ef62acca462bf 100644 (file)
@@ -236,9 +236,15 @@ ghc_setup_cflags() {
                append-ghc-cflags link ${flag}
        done
 
-       # hardened-gcc needs to be disabled, because the mangler doesn't accept
-       # its output.
+       # hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
+       # are not built with fPIC, bug #606666
        gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
+       tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
+               # gcc-6.3 has support for -no-pie upstream, but spelling differs from
+               # gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
+               # hardened users try '-pie' in USE=ghcbootstrap mode.
+               append-ghc-cflags persistent compile link -no-pie
+       fi
        gcc-specs-ssp && append-ghc-cflags persistent compile      -fno-stack-protector
 
        # prevent from failind building unregisterised ghc: