For gcc-6 and newer the old logic in the toolchain-glibc eclass:
if use hardened && gcc-specs-pie ; then
append-cppflags -DPIC
else
filter-flags -fPIE
fi
is obsolete. Simply disable the check.
---
eclass/toolchain-glibc.eclass | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index 270c9cdac7..32c1307c3a 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -266,15 +266,21 @@ setup_flags() {
tc-enables-ssp && append-flags $(test-flags
-fno-stack-protector)
fi
- if use hardened && tc-enables-pie ; then
- # Force PIC macro definition for all compilations since they're
all
- # either -fPIC or -fPIE with the default-PIE compiler.
- append-cppflags -DPIC
- else
- # Don't build -fPIE without the default-PIE compiler and the
- # hardened-pie patch
- filter-flags -fPIE
- fi
+ if [[ $(gcc-major-version) -lt 6 ]]; then
+ # Starting with gcc-6 (and fully upstreamed pie patches) we
control
+ # default enabled/disabled pie via use flags. So nothing to do
+ # here. #618160
+
+ if use hardened && tc-enables-pie ; then
+ # Force PIC macro definition for all compilations since
they're all
+ # either -fPIC or -fPIE with the default-PIE compiler.
+ append-cppflags -DPIC
+ else
+ # Don't build -fPIE without the default-PIE compiler
and the
+ # hardened-pie patch
+ filter-flags -fPIE
+ fi
+ fi
}
want_nptl() {
--
2.13.0