summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-03-23 20:18:16 +0000
committerSam James <sam@gentoo.org>2024-03-23 20:18:16 +0000
commit52fa9d334e23327ba08139f8617d3ae16adff64e (patch)
tree6bcaf14f9486f5e61917cd098b831d355b3f6a55
parentsys-apps/coreutils: backport test fixes to 9.4 (diff)
downloadgentoo-52fa9d33.tar.gz
gentoo-52fa9d33.tar.bz2
gentoo-52fa9d33.zip
toolchain.eclass: fortify hybrid workaround
* Make sure the result is non-empty before trying to use it as an index * Make sure the result is an integer before trying to use it as an index * Don't try to set --param ... if we had no result at all These are good ideas anyway but they happen with gnat-gpl as apparently older GCC didn't actually have the l1-cache-size thing (I thought it was a bit older than 10). Whatever. Closes: https://bugs.gentoo.org/927646 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--eclass/toolchain.eclass3
1 files changed, 2 insertions, 1 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 331e107bacf3..03e6a5d987d1 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1616,10 +1616,11 @@ gcc_do_filter_flags() {
[[ -z ${x} || ${x} -gt 64 ]] && break
l1_cache_size=$(taskset --cpu-list ${x} $(tc-getCC) -Q --help=params -O2 -march=native \
| awk '{ if ($1 ~ /^.*param.*l1-cache-size/) print $2; }' || die)
+ [[ -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 [[ ${#l1_cache_sizes} != 1 ]] ; then
+ if [[ ${#l1_cache_sizes} -gt 1 ]] ; then
append-flags --param=l1-cache-size=${l1_cache_size}
fi
fi