Add regression 1029 (Thread Local Storage)

Adds a test using the __thread attribute, used in the main executable
and in a shared library. The test is single threaded of course (OP-TEE
does not support threads at the moment), but it exercices some
previously unimplemented features:
 - New TLS relocations (Aarch32, Aarch64)
 - The __tls_get_addr() runtime helper (Aarch32 only)

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/ta/os_test/os_test.c b/ta/os_test/os_test.c
index 7ec2377..11be6ec 100644
--- a/ta/os_test/os_test.c
+++ b/ta/os_test/os_test.c
@@ -1298,3 +1298,35 @@
 
 	return res;
 }
+
+__thread int os_test_tls_a;
+__thread int os_test_tls_b = 42;
+
+TEE_Result ta_entry_tls_test_main(void)
+{
+	if (os_test_tls_a != 0) {
+		EMSG("os_test_tls_a=%d, expected 0", os_test_tls_a);
+		return TEE_ERROR_GENERIC;
+	}
+	if (os_test_tls_b != 42) {
+		EMSG("os_test_tls_b=%d, expected 42", os_test_tls_b);
+		return TEE_ERROR_GENERIC;
+	}
+
+	return TEE_SUCCESS;
+}
+
+TEE_Result ta_entry_tls_test_shlib(void)
+{
+	if (os_test_shlib_tls_a != 0) {
+		EMSG("os_test_shlib_tls_a=%d, expected 0", os_test_shlib_tls_a);
+		return TEE_ERROR_GENERIC;
+	}
+	if (os_test_shlib_tls_b != 123) {
+		EMSG("os_test_shlib_tls_b=%d, expected 123",
+		     os_test_shlib_tls_b);
+		return TEE_ERROR_GENERIC;
+	}
+
+	return TEE_SUCCESS;
+}