--- a/eclass/toolchain.eclass 2017-11-16 00:39:18.920957992 +0100 +++ b/eclass/toolchain.eclass 2017-11-17 02:44:45.081607713 +0100 @@ -641,6 +641,12 @@ 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-5 we need to pass -no-pie + # to stage1 #618908 + if tc_version_is_at_least 5.0 && [[ gcc-major-version -lt 6 ]] ; then + 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