arm-trusted-firmware/make_helpers
Ahmad Fatoum b9014f858d feat(build): redirect stdin to nul during toolchain detection
It's common for Makefiles to use variables like CC, AS or LD instead of
hardcoding the name of binaries. These can be defined by the user to
use a differnet toolchain or even as a crutch to enable cross-compilation.

In TF-A, this is not needed, as support for cross-compilation is baked
in via the CROSS_COMPILE option. TF-A still defined AS for its internal
use, but unlike most other projects, the default was setting it to the C
compiler. Overriding it wasn't possible from the environment though,
only as a make argument, so this didn't cause much issue.

With commit cc277de816 ("build: refactor toolchain detection"), AS can
now also be set from the environment. This breaks any scripts that
supply make with a cross environment that sets AS to an assembler.

Doing so was without effect before, but now leads to a quite ugly failure
mode: As TF-A now tries to detect the toolchain, it will call AS with the
option -v, which for GNU as(1) prints the version, but doesn't exit.

Thus, as(1) will continue waiting on stdin input and the build hangs
without much indication what's wrong.

Avoid this failure mode by ensuring any tool that attempts to read stdin
during toolchain detection will immediately get EOF and exit, leading to
an error message later on instead of the build hang.

Change-Id: I79a84961f5a69250292caa7f9e879a65be4bd9f2
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-09 12:17:02 +02:00
..
tbbr fix(tbbr): unrecognised 'tos-fw-key-cert' option 2023-09-07 11:14:52 +01:00
toolchains build: use GCC to link by default 2024-04-02 09:52:17 +00:00
arch_features.mk refactor(mte): remove mte, mte_perm 2024-03-26 14:30:58 -05:00
armv7-a-cpus.mk refactor(build): merge march32/64 directives 2023-06-22 16:37:03 -05:00
build_env.mk build: refactor toolchain detection 2024-02-06 11:14:52 +00:00
build_macros.mk build: use toolchain identifiers in conditions 2024-02-06 11:14:52 +00:00
cygwin.mk Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
defaults.mk feat(tc): add DPE backend to the measured boot framework 2024-03-06 16:55:08 +01:00
march.mk build: use toolchain identifiers in conditions 2024-02-06 11:14:52 +00:00
msys.mk Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
plat_helpers.mk Change PLATFORM_ROOT to TF_PLATFORM_ROOT 2018-03-05 14:18:04 +08:00
toolchain.mk feat(build): redirect stdin to nul during toolchain detection 2024-04-09 12:17:02 +02:00
unix.mk build: refactor toolchain detection 2024-02-06 11:14:52 +00:00
windows.mk build: use new toolchain variables for tools 2024-02-06 11:14:52 +00:00