diff options
author | Sam James <sam@gentoo.org> | 2024-03-24 17:19:46 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-03-24 17:47:08 +0000 |
commit | e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf (patch) | |
tree | c96135adb6ff7e8c7ab1ea2adb3d1415be3679d9 /eclass | |
parent | mail-client/thunderbird: handle "-z,pack-relative-relocs" like in ff (diff) | |
download | gentoo-e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf.tar.gz gentoo-e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf.tar.bz2 gentoo-e897f91e8e81b8168e7045db2f6d8dd9ebdb9ddf.zip |
toolchain.eclass: abort if hybrid CPU detected w/ -march=native
Unfortunately, the previous approach can't work. --param doesn't fully
wipe out the previous value added by -march=native, so we still get a failed
comparison.
Users hitting this should install app-misc/resolve-march-native, run
resolve-march-native, and use that in their *FLAGS instead of -march=native -
at least for sys-devel/gcc via package.env, if not in make.conf.
Therefore, our only real option is to just abort when we detect a problematic
situation and tell users what to do.
The only other idea I had was to try taskset in src_compile which feels super
brittle and not sure it'd even work at all.
Thanks to Andrei for testing and debugging with us on IRC & the bug.
Bug: https://bugs.gentoo.org/904426
Bug: https://bugs.gentoo.org/908523
Bug: https://bugs.gentoo.org/915389
Bug: https://bugs.gentoo.org/927688
Thanks-to: Andrei Liavonchykau <andreil499@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/toolchain.eclass | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 01fbd62dc12c..6a515f9b5c69 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1619,9 +1619,16 @@ gcc_do_filter_flags() { [[ -n ${l1_cache_size} && ${l1_cache_size} =~ ^[0-9]+$ ]] || break l1_cache_sizes[${l1_cache_size}]=1 done - # If any of them are different, just pick the first one. + # If any of them are different, abort. We can't just pass one value of + # l1-cache-size because it doesn't cancel out the -march=native one. if [[ ${#l1_cache_sizes[@]} -gt 1 ]] ; then - append-flags --param=l1-cache-size=${l1_cache_size} + eerror "Different values of l1-cache-size detected!" + eerror "GCC will fail to bootstrap when comparing files with these flags." + eerror "This CPU is likely big.little/hybrid hardware with power/efficiency cores." + eerror "Please install app-misc/resolve-march-native and run 'resolve-march-native'" + eerror "to find a safe value of CFLAGS for this CPU. Note that this may vary" + eerror "depending on the core it ran on. taskset can be used to fix the cores used." + die "Varying l1-cache-size found, aborting (bug #915389, gcc PR#111768)" fi fi |