toolchain.eclass: Add -no-pie to stage1 LDFLAGS when building <gcc-6 with >=gcc6...
authorMagnus Granberg <zorry@gentoo.org>
Sat, 18 Nov 2017 17:16:48 +0000 (18:16 +0100)
committerAndreas K. Hüttel <dilfridge@gentoo.org>
Sat, 18 Nov 2017 19:19:08 +0000 (20:19 +0100)
Closes: https://bugs.gentoo.org/618908

eclass/toolchain.eclass

index 9dca44439c9d00551dfd98a1d24395fa00d67089..503f7dbe94ff0e5b35a93d44739e1a3ddded5233 100644 (file)
@@ -641,6 +641,14 @@ do_gcc_PIE_patches() {
 make_gcc_hard() {
 
        local gcc_hard_flags=""
+
+       # If we use gcc-6 or newer with pie enable to compile older gcc we need to pass -no-pie
+       # to stage1; bug 618908
+       if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
+               einfo "Disabling PIE in stage1 (only) ..."
+               sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
+       fi
+
        # Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
        if tc_version_is_at_least 6.0 ; then
                if use pie ; then