summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>2020-05-26 22:50:17 +0000
committerOtavio Salvador <otavio@ossystems.com.br>2020-05-26 20:15:39 -0300
commit6cbfb85c6e052032a420b0e6ea1b1c45aac2f872 (patch)
treef5294a85a2e47ee4955b9e84ac00b331a3d3112f
parentb8d7aec6bcaa37229794ee96afe51f9e3c198435 (diff)
downloadmeta-freescale-6cbfb85c6e052032a420b0e6ea1b1c45aac2f872.tar.gz
optee-os: fix gcc10 build for imx fork
OP-TEE OS component fails to build on gcc10 due to missing __getauxval function. This can be resolved via disabling of outline-atomics feature in gcc10. Backport upstream patch [1] with adaptions to optee-imx version. Original patch uses $(call cc-option,-mno-outline-atomics,) to disable outline-atomics which itself is broken and required 4 additional patches to be compatible with gcc and clang. This is resolved in the upstream PR [2], which is applicable to the latest upstream version. NXP fork contains old version of OP-TEE, and therefore would receive the update for Makefiles with new version. Since it is not required to make current NXP version compatible with old compiler versions on master branch - outline-atomics are disabled directly. [1]: https://github.com/OP-TEE/optee_os/pull/3891/commits/e07c2b062846df4385542f4e4fe08b40cf7d8191 [2]: https://github.com/OP-TEE/optee_os/pull/3891 Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
-rw-r--r--recipes-security/optee-imx/optee-os/0001-arm64-Disable-outline-atomics-when-compiling.patch64
-rw-r--r--recipes-security/optee-imx/optee-os_3.2.0.imx.bb1
2 files changed, 65 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-os/0001-arm64-Disable-outline-atomics-when-compiling.patch b/recipes-security/optee-imx/optee-os/0001-arm64-Disable-outline-atomics-when-compiling.patch
new file mode 100644
index 00000000..605daccc
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os/0001-arm64-Disable-outline-atomics-when-compiling.patch
@@ -0,0 +1,64 @@
1From ef5327d7e9d74a433b0a1f2ca2f4cf3953797350 Mon Sep 17 00:00:00 2001
2From: Andrey Zhizhikin <andrey.z@gmail.com>
3Date: Fri, 22 May 2020 21:01:15 +0000
4Subject: [PATCH] arm64: Disable outline-atomics when compiling
5
6This is a backport of upstream patch [1] with adaptions to optee-imx
7version in this layer.
8
9Original patch uses $(call cc-option,-mno-outline-atomics,) to disable
10outline-atomics which itself is broken and required 4 additional patches
11to be compatible with gcc and clang.
12
13This is resolved in the upstream PR [2], which is applicable to the
14latest upstream version.
15
16NXP fork contains old version of OP-TEE, and therefore would receive the
17update for Makefiles with new version. Since it is not required to make
18current NXP version compatible with old compiler versions on master
19branch - outline-atomics are disabled directly.
20
21Original patch description:
22---------------------------------------------------------------------
23Disables the automatic detection of LSE (Large System Extension)
24instructions when compiling AArch64 code. GCC 10 implements this
25detection in libgcc using __getauxval(), which optee doesn't implement.
26This requires that the proper -mcpu is passed to GCC so that the code
27can be correctly compiled to use either LSE or load-store-exclusive.
28
29Fixes linker errors like the following when compiling with GCC 10:
30
31 aarch64-linux-ld.bfd: libgcc.a(lse-init.o):
32 in function `init_have_lse_atomics':
33 lse-init.c:44: undefined reference to `__getauxval'
34 core/arch/arm/kernel/link.mk:38:
35 recipe for target 'build/core/all_objs.o' failed
36---------------------------------------------------------------------
37
38Upstream-Status: Backport [e07c2b062846df4385542f4e4fe08b40cf7d8191]
39
40Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
41
42[1]: https://github.com/OP-TEE/optee_os/pull/3891/commits/e07c2b062846df4385542f4e4fe08b40cf7d8191
43[2]: https://github.com/OP-TEE/optee_os/pull/3891
44Signed-off-by: Andrey Zhizhikin <andrey.z@gmail.com>
45---
46 core/arch/arm/arm.mk | 2 +-
47 1 file changed, 1 insertion(+), 1 deletion(-)
48
49diff --git a/core/arch/arm/arm.mk b/core/arch/arm/arm.mk
50index aa101be8..8cb2b2e2 100644
51--- a/core/arch/arm/arm.mk
52+++ b/core/arch/arm/arm.mk
53@@ -88,7 +88,7 @@ arm32-platform-aflags-no-hard-float ?=
54
55 arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only
56 arm64-platform-cflags-hard-float ?=
57-arm64-platform-cflags-generic ?= -mstrict-align
58+arm64-platform-cflags-generic ?= -mstrict-align -mno-outline-atomics
59
60 ifeq ($(DEBUG),1)
61 # For backwards compatibility
62--
632.17.1
64
diff --git a/recipes-security/optee-imx/optee-os_3.2.0.imx.bb b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb
index 06563a18..aeaa9b32 100644
--- a/recipes-security/optee-imx/optee-os_3.2.0.imx.bb
+++ b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb
@@ -14,6 +14,7 @@ OPTEE_OS_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-os.git;proto
14SRC_URI = "\ 14SRC_URI = "\
15 ${OPTEE_OS_SRC};branch=${SRCBRANCH} \ 15 ${OPTEE_OS_SRC};branch=${SRCBRANCH} \
16 file://0001-scripts-update-scripts-to-use-python3.patch \ 16 file://0001-scripts-update-scripts-to-use-python3.patch \
17 file://0001-arm64-Disable-outline-atomics-when-compiling.patch \
17" 18"
18 19
19SRCREV = "6d99b525af752ecdaabdca6098b2564b2665f2b2" 20SRCREV = "6d99b525af752ecdaabdca6098b2564b2665f2b2"