mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-24 17:26:11 +00:00

With LTO, gcc's IPA passes might drop the foo() function and then the test will pass even on platforms where __builtin_thread_pointer is unavailable. On PPC64, we get this as a result: ``` llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:361:61: error: ‘__builtin_thread_pointer’ is not supported on this targ ``` Just mark the function in the CMake configure test with the 'used' attribute to avoid it being optimised out. The test then behaves correctly with -flto. Tested with e.g. 'powerpc64le-linux-gnu-gcc -O2 -flto a.c'. Reported-by: matoro Reviewed-by: maskray Closes: https://github.com/llvm/llvm-project/pull/70968 Signed-off-by: Sam James <sam@gentoo.org>
See docs/CMake.html for instructions on how to build LLVM with CMake.