Skip to content

Commit 3d099df

Browse files
committed
compilers/detect: Update the build machine information for ASM
The ASM compilers need the machine information to be up to date before they're initialized. Which is a reasonable thing as they use the c linker information. This was done by creating a unique MachineInfo. That code was dropped when the compilers were refactored to use the Environment instead of a separate MachineInfo. This patch is honestly not what I'd hope for, but it's minimal for application to the stable branch. This should be followed up by more cleanups, but that will involve more work. Fixes: #15361
1 parent 1b8b2e8 commit 3d099df

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mesonbuild/compilers/detect.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,9 @@ def detect_nasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
13281328
compilers, _ = _get_compilers(env, 'nasm', for_machine, allow_build_machine=True)
13291329

13301330
# We need a C compiler to properly detect the machine info and linker
1331-
13321331
cc = detect_c_compiler(env, for_machine)
1332+
if not (env.build_machines_are_exact or env.is_cross_build(for_machine)):
1333+
env.update_build_machine({'c': cc})
13331334

13341335
popen_exceptions: T.Dict[str, Exception] = {}
13351336
for comp in compilers:
@@ -1369,10 +1370,10 @@ def detect_nasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
13691370
def detect_masm_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
13701371
# We need a C compiler to properly detect the machine info and linker
13711372
cc = detect_c_compiler(env, for_machine)
1372-
if not env.is_cross_build(for_machine):
1373-
info = detect_machine_info({'c': cc})
1374-
else:
1375-
info = env.machines[for_machine]
1373+
if not (env.build_machines_are_exact or env.is_cross_build(for_machine)):
1374+
env.update_build_machine({'c': cc})
1375+
1376+
info = env.machines[for_machine]
13761377

13771378
from .asm import MasmCompiler, MasmARMCompiler
13781379
comp_class: T.Type[ASMCompiler]
@@ -1412,6 +1413,8 @@ def detect_linearasm_compiler(env: Environment, for_machine: MachineChoice) -> C
14121413
comp_class: T.Type[ASMCompiler] = TILinearAsmCompiler
14131414
arg = '-h'
14141415
cc = detect_c_compiler(env, for_machine)
1416+
if not (env.build_machines_are_exact or env.is_cross_build(for_machine)):
1417+
env.update_build_machine({'c': cc})
14151418

14161419
popen_exceptions: T.Dict[str, Exception] = {}
14171420
try:

0 commit comments

Comments
 (0)