]> code.ossystems Code Review - meta-freescale.git/commitdiff
imx-atf: enable clang support 933/head
authorAndrey Zhizhikin <andrey.z@gmail.com>
Fri, 3 Dec 2021 10:11:02 +0000 (10:11 +0000)
committerAndrey Zhizhikin <andrey.z@gmail.com>
Fri, 3 Dec 2021 10:11:02 +0000 (10:11 +0000)
This is a port of commit 5013182 ("trusted-firmware-a: enable clang
support") from meta-arm [1]:

The CC and LD parameters are used to point make to the currently
used compiler and linkers.

This change enables TFA to be compiled successfully when
TOOLCHAIN=clang.

Signed-off-by: Andrey Zhizhikin <andrey.z@gmail.com>
Link: [1]: https://github.com/jonmason/meta-arm/commit/5013182ddaf7fabc3cc87ba6c923abb7f68214f5

recipes-bsp/imx-atf/imx-atf_2.4.bb

index 8792c0cdc4bd544a0b152266ed4bc8a288901e77..ce30822e4cee008c79fe737be87299fe7ef338b7 100644 (file)
@@ -36,6 +36,17 @@ DEPENDS:remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
 
 BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}"
 
+# CC and LD introduce arguments which conflict with those otherwise provided by
+# this recipe. The heads of these variables excluding those arguments
+# are therefore used instead.
+def remove_options_tail (in_string):
+    from itertools import takewhile
+    return ' '.join(takewhile(lambda x: not x.startswith('-'), in_string.split(' ')))
+
+EXTRA_OEMAKE += "LD=${@remove_options_tail(d.getVar('LD'))}"
+
+EXTRA_OEMAKE += "CC=${@remove_options_tail(d.getVar('CC'))}"
+
 do_compile() {
     # Clear LDFLAGS to avoid the option -Wl recognize issue
     oe_runmake bl31