diff options
author | Simon McVittie <smcv@debian.org> | 2023-08-05 11:34:29 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-08-06 02:32:25 -0400 |
commit | b95ebf80b85fc8ed3ba2cf828d7b96f95894a29b (patch) | |
tree | 33c66b5ca596c47f87965494bfd33f359f34530f | |
parent | 2cf79c5062f553382b641f4ac8be897d532902aa (diff) | |
download | meson-b95ebf80b85fc8ed3ba2cf828d7b96f95894a29b.zip meson-b95ebf80b85fc8ed3ba2cf828d7b96f95894a29b.tar.gz meson-b95ebf80b85fc8ed3ba2cf828d7b96f95894a29b.tar.bz2 |
environment: Don't override mips64 to mips if no compilers are available
If we have a build- or host-architecture compiler, we can detect mips64
vs. mips by the fact that mips64 compilers define __mips64. However,
machine_info_can_run() doesn't provide any compilers, because it is
interested in the architecture of the underlying kernel. If we don't
return mips64 when running on a mips64 kernel, machine_info_can_run()
will wrongly say that we can't run mips64 binaries.
If we're running a complete 32-bit mips user-space on a mips64 kernel,
it's OK to return mips64 in the absence of any compilers, as a result
of the previous commit "environment: Assume that mips64 can run 32-bit
mips binaries".
Resolves: https://github.com/mesonbuild/meson/issues/12017
Bug-Debian: https://bugs.debian.org/1041499
Fixes: 6def03c7 "detect_cpu: Fix mips32 detection on mips64"
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r-- | mesonbuild/environment.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 836963e..ab6f56c 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -343,7 +343,7 @@ def detect_cpu_family(compilers: CompilersDict) -> str: # MIPS64 is able to run MIPS32 code natively, so there is a chance that # such mixture mentioned above exists. elif trial == 'mips64': - if not any_compiler_has_define(compilers, '__mips64'): + if compilers and not any_compiler_has_define(compilers, '__mips64'): trial = 'mips' if trial not in known_cpu_families: @@ -383,7 +383,7 @@ def detect_cpu(compilers: CompilersDict) -> str: if '64' not in trial: trial = 'mips' else: - if not any_compiler_has_define(compilers, '__mips64'): + if compilers and not any_compiler_has_define(compilers, '__mips64'): trial = 'mips' else: trial = 'mips64' |