arch/arm64/Makefile.mk: Unset toolchain vars for BL31
commit7e3cabec513e9dddfcd723b5c2adddeb1efdabaf
authorYidi Lin <yidilin@chromium.org>
Sat, 4 May 2024 09:18:44 +0000 (4 17:18 +0800)
committerYu-Ping Wu <yupingso@google.com>
Thu, 9 May 2024 08:32:49 +0000 (9 08:32 +0000)
tree4ad724ea7121c055d31608d01e808178bfc74198
parenta29d06a9521791ac6608604352df23ea253cdf19
arch/arm64/Makefile.mk: Unset toolchain vars for BL31

This change is for upcoming arm-trusted uprev commit.

TF-A refactors the toolchain detection in [1][2]. After that `AR`,
`CC`, `LD` and other toolchain variables have precedence over
`CROSS_COMPILE`.

Since ChromeOS build system also sets those toolchain variables when
building coreboot, it results that TF-A uses CrOS GCC instead of
coreboot SDK. It needs to unset those variables in order to make
`CROSS_COMPILE` effective.

TF-A upstream changes the default linker from BFD to GCC in [3].
Therefore, temporarily overriding LD as $(LD_arm64} to fix the below
build error.

aarch64-elf-gcc: error: unrecognized command-line option '--emit-relocs'

In addition, TF-A wrapped LD with single quotes to solve Windows path
issue[4]. On MT8173 platform, `--fix-cortex-a53-843419` is appended to
$(LD_arm64} for ERRATA_A53_843419. It results in the below build error.

/bin/sh: 1: --fix-cortex-a53-843419: not found

Since `--fix-cortex-a53-843419` is never passed to TF-A, simply extract
the LD command from $(LD_arm64) by $(word 1, $(LD_arm64)).

[1]: https://review.trustedfirmware.org/c/24921
[2]: https://review.trustedfirmware.org/c/25333
[3]: https://review.trustedfirmware.org/c/26703
[4]: https://review.trustedfirmware.org/c/26737

BUG=b:338420310
TEST=emerge-geralt coreboot
TEST=./util/abuild/abuild -t google/geralt -b geralt -a -x
TEST=./util/abuild/abuild -t google/oak -b elm -a -x
TEST=./util/abuild/abuild -t google/cherry -x -a

Change-Id: Ieac9f96e81e574b87e20cd2df335c36abcb8bb5c
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82187
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Eric Lai <ericllai@google.com>
src/arch/arm64/Makefile.mk