aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome@forissier.org>2020-08-19 14:09:36 +0200
committerJérôme Forissier <jerome@forissier.org>2020-08-20 09:33:39 +0200
commit30efcbeaf8864d0f2a5c4be593a5411001fab31b (patch)
tree4bdc0a826b0fd3570e0b9163016bc0e290801e28
parent82e87bbc20fef0686c7f78e225ff5b3298944714 (diff)
downloadoptee_test-30efcbeaf8864d0f2a5c4be593a5411001fab31b.tar.gz
os_test: arm64: disable C++ and TLS tests depending on compiler3.10.0psa-developmentintegration
In 64-bit mode, the Thead Local Storage tests currently pass only with Clang, or GCC 8 or later. Earlier GCC versions (6.2, 7.3) generate an unsupported relocation type: * regression_1006 Test Basic OS features E/LD: e64_relocate:538 Unknown relocation type 1031 E/TC:?? 0 init_with_ldelf:232 ldelf failed with res: 0xffff0005 [...] regression_1006 FAILED TLS is not currently useful in itself, since OP-TEE doesn't have multi- threaded TAs. It was implemented primarily to support C++ because the GNU C++ runtime depends on it. To avoid failures in the regression tests of people who upgrade their OP-TEE environment and who possibly use older toolchains, the TLS tests should be ignored unless a "known good" compiler is used. Similarly, since the C++ tests depend on TLS, they need to be disabled too with Aarch64 GCC < 8 (note they are already disabled with Clang). Signed-off-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU/QEMUv8, GCC 8.3/GCC 6.2/Clang 10) Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
-rw-r--r--ta/os_test/os_test.c12
-rw-r--r--ta/os_test/sub.mk4
-rw-r--r--ta/os_test/ta_entry.c2
-rw-r--r--ta/os_test_lib/include/os_test_lib.h2
-rw-r--r--ta/os_test_lib/os_test_lib.c2
5 files changed, 20 insertions, 2 deletions
diff --git a/ta/os_test/os_test.c b/ta/os_test/os_test.c
index 4329ed4..cac5820 100644
--- a/ta/os_test/os_test.c
+++ b/ta/os_test/os_test.c
@@ -1301,6 +1301,7 @@ TEE_Result ta_entry_client_identity(uint32_t param_types, TEE_Param params[4])
return res;
}
+#if defined(__clang__) || !defined(__aarch64__) || __GNUC__ >= 8
__thread int os_test_tls_a;
__thread int os_test_tls_b = 42;
@@ -1332,6 +1333,17 @@ TEE_Result ta_entry_tls_test_shlib(void)
return TEE_SUCCESS;
}
+#else
+TEE_Result ta_entry_tls_test_main(void)
+{
+ return TEE_ERROR_NOT_SUPPORTED;
+}
+
+TEE_Result ta_entry_tls_test_shlib(void)
+{
+ return TEE_ERROR_NOT_SUPPORTED;
+}
+#endif
static int iterate_hdr_cb(struct dl_phdr_info *info __maybe_unused,
size_t size __unused, void *data)
diff --git a/ta/os_test/sub.mk b/ta/os_test/sub.mk
index 6f230c0..ba6853a 100644
--- a/ta/os_test/sub.mk
+++ b/ta/os_test/sub.mk
@@ -8,7 +8,9 @@ srcs-y += init.c
srcs-y += os_test.c
srcs-y += ta_entry.c
srcs-$(CFG_TA_FLOAT_SUPPORT) += test_float_subj.c
-ifneq ($(COMPILER),clang)
+# C++ tests don't work with Clang, and for Aarch64 they require GCC >= 8
+c++-supported := $(shell env echo -e '\#if !defined(__clang__) && (!defined(__aarch64__) || __GNUC__ >= 8)\ny\n\#endif' | $(CC$(sm)) -E -P -)
+ifeq ($(c++-supported),y)
# Profiling (-pg) is disabled for C++ tests because in case it is used for
# function tracing (CFG_FTRACE_SUPPORT=y) then the exception handling code in
# the C++ runtime won't be able to unwind the (modified) stack.
diff --git a/ta/os_test/ta_entry.c b/ta/os_test/ta_entry.c
index 1d8db88..9e3d277 100644
--- a/ta/os_test/ta_entry.c
+++ b/ta/os_test/ta_entry.c
@@ -121,7 +121,7 @@ TEE_Result TA_InvokeCommandEntryPoint(void *pSessionContext,
case TA_OS_TEST_CMD_DL_PHDR_DL:
return ta_entry_dl_phdr_dl();
-#ifdef __clang__
+#if defined(__clang__) || (defined(__aarch64__) && __GNUC__ < 8)
case TA_OS_TEST_CMD_CXX_CTOR_MAIN:
case TA_OS_TEST_CMD_CXX_CTOR_SHLIB:
case TA_OS_TEST_CMD_CXX_CTOR_SHLIB_DL:
diff --git a/ta/os_test_lib/include/os_test_lib.h b/ta/os_test_lib/include/os_test_lib.h
index c04b15f..7629bc7 100644
--- a/ta/os_test_lib/include/os_test_lib.h
+++ b/ta/os_test_lib/include/os_test_lib.h
@@ -11,8 +11,10 @@
int os_test_shlib_add(int a, int b);
void os_test_shlib_panic(void);
+#if defined(__clang__) || !defined(__aarch64__) || __GNUC__ >= 8
extern __thread int os_test_shlib_tls_a;
extern __thread int os_test_shlib_tls_b;
+#endif
TEE_Result os_test_shlib_cxx_ctor(void);
diff --git a/ta/os_test_lib/os_test_lib.c b/ta/os_test_lib/os_test_lib.c
index 17eb9bb..a34a446 100644
--- a/ta/os_test_lib/os_test_lib.c
+++ b/ta/os_test_lib/os_test_lib.c
@@ -16,8 +16,10 @@ static void __attribute__((constructor)) os_test_shlib_init(void)
DMSG("os_test_global=%d", os_test_global);
}
+#if defined(__clang__) || !defined(__aarch64__) || __GNUC__ >= 8
__thread int os_test_shlib_tls_a;
__thread int os_test_shlib_tls_b = 123;
+#endif
int os_test_shlib_add(int a, int b)
{