commit:     94cfc2abd5924cc71314e28fb9f26e147ed9659e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  3 00:58:00 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan  3 00:58:41 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94cfc2ab

toolchain.eclass: move Clang CET hack earlier to influence 
tc_enable_hardened_gcc

Otherwise, we may still set -DEXTRA_OPTIONS_CF.

Bug: https://bugs.gentoo.org/933772
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6dc139bd1a02..85b5a2b23392 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -688,6 +688,11 @@ toolchain_src_prepare() {
 
        eapply_user
 
+       # Workaround -march=native not working for stage1 with non-GCC (bug 
#933772).
+       if ! tc-is-gcc && [[ "${CFLAGS}${CXXFLAGS}" == *-march=native* ]] ; then
+               CLANG_DISABLE_CET_HACK=1
+       fi
+
        if ! use vanilla ; then
                tc_enable_hardened_gcc
        fi
@@ -1178,11 +1183,6 @@ toolchain_src_configure() {
                export ac_cv_std_swap_in_utility=no
        fi
 
-       # Workaround -march=native not working for stage1 with non-GCC (bug 
#933772).
-       if ! tc-is-gcc && [[ "${CFLAGS}${CXXFLAGS}" == *-march=native* ]] ; then
-               CLANG_DISABLE_CET_HACK=1
-       fi
-
        local flag
        for flag in $(all-flag-vars) ; do
                einfo "${flag}=\"${!flag}\""

Reply via email to