regression 1023: workaround Clang optimization issue

When using Clang on HiKey (tested with 9.0.1 and 10.0.0), xtest 1023
fails with:

 * regression_1023 Test ELF initialization (.init_array)
 regression_1000.c:1860: Expression "op.params[0].value.a == 21" (12 == 21) is false
 regression_1000.c:1871: Expression "op.params[0].value.a == 213" (123 == 213) is false
   regression_1023 FAILED

The values indicate that the os_test_lib shared library is initialized
after the main application, which is not what we expect. In fact, the
reason for the failure is code elimination performed by Clang [1]. The
validity of this optimization is still unclear, but in any case it does
not concern the main things being tested, which is the invocation of
initialization functions when they exist. Therefore this commit applies
a workaround which effectively disables the problematic optimization.

Note: the issue can be reproduced on QEMU with CFLAGS_ta_arm32=-Os and
QEMUv8 with CFLAGS_ta_arm64="-Os -fno-common".

[1] http://lists.llvm.org/pipermail/llvm-dev/2020-June/thread.html#142192

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
1 file changed
tree: 0be95317a8b908c63364c5a49110154ebf803b94
  1. .github/
  2. cert/
  3. host/
  4. package/
  5. scripts/
  6. ta/
  7. .gitignore
  8. Android.mk
  9. CMakeLists.txt
  10. CMakeToolchain.txt
  11. LICENSE.md
  12. Makefile
  13. README.md
  14. typedefs.checkpatch
README.md

OP-TEE sanity testsuite

This git contains source code for the test suite (xtest) used to test the OP-TEE project.

All official OP-TEE documentation has moved to http://optee.readthedocs.io. The information that used to be here in this git can be found under optee_test.

// OP-TEE core maintainers