Skip to content

Commit b64a093

Browse files
smcvmatoro
authored andcommitted
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: mesonbuild#12017 Bug-Debian: https://bugs.debian.org/1041499 Fixes: 6def03c "detect_cpu: Fix mips32 detection on mips64" Signed-off-by: Simon McVittie <[email protected]>
1 parent 4096637 commit b64a093

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mesonbuild/environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
343343
# MIPS64 is able to run MIPS32 code natively, so there is a chance that
344344
# such mixture mentioned above exists.
345345
elif trial == 'mips64':
346-
if not any_compiler_has_define(compilers, '__mips64'):
346+
if compilers and not any_compiler_has_define(compilers, '__mips64'):
347347
trial = 'mips'
348348

349349
if trial not in known_cpu_families:
@@ -383,7 +383,7 @@ def detect_cpu(compilers: CompilersDict) -> str:
383383
if '64' not in trial:
384384
trial = 'mips'
385385
else:
386-
if not any_compiler_has_define(compilers, '__mips64'):
386+
if compilers and not any_compiler_has_define(compilers, '__mips64'):
387387
trial = 'mips'
388388
else:
389389
trial = 'mips64'

0 commit comments

Comments
 (0)