aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch
blob: 0120f5c2256937bf30e0edb1e33f2473f56e5ac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@arm.com>

From 36e784f621bf5d5be9183beba35f39426277c110 Mon Sep 17 00:00:00 2001
From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <volodymyr_babchuk@epam.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
---
 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 <compiler.h>
+
+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