From b394c5febaef698dfc8eea0608fe8c42b45243e6 Mon Sep 17 00:00:00 2001 From: Praneeth Bajjuri Date: Fri, 25 Jun 2021 20:09:06 -0500 Subject: optee-os: upgrade to upstream 3.12.0 Upgrade optee-os to upstream 3.12.0 on dunfell branch. upstream optee 3.13.0 tag has the following patches. f50962e3 ta_dev_kit.mk: make sure that libutils is linked second time 73196b58 link.mk: implement support for libnames-after-libgcc variable 36e784f6 libutils: provide empty __getauxval() implementation Hence removing from here. Signed-off-by: Praneeth Bajjuri Signed-off-by: Yogesh Siraswar --- ...-provide-empty-__getauxval-implementation.patch | 62 ---------------------- ...lement-support-for-libnames-after-libgcc-.patch | 55 ------------------- ...mk-make-sure-that-libutils-is-linked-seco.patch | 44 --------------- recipes-security/optee/optee-os_%.bbappend | 7 +-- 4 files changed, 2 insertions(+), 166 deletions(-) delete mode 100644 recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch diff --git a/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch b/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted file mode 100644 index 0120f5c2..00000000 --- a/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch +++ /dev/null @@ -1,62 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 36e784f621bf5d5be9183beba35f39426277c110 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk -Date: Tue, 13 Oct 2020 22:45:39 +0300 -Subject: [PATCH 1/3] libutils: provide empty __getauxval() implementation - -Never version of libgcc are built with LSE implementation in mind. To -determine if LSE is available on platform it calls __getauxval(), so in -some cases we can get undefined reference to __getauxval() error. - -Prominent case is libgcc_eh.a library, which is used by C++ TAs. Exception -handler depends on atomic operations, so it tries to call -init_have_lse_atomics() first. This function in turn calls __getauxval(), -which causes linking error. - -In the future we can make __getauxval() to return actual platform -capabilities. - -Signed-off-by: Volodymyr Babchuk -Reviewed-by: Jens Wiklander -Reviewed-by: Jerome Forissier ---- - lib/libutils/ext/arch/arm/auxval.c | 12 ++++++++++++ - lib/libutils/ext/arch/arm/sub.mk | 1 + - 2 files changed, 13 insertions(+) - create mode 100644 lib/libutils/ext/arch/arm/auxval.c - -diff --git a/lib/libutils/ext/arch/arm/auxval.c b/lib/libutils/ext/arch/arm/auxval.c -new file mode 100644 -index 00000000..98bca850 ---- /dev/null -+++ b/lib/libutils/ext/arch/arm/auxval.c -@@ -0,0 +1,12 @@ -+// SPDX-License-Identifier: BSD-2-Clause -+/* -+ * Copyright (c) 2020, EPAM Systems -+ */ -+ -+#include -+ -+unsigned long int __getauxval (unsigned long int type); -+unsigned long int __getauxval (unsigned long int type __unused) -+{ -+ return 0; -+} -diff --git a/lib/libutils/ext/arch/arm/sub.mk b/lib/libutils/ext/arch/arm/sub.mk -index dc5eed67..2e779066 100644 ---- a/lib/libutils/ext/arch/arm/sub.mk -+++ b/lib/libutils/ext/arch/arm/sub.mk -@@ -3,6 +3,7 @@ srcs-$(CFG_ARM32_$(sm)) += aeabi_unwind.c - endif - srcs-$(CFG_ARM32_$(sm)) += atomic_a32.S - srcs-$(CFG_ARM64_$(sm)) += atomic_a64.S -+srcs-y += auxval.c - ifneq ($(sm),ldelf) # TA, core - srcs-$(CFG_ARM32_$(sm)) += mcount_a32.S - srcs-$(CFG_ARM64_$(sm)) += mcount_a64.S --- -2.25.1 - diff --git a/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch b/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch deleted file mode 100644 index 11296c8c..00000000 --- a/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch +++ /dev/null @@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk -Reviewed-by: Jens Wiklander -Reviewed-by: Jerome Forissier ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 - diff --git a/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch b/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted file mode 100644 index 88ba5f85..00000000 --- a/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch +++ /dev/null @@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk -Reviewed-by: Jens Wiklander -Reviewed-by: Jerome Forissier ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 - diff --git a/recipes-security/optee/optee-os_%.bbappend b/recipes-security/optee/optee-os_%.bbappend index 8072490f..c90d85ea 100644 --- a/recipes-security/optee/optee-os_%.bbappend +++ b/recipes-security/optee/optee-os_%.bbappend @@ -1,16 +1,13 @@ FILESEXTRAPATHS_prepend_ti-soc := "${THISDIR}/${PN}:" -PV_ti-soc = "3.11.0+git${SRCPV}" +PV_ti-soc = "3.12.0+git${SRCPV}" -SRCREV_ti-soc = "c4def2a8262a03244d9a88461699b9b8e43c6b55" +SRCREV_ti-soc = "3d47a131bca1d9ed511bfd516aa5e70269e12c1d" SRC_URI_ti-soc = " \ git://github.com/OP-TEE/optee_os.git \ file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ file://0007-allow-setting-sysroot-for-clang.patch \ - file://0001-libutils-provide-empty-__getauxval-implementation.patch \ - file://0002-link.mk-implement-support-for-libnames-after-libgcc-.patch \ - file://0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch \ " do_compile_prepend_ti-soc() { -- cgit v1.2.3-54-g00ecf