summaryrefslogtreecommitdiffstats
path: root/recipes-security/optee
diff options
context:
space:
mode:
authorTing Liu <ting.liu@nxp.com>2020-09-09 14:18:56 +0530
committerOtavio Salvador <otavio@ossystems.com.br>2020-09-09 08:54:34 -0300
commitc1a7c93e4ea608427cc9d63956725ab99ac05434 (patch)
treeaad4c9015b6877486ab656ff590eab0f05ff9a74 /recipes-security/optee
parent902fad9d4ec801d53b09c0010c0c8dea0cc22045 (diff)
downloadmeta-freescale-c1a7c93e4ea608427cc9d63956725ab99ac05434.tar.gz
optee-os: backport to fix gcc10 compilation issue
Signed-off-by: Ting Liu <ting.liu@nxp.com>
Diffstat (limited to 'recipes-security/optee')
-rw-r--r--recipes-security/optee/optee-os-qoriq/0001-optee-os-fix-gcc10-compilation-issue-and-missing-cc-.patch161
-rw-r--r--recipes-security/optee/optee-os-qoriq_git.bb1
2 files changed, 162 insertions, 0 deletions
diff --git a/recipes-security/optee/optee-os-qoriq/0001-optee-os-fix-gcc10-compilation-issue-and-missing-cc-.patch b/recipes-security/optee/optee-os-qoriq/0001-optee-os-fix-gcc10-compilation-issue-and-missing-cc-.patch
new file mode 100644
index 00000000..f9c71d0d
--- /dev/null
+++ b/recipes-security/optee/optee-os-qoriq/0001-optee-os-fix-gcc10-compilation-issue-and-missing-cc-.patch
@@ -0,0 +1,161 @@
1From 027a3b9a33fbb23e1d1d7ed6411d4d112d2a55a1 Mon Sep 17 00:00:00 2001
2From: Andrey Zhizhikin <andrey.z@gmail.com>
3Date: Sat, 30 May 2020 22:00:59 +0000
4Subject: [PATCH] optee-os: fix gcc10 compilation issue and missing cc-options
5
6Backport PR 3891 from upstream to imx fork, which addressed compilation
7failure when GCC10 is used.
8
9Additional changes ported fixed cc-options macro, which allows to query
10compiler used if the desired option exists before it could be set. This
11solves also the build issues when GCC9 is used to build this component.
12
13Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/3891]
14
15Signed-off-by: Andrey Zhizhikin <andrey.z@gmail.com>
16---
17 core/arch/arm/arm.mk | 21 ++++++++++++++++-----
18 core/core.mk | 5 +----
19 mk/cc-option.mk | 9 +++++++++
20 mk/gcc.mk | 2 +-
21 ta/mk/ta_dev_kit.mk | 3 +++
22 ta/ta.mk | 1 +
23 6 files changed, 31 insertions(+), 10 deletions(-)
24 create mode 100644 mk/cc-option.mk
25
26diff --git a/core/arch/arm/arm.mk b/core/arch/arm/arm.mk
27index 0a95b1ec..bfcbe896 100644
28--- a/core/arch/arm/arm.mk
29+++ b/core/arch/arm/arm.mk
30@@ -1,3 +1,16 @@
31+# Setup compiler for the core module
32+ifeq ($(CFG_ARM64_core),y)
33+arch-bits-core := 64
34+else
35+arch-bits-core := 32
36+endif
37+CROSS_COMPILE_core := $(CROSS_COMPILE$(arch-bits-core))
38+COMPILER_core := $(COMPILER)
39+include mk/$(COMPILER_core).mk
40+
41+# Defines the cc-option macro using the compiler set for the core module
42+include mk/cc-option.mk
43+
44 CFG_LTC_OPTEE_THREAD ?= y
45 # Size of emulated TrustZone protected SRAM, 448 kB.
46 # Only applicable when paging is enabled.
47@@ -95,7 +108,7 @@ arm32-platform-aflags-no-hard-float ?=
48
49 arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only
50 arm64-platform-cflags-hard-float ?=
51-arm64-platform-cflags-generic ?= -mstrict-align
52+arm64-platform-cflags-generic := -mstrict-align $(call cc-option,-mno-outline-atomics,)
53
54 ifeq ($(DEBUG),1)
55 # For backwards compatibility
56@@ -124,14 +137,12 @@ core-platform-aflags += $(platform-aflags-generic)
57 core-platform-aflags += $(platform-aflags-debug-info)
58
59 ifeq ($(CFG_ARM64_core),y)
60-arch-bits-core := 64
61 core-platform-cppflags += $(arm64-platform-cppflags)
62 core-platform-cflags += $(arm64-platform-cflags)
63 core-platform-cflags += $(arm64-platform-cflags-generic)
64 core-platform-cflags += $(arm64-platform-cflags-no-hard-float)
65 core-platform-aflags += $(arm64-platform-aflags)
66 else
67-arch-bits-core := 32
68 core-platform-cppflags += $(arm32-platform-cppflags)
69 core-platform-cflags += $(arm32-platform-cflags)
70 core-platform-cflags += $(arm32-platform-cflags-no-hard-float)
71@@ -217,8 +228,8 @@ ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE64 ?= $$(CROSS_COMPILE)_nl_
72 ta-mk-file-export-add-ta_arm64 += CROSS_COMPILE_ta_arm64 ?= $$(CROSS_COMPILE64)_nl_
73 endif
74
75-# Set cross compiler prefix for each submodule
76-$(foreach sm, core $(ta-targets), $(eval CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE$(arch-bits-$(sm)))))
77+# Set cross compiler prefix for each TA target
78+$(foreach sm, $(ta-targets), $(eval CROSS_COMPILE_$(sm) ?= $(CROSS_COMPILE$(arch-bits-$(sm)))))
79
80 arm32-sysreg-txt = core/arch/arm/kernel/arm32_sysreg.txt
81 arm32-sysregs-$(arm32-sysreg-txt)-h := arm32_sysreg.h
82diff --git a/core/core.mk b/core/core.mk
83index 37906792..4eec217a 100644
84--- a/core/core.mk
85+++ b/core/core.mk
86@@ -8,6 +8,7 @@ arch-dir := core/arch/$(ARCH)
87 platform-dir := $(arch-dir)/plat-$(PLATFORM)
88 include $(platform-dir)/conf.mk
89 include mk/config.mk
90+# $(ARCH).mk also sets the compiler for the core module
91 include core/arch/$(ARCH)/$(ARCH).mk
92
93 PLATFORM_$(PLATFORM) := y
94@@ -16,10 +17,6 @@ PLATFORM_FLAVOR_$(PLATFORM_FLAVOR) := y
95 $(call cfg-depends-all,CFG_PAGED_USER_TA,CFG_WITH_PAGER CFG_WITH_USER_TA)
96 include core/crypto.mk
97
98-# Setup compiler for this sub module
99-COMPILER_$(sm) ?= $(COMPILER)
100-include mk/$(COMPILER_$(sm)).mk
101-
102 cppflags$(sm) += -D__KERNEL__
103
104 cppflags$(sm) += -Icore/include
105diff --git a/mk/cc-option.mk b/mk/cc-option.mk
106new file mode 100644
107index 00000000..4699fbcc
108--- /dev/null
109+++ b/mk/cc-option.mk
110@@ -0,0 +1,9 @@
111+_cc-option-supported = $(if $(shell $(CC$(sm)) $(1) -c -x c /dev/null -o /dev/null 2>/dev/null >/dev/null || echo "Not supported"),,1)
112+_cc-opt-cached-var-name = $(subst =,~,$(strip cached-cc-option-$(1)-$(subst $(empty) $(empty),,$(CC$(sm)))))
113+define _cc-option
114+$(eval _var_name := $(call _cc-opt-cached-var-name,$(1)))
115+$(eval $(_var_name) := $(if $(filter $(origin $(_var_name)),undefined),$(call _cc-option-supported,$(1)),$($(_var_name))))
116+$(if $($(_var_name)),$(1),$(2))
117+endef
118+cc-option = $(strip $(call _cc-option,$(1),$(2)))
119+
120diff --git a/mk/gcc.mk b/mk/gcc.mk
121index c516c731..330b200a 100644
122--- a/mk/gcc.mk
123+++ b/mk/gcc.mk
124@@ -12,7 +12,7 @@ nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \
125 -print-file-name=include 2> /dev/null)
126
127 # Get location of libgcc from gcc
128-libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) $(comp-cflags$(sm)) \
129+libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
130 -print-libgcc-file-name 2> /dev/null)
131
132 # Define these to something to discover accidental use
133diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk
134index 8473c6df..40e77c3e 100644
135--- a/ta/mk/ta_dev_kit.mk
136+++ b/ta/mk/ta_dev_kit.mk
137@@ -86,6 +86,9 @@ clean:
138 @$(cmd-echo-silent) ' CLEAN $(O)'
139 ${q}if [ -d "$(O)" ]; then $(RMDIR) $(O); fi
140
141+include $(ta-dev-kit-dir$(sm))/mk/$(COMPILER_$(sm)).mk
142+include $(ta-dev-kit-dir$(sm))/mk/cc-option.mk
143+
144 subdirs = .
145 include $(ta-dev-kit-dir$(sm))/mk/subdir.mk
146
147diff --git a/ta/ta.mk b/ta/ta.mk
148index 1b7e999d..e0915d18 100644
149--- a/ta/ta.mk
150+++ b/ta/ta.mk
151@@ -105,6 +105,7 @@ $(foreach f, $(libfiles), \
152
153 # Copy .mk files
154 ta-mkfiles = mk/compile.mk mk/subdir.mk mk/gcc.mk mk/cleandirs.mk \
155+ mk/cc-option.mk \
156 ta/arch/$(ARCH)/link.mk ta/arch/$(ARCH)/link_shlib.mk \
157 ta/mk/ta_dev_kit.mk
158
159--
1602.17.1
161
diff --git a/recipes-security/optee/optee-os-qoriq_git.bb b/recipes-security/optee/optee-os-qoriq_git.bb
index 6ffe8298..d7b28278 100644
--- a/recipes-security/optee/optee-os-qoriq_git.bb
+++ b/recipes-security/optee/optee-os-qoriq_git.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_os;
13 file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \ 13 file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \
14 file://0001-Fix-alignment-of-data-for-mempool_alloc_pool.patch \ 14 file://0001-Fix-alignment-of-data-for-mempool_alloc_pool.patch \
15 file://0001-use-python3-instead-of-python.patch \ 15 file://0001-use-python3-instead-of-python.patch \
16 file://0001-optee-os-fix-gcc10-compilation-issue-and-missing-cc-.patch \
16 " 17 "
17S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"
18 19