diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-01-08 23:04:24 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-01-08 23:04:24 -0800 |
commit | 39470ba479f5f5a658bec286571b2fba43b0ed04 (patch) | |
tree | 135751a7aa3a8f6d41033519c9800bce66c70c80 | |
parent | 162bb95bd59ece43d4883551f4a839f59a08db34 (diff) | |
download | meta-freescale-39470ba479f5f5a658bec286571b2fba43b0ed04.tar.gz |
optee-os: Fix build with clang
Bring in the needed patches from meta-arm
Signed-off-by: Khem Raj <raj.khem@gmail.com>
5 files changed, 423 insertions, 1 deletions
diff --git a/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch b/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch new file mode 100644 index 00000000..2abd78a8 --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch | |||
@@ -0,0 +1,230 @@ | |||
1 | From f189457b79989543f65b8a4e8729eff2cdf9a758 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 13 Aug 2022 19:24:55 -0700 | ||
4 | Subject: [PATCH] core: Define section attributes for clang | ||
5 | |||
6 | Clang's attribute section is not same as gcc, here we need to add flags | ||
7 | to sections so they can be eventually collected by linker into final | ||
8 | output segments. Only way to do so with clang is to use | ||
9 | |||
10 | pragma clang section ... | ||
11 | |||
12 | The behavious is described here [1], this allows us to define names bss | ||
13 | sections. This was not an issue until clang-15 where LLD linker starts | ||
14 | to detect the section flags before merging them and throws the following | ||
15 | errors | ||
16 | |||
17 | | ld.lld: error: section type mismatch for .nozi.kdata_page | ||
18 | | >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS | ||
19 | | >>> output section .nozi: SHT_NOBITS | ||
20 | | | ||
21 | | ld.lld: error: section type mismatch for .nozi.mmu.l2 | ||
22 | | >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS | ||
23 | | >>> output section .nozi: SHT_NOBITS | ||
24 | |||
25 | These sections should be carrying SHT_NOBITS but so far it was not | ||
26 | possible to do so, this patch tries to use clangs pragma to get this | ||
27 | going and match the functionality with gcc. | ||
28 | |||
29 | [1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section | ||
30 | |||
31 | Upstream-Status: Pending | ||
32 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
33 | --- | ||
34 | core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- | ||
35 | core/arch/arm/mm/core_mmu_lpae.c | 35 ++++++++++++++++++++++++++++---- | ||
36 | core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- | ||
37 | core/kernel/thread.c | 13 +++++++++++- | ||
38 | 4 files changed, 71 insertions(+), 8 deletions(-) | ||
39 | |||
40 | --- a/core/arch/arm/kernel/thread.c | ||
41 | +++ b/core/arch/arm/kernel/thread.c | ||
42 | @@ -44,16 +44,31 @@ static size_t thread_user_kcode_size __n | ||
43 | #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ | ||
44 | defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) | ||
45 | long thread_user_kdata_sp_offset __nex_bss; | ||
46 | +#ifdef __clang__ | ||
47 | +#ifndef CFG_VIRTUALIZATION | ||
48 | +#pragma clang section bss=".nozi.kdata_page" | ||
49 | +#else | ||
50 | +#pragma clang section bss=".nex_nozi.kdata_page" | ||
51 | +#endif | ||
52 | +#endif | ||
53 | static uint8_t thread_user_kdata_page[ | ||
54 | ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, | ||
55 | SMALL_PAGE_SIZE)] | ||
56 | __aligned(SMALL_PAGE_SIZE) | ||
57 | +#ifndef __clang__ | ||
58 | #ifndef CFG_VIRTUALIZATION | ||
59 | - __section(".nozi.kdata_page"); | ||
60 | + __section(".nozi.kdata_page") | ||
61 | #else | ||
62 | - __section(".nex_nozi.kdata_page"); | ||
63 | + __section(".nex_nozi.kdata_page") | ||
64 | #endif | ||
65 | #endif | ||
66 | + ; | ||
67 | +#endif | ||
68 | + | ||
69 | +/* reset BSS section to default ( .bss ) */ | ||
70 | +#ifdef __clang__ | ||
71 | +#pragma clang section bss="" | ||
72 | +#endif | ||
73 | |||
74 | #ifdef ARM32 | ||
75 | uint32_t __nostackcheck thread_get_exceptions(void) | ||
76 | --- a/core/arch/arm/mm/core_mmu_lpae.c | ||
77 | +++ b/core/arch/arm/mm/core_mmu_lpae.c | ||
78 | @@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; | ||
79 | typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; | ||
80 | typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; | ||
81 | |||
82 | +#ifdef __clang__ | ||
83 | +#pragma clang section bss=".nozi.mmu.base_table" | ||
84 | +#endif | ||
85 | static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] | ||
86 | __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) | ||
87 | - __section(".nozi.mmu.base_table"); | ||
88 | +#ifndef __clang__ | ||
89 | + __section(".nozi.mmu.base_table") | ||
90 | +#endif | ||
91 | +; | ||
92 | +#ifdef __clang__ | ||
93 | +#pragma clang section bss="" | ||
94 | +#endif | ||
95 | |||
96 | +#ifdef __clang__ | ||
97 | +#pragma clang section bss=".nozi.mmu.l2" | ||
98 | +#endif | ||
99 | static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] | ||
100 | - __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); | ||
101 | + __aligned(XLAT_TABLE_SIZE) | ||
102 | +#ifndef __clang__ | ||
103 | + __section(".nozi.mmu.l2") | ||
104 | +#endif | ||
105 | +; | ||
106 | +#ifdef __clang__ | ||
107 | +#pragma clang section bss="" | ||
108 | +#endif | ||
109 | |||
110 | #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) | ||
111 | |||
112 | +#ifdef __clang__ | ||
113 | +#pragma clang section bss=".nozi.mmu.l2" | ||
114 | +#endif | ||
115 | /* MMU L2 table for TAs, one for each thread */ | ||
116 | static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] | ||
117 | - __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); | ||
118 | - | ||
119 | +#ifndef __clang__ | ||
120 | + __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") | ||
121 | +#endif | ||
122 | +; | ||
123 | +#ifdef __clang__ | ||
124 | +#pragma clang section bss="" | ||
125 | +#endif | ||
126 | /* | ||
127 | * TAs page table entry inside a level 1 page table. | ||
128 | * | ||
129 | --- a/core/arch/arm/mm/pgt_cache.c | ||
130 | +++ b/core/arch/arm/mm/pgt_cache.c | ||
131 | @@ -410,8 +410,18 @@ void pgt_init(void) | ||
132 | * has a large alignment, while .bss has a small alignment. The current | ||
133 | * link script is optimized for small alignment in .bss | ||
134 | */ | ||
135 | +#ifdef __clang__ | ||
136 | +#pragma clang section bss=".nozi.mmu.l2" | ||
137 | +#endif | ||
138 | static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] | ||
139 | - __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); | ||
140 | + __aligned(PGT_SIZE) | ||
141 | +#ifndef __clang__ | ||
142 | + __section(".nozi.pgt_cache") | ||
143 | +#endif | ||
144 | + ; | ||
145 | +#ifdef __clang__ | ||
146 | +#pragma clang section bss="" | ||
147 | +#endif | ||
148 | size_t n; | ||
149 | |||
150 | for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { | ||
151 | --- a/core/kernel/thread.c | ||
152 | +++ b/core/kernel/thread.c | ||
153 | @@ -38,13 +38,24 @@ struct thread_core_local thread_core_loc | ||
154 | name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] | ||
155 | #endif | ||
156 | |||
157 | +#define DO_PRAGMA(x) _Pragma (#x) | ||
158 | + | ||
159 | +#ifdef __clang__ | ||
160 | +#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ | ||
161 | +DO_PRAGMA (clang section bss=".nozi_stack." #name) \ | ||
162 | +linkage uint32_t name[num_stacks] \ | ||
163 | + [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ | ||
164 | + STACK_ALIGNMENT) / sizeof(uint32_t)] \ | ||
165 | + __attribute__((aligned(STACK_ALIGNMENT))); \ | ||
166 | +DO_PRAGMA(clang section bss="") | ||
167 | +#else | ||
168 | #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ | ||
169 | linkage uint32_t name[num_stacks] \ | ||
170 | [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ | ||
171 | STACK_ALIGNMENT) / sizeof(uint32_t)] \ | ||
172 | __attribute__((section(".nozi_stack." # name), \ | ||
173 | aligned(STACK_ALIGNMENT))) | ||
174 | - | ||
175 | +#endif | ||
176 | #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) | ||
177 | |||
178 | DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE, | ||
179 | --- a/core/arch/arm/mm/core_mmu_v7.c | ||
180 | +++ b/core/arch/arm/mm/core_mmu_v7.c | ||
181 | @@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_EN | ||
182 | typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; | ||
183 | typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; | ||
184 | |||
185 | +#ifdef __clang__ | ||
186 | +#pragma clang section bss=".nozi.mmu.l1" | ||
187 | +#endif | ||
188 | static l1_xlat_tbl_t main_mmu_l1_ttb | ||
189 | - __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); | ||
190 | + __aligned(L1_ALIGNMENT) | ||
191 | +#ifndef __clang__ | ||
192 | + __section(".nozi.mmu.l1") | ||
193 | +#endif | ||
194 | +; | ||
195 | +#ifdef __clang__ | ||
196 | +#pragma clang section bss="" | ||
197 | +#endif | ||
198 | |||
199 | /* L2 MMU tables */ | ||
200 | +#ifdef __clang__ | ||
201 | +#pragma clang section bss=".nozi.mmu.l2" | ||
202 | +#endif | ||
203 | static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] | ||
204 | - __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); | ||
205 | + __aligned(L2_ALIGNMENT) | ||
206 | +#ifndef __clang__ | ||
207 | + __section(".nozi.mmu.l2") | ||
208 | +#endif | ||
209 | +; | ||
210 | +#ifdef __clang__ | ||
211 | +#pragma clang section bss="" | ||
212 | +#endif | ||
213 | |||
214 | /* MMU L1 table for TAs, one for each thread */ | ||
215 | +#ifdef __clang__ | ||
216 | +#pragma clang section bss=".nozi.mmu.ul1" | ||
217 | +#endif | ||
218 | static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] | ||
219 | - __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); | ||
220 | + __aligned(UL1_ALIGNMENT) | ||
221 | +#ifndef __clang__ | ||
222 | + __section(".nozi.mmu.ul1") | ||
223 | +#endif | ||
224 | +; | ||
225 | +#ifdef __clang__ | ||
226 | +#pragma clang section bss="" | ||
227 | +#endif | ||
228 | |||
229 | struct mmu_partition { | ||
230 | l1_xlat_tbl_t *l1_table; | ||
diff --git a/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch new file mode 100644 index 00000000..c07d0482 --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross.burton@arm.com> | ||
3 | Date: Tue, 26 May 2020 14:38:02 -0500 | ||
4 | Subject: [PATCH] allow setting sysroot for libgcc lookup | ||
5 | |||
6 | Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching | ||
7 | for the compiler libraries as there's no easy way to reliably pass --sysroot | ||
8 | otherwise. | ||
9 | |||
10 | Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188] | ||
11 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
12 | |||
13 | --- | ||
14 | mk/gcc.mk | 6 +++--- | ||
15 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
16 | |||
17 | --- a/mk/gcc.mk | ||
18 | +++ b/mk/gcc.mk | ||
19 | @@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(sh | ||
20 | -print-file-name=include 2> /dev/null) | ||
21 | |||
22 | # Get location of libgcc from gcc | ||
23 | -libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ | ||
24 | +libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ | ||
25 | -print-libgcc-file-name 2> /dev/null) | ||
26 | -libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ | ||
27 | +libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ | ||
28 | -print-file-name=libstdc++.a 2> /dev/null) | ||
29 | -libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ | ||
30 | +libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ | ||
31 | -print-file-name=libgcc_eh.a 2> /dev/null) | ||
32 | |||
33 | # Define these to something to discover accidental use | ||
diff --git a/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch new file mode 100644 index 00000000..dc6d5517 --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 | ||
2 | From: Brett Warren <brett.warren@arm.com> | ||
3 | Date: Wed, 23 Sep 2020 09:27:34 +0100 | ||
4 | Subject: [PATCH] optee: enable clang support | ||
5 | |||
6 | When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used | ||
7 | to provide a sysroot wasn't included, which results in not locating | ||
8 | compiler-rt. This is mitigated by including the variable as ammended. | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 | ||
12 | Signed-off-by: Brett Warren <brett.warren@arm.com> | ||
13 | |||
14 | --- | ||
15 | mk/clang.mk | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | --- a/mk/clang.mk | ||
19 | +++ b/mk/clang.mk | ||
20 | @@ -30,7 +30,7 @@ comp-cflags-warns-clang := -Wno-language | ||
21 | |||
22 | # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of | ||
23 | # libgcc for clang | ||
24 | -libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ | ||
25 | +libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ | ||
26 | -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) | ||
27 | |||
28 | # Core ASLR relies on the executable being ready to run from its preferred load | ||
diff --git a/recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch b/recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch new file mode 100644 index 00000000..b82aabdc --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch | |||
@@ -0,0 +1,114 @@ | |||
1 | From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 | ||
2 | From: Jerome Forissier <jerome.forissier@linaro.org> | ||
3 | Date: Tue, 23 Aug 2022 12:31:46 +0000 | ||
4 | Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to | ||
5 | |||
6 | .S files | ||
7 | |||
8 | When building for arm32 with GNU binutils 2.39, the linker outputs | ||
9 | warnings when linking Trusted Applications: | ||
10 | |||
11 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack | ||
12 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker | ||
13 | |||
14 | We could silence the warning by adding the '-z execstack' option to the | ||
15 | TA link flags, like we did in the parent commit for the TEE core and | ||
16 | ldelf. Indeed, ldelf always allocates a non-executable piece of memory | ||
17 | for the TA to use as a stack. | ||
18 | |||
19 | However it seems preferable to comply with the common ELF practices in | ||
20 | this case. A better fix is therefore to add the missing .note.GNU-stack | ||
21 | sections in the assembler files. | ||
22 | |||
23 | Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
24 | |||
25 | Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> | ||
26 | Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] | ||
27 | |||
28 | --- | ||
29 | lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ | ||
30 | lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ | ||
31 | lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ | ||
32 | lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ | ||
33 | lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ | ||
34 | lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ | ||
35 | ta/arch/arm/ta_entry_a32.S | 2 ++ | ||
36 | 7 files changed, 14 insertions(+) | ||
37 | |||
38 | --- a/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
39 | +++ b/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
40 | @@ -9,6 +9,8 @@ | ||
41 | |||
42 | .section .note.GNU-stack,"",%progbits | ||
43 | |||
44 | + .section .note.GNU-stack,"",%progbits | ||
45 | + | ||
46 | .section .text | ||
47 | .balign 4 | ||
48 | .code 32 | ||
49 | --- a/lib/libutils/ext/arch/arm/atomic_a32.S | ||
50 | +++ b/lib/libutils/ext/arch/arm/atomic_a32.S | ||
51 | @@ -7,6 +7,8 @@ | ||
52 | |||
53 | .section .note.GNU-stack,"",%progbits | ||
54 | |||
55 | + .section .note.GNU-stack,"",%progbits | ||
56 | + | ||
57 | /* uint32_t atomic_inc32(uint32_t *v); */ | ||
58 | FUNC atomic_inc32 , : | ||
59 | ldrex r1, [r0] | ||
60 | --- a/lib/libutils/ext/arch/arm/mcount_a32.S | ||
61 | +++ b/lib/libutils/ext/arch/arm/mcount_a32.S | ||
62 | @@ -9,6 +9,8 @@ | ||
63 | |||
64 | .section .note.GNU-stack,"",%progbits | ||
65 | |||
66 | + .section .note.GNU-stack,"",%progbits | ||
67 | + | ||
68 | /* | ||
69 | * Convert return address to call site address by subtracting the size of the | ||
70 | * mcount call instruction (blx __gnu_mcount_nc). | ||
71 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
72 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
73 | @@ -7,6 +7,8 @@ | ||
74 | |||
75 | .section .note.GNU-stack,"",%progbits | ||
76 | |||
77 | + .section .note.GNU-stack,"",%progbits | ||
78 | + | ||
79 | /* | ||
80 | * signed ret_idivmod_values(signed quot, signed rem); | ||
81 | * return quotient and remaining the EABI way (regs r0,r1) | ||
82 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
83 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
84 | @@ -7,6 +7,8 @@ | ||
85 | |||
86 | .section .note.GNU-stack,"",%progbits | ||
87 | |||
88 | + .section .note.GNU-stack,"",%progbits | ||
89 | + | ||
90 | /* | ||
91 | * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) | ||
92 | */ | ||
93 | --- a/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
94 | +++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
95 | @@ -53,6 +53,8 @@ | ||
96 | |||
97 | .section .note.GNU-stack,"",%progbits | ||
98 | |||
99 | + .section .note.GNU-stack,"",%progbits | ||
100 | + | ||
101 | /* Arm/Thumb interworking support: | ||
102 | |||
103 | The interworking scheme expects functions to use a BX instruction | ||
104 | --- a/ta/arch/arm/ta_entry_a32.S | ||
105 | +++ b/ta/arch/arm/ta_entry_a32.S | ||
106 | @@ -7,6 +7,8 @@ | ||
107 | |||
108 | .section .note.GNU-stack,"",%progbits | ||
109 | |||
110 | + .section .note.GNU-stack,"",%progbits | ||
111 | + | ||
112 | /* | ||
113 | * This function is the bottom of the user call stack. Mark it as such so that | ||
114 | * the unwinding code won't try to go further down. | ||
diff --git a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb b/recipes-security/optee-imx/optee-os_3.19.0.imx.bb index f5e727b3..82751a80 100644 --- a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb +++ b/recipes-security/optee-imx/optee-os_3.19.0.imx.bb | |||
@@ -8,8 +8,13 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" | |||
8 | 8 | ||
9 | DEPENDS = "python3-pyelftools-native u-boot-mkimage-native \ | 9 | DEPENDS = "python3-pyelftools-native u-boot-mkimage-native \ |
10 | python3-cryptography-native" | 10 | python3-cryptography-native" |
11 | DEPENDS:append:toolchain-clang = " compiler-rt" | ||
11 | 12 | ||
12 | SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH}" | 13 | SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH} \ |
14 | file://0001-core-Define-section-attributes-for-clang.patch \ | ||
15 | file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ | ||
16 | file://0007-allow-setting-sysroot-for-clang.patch \ | ||
17 | file://0010-add-note-GNU-stack-section.patch" | ||
13 | SRCBRANCH = "lf-5.15.71_2.2.0" | 18 | SRCBRANCH = "lf-5.15.71_2.2.0" |
14 | SRCREV = "00919403f040fad4f8603e605932281ff8451b1d" | 19 | SRCREV = "00919403f040fad4f8603e605932281ff8451b1d" |
15 | 20 | ||
@@ -44,6 +49,9 @@ PLATFORM_FLAVOR:mx93-nxp-bsp = "mx93evk" | |||
44 | OPTEE_ARCH:arm = "arm32" | 49 | OPTEE_ARCH:arm = "arm32" |
45 | OPTEE_ARCH:aarch64 = "arm64" | 50 | OPTEE_ARCH:aarch64 = "arm64" |
46 | 51 | ||
52 | COMPILER ?= "gcc" | ||
53 | COMPILER:toolchain-clang = "clang" | ||
54 | |||
47 | # Optee-os can be built for 32 bits and 64 bits at the same time | 55 | # Optee-os can be built for 32 bits and 64 bits at the same time |
48 | # as long as the compilers are correctly defined. | 56 | # as long as the compilers are correctly defined. |
49 | # For 64bits, CROSS_COMPILE64 must be set | 57 | # For 64bits, CROSS_COMPILE64 must be set |
@@ -56,15 +64,24 @@ EXTRA_OEMAKE = " \ | |||
56 | CFG_TEE_TA_LOG_LEVEL=0 \ | 64 | CFG_TEE_TA_LOG_LEVEL=0 \ |
57 | CFG_TEE_CORE_LOG_LEVEL=0 \ | 65 | CFG_TEE_CORE_LOG_LEVEL=0 \ |
58 | OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \ | 66 | OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \ |
67 | COMPILER=${COMPILER} \ | ||
59 | -C ${S} O=${B} \ | 68 | -C ${S} O=${B} \ |
60 | " | 69 | " |
61 | 70 | ||
62 | LDFLAGS[unexport] = "1" | 71 | LDFLAGS[unexport] = "1" |
72 | CPPFLAGS[unexport] = "1" | ||
73 | AS[unexport] = "1" | ||
74 | LD[unexport] = "1" | ||
75 | |||
63 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 76 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" |
64 | CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 77 | CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}" |
65 | 78 | ||
66 | do_configure[noexec] = "1" | 79 | do_configure[noexec] = "1" |
67 | 80 | ||
81 | do_compile:prepend() { | ||
82 | PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) | ||
83 | } | ||
84 | |||
68 | do_compile:arm () { | 85 | do_compile:arm () { |
69 | oe_runmake all uTee | 86 | oe_runmake all uTee |
70 | } | 87 | } |