diff options
author | Repository mirror & CI <repomirrorci@gentoo.org> | 2023-08-18 01:47:38 +0000 |
---|---|---|
committer | Repository mirror & CI <repomirrorci@gentoo.org> | 2023-08-18 01:47:38 +0000 |
commit | 28c4c3f08752de4f5abeba08032c29aa9d90103d (patch) | |
tree | 460eff65e826b0d42efdbcd2523ee2480d4c4da7 | |
parent | 2023-08-18 01:31:37 UTC (diff) | |
parent | flag-o-matic.eclass: handle C++ assertions and FORTIFY_SOURCE in _filter-hard... (diff) | |
download | gentoo-28c4c3f08752de4f5abeba08032c29aa9d90103d.tar.gz gentoo-28c4c3f08752de4f5abeba08032c29aa9d90103d.tar.bz2 gentoo-28c4c3f08752de4f5abeba08032c29aa9d90103d.zip |
Merge updates from master
-rw-r--r-- | eclass/flag-o-matic.eclass | 38 | ||||
-rw-r--r-- | eclass/toolchain-funcs.eclass | 4 | ||||
-rw-r--r-- | eclass/toolchain.eclass | 1 |
3 files changed, 34 insertions, 9 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 0558e639b981..b4c27bf89d92 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -147,7 +147,10 @@ _filter-hardened() { # not -fPIC or -fpic, but too many places filter -fPIC without # thinking about -fPIE. -fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie) - gcc-specs-pie || continue + if ! gcc-specs-pie && ! tc-enables-pie ; then + continue + fi + if ! is-flagq -nopie && ! is-flagq -no-pie ; then # Support older Gentoo form first (-nopie) before falling # back to the official gcc-6+ form (-no-pie). @@ -158,15 +161,36 @@ _filter-hardened() { fi fi ;; - -fstack-protector) - gcc-specs-ssp || continue - is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector);; + + -fstack-protector|-fstack-protector-strong) + if ! gcc-specs-ssp && ! tc-enables-ssp && ! tc-enables-ssp-strong ; then + continue + fi + + is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector) + ;; -fstack-protector-all) - gcc-specs-ssp-to-all || continue - is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all);; + if ! gcc-specs-ssp-to-all && ! tc-enables-ssp-all ; then + continue + fi + + is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all) + ;; -fno-strict-overflow) gcc-specs-nostrict || continue - is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow);; + + is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow) + ;; + -D_GLIBCXX_ASSERTIONS|-D_LIBCPP_ENABLE_ASSERTIONS|-D_LIBCPP_ENABLE_HARDENED_MODE) + tc-enables-cxx-assertions || continue + + append-cppflags -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -U_LIBCPP_ENABLE_HARDENED_MODE + ;; + -D_FORTIFY_SOURCE=*) + tc-enables-fortify-source || continue + + append-cppflags -U_FORTIFY_SOURCE + ;; esac done } diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index e28f6148ddc1..556bbac35307 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -963,9 +963,9 @@ gcc-specs-stack-check() { # @DESCRIPTION: # Return truth if the current compiler enables assertions in the C++ standard # library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++, -# this is -D_LIBCPP_ENABLE_ASSERTIONS. +# this is -D_LIBCPP_ENABLE_ASSERTIONS (deprecated) or -D_LIBCPP_ENABLE_HARDENED_MODE. tc-enables-cxx-assertions() { - tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS)" ${CPPFLAGS} ${CXXFLAGS} + tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS) || defined(_LIBCPP_ENABLE_HARDENED_MODE)" ${CPPFLAGS} ${CXXFLAGS} } # @FUNCTION: tc-enables-pie diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 9f626c5bfc77..6a88676b750d 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1395,6 +1395,7 @@ downgrade_arch_flags() { # "added" "arch" "replacement" local archlist=( + 12.3 znver4 znver3 10 znver3 znver2 9 znver2 znver1 4.9 bdver4 bdver3 |