Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From f88d9b82e8bd8ae38fba666b5825ffb41769f81a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 9 Aug 2022 12:25:22 -0700 |
| 4 | Subject: [PATCH] monkey: Fix TLS detection testcase |
| 5 | |
| 6 | Clang15 errors out on compiling the check and disables TLS |
| 7 | |
| 8 | Fixes errors like |
| 9 | |
| 10 | error: call to undeclared function '__tls_get_addr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] |
| 11 | __tls_get_addr(0); |
| 12 | ^ |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | lib/monkey/CMakeLists.txt | 2 ++ |
| 17 | 1 file changed, 2 insertions(+) |
| 18 | |
| 19 | diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt |
| 20 | index 15e62e8..96ac2bd 100644 |
| 21 | --- a/lib/monkey/CMakeLists.txt |
| 22 | +++ b/lib/monkey/CMakeLists.txt |
| 23 | @@ -178,6 +178,8 @@ endif() |
| 24 | # Use old Pthread TLS |
| 25 | if(NOT MK_PTHREAD_TLS) |
| 26 | check_c_source_compiles(" |
| 27 | + #include <sys/types.h> |
| 28 | + extern void *__tls_get_addr(size_t *v); |
| 29 | __thread int a; |
| 30 | int main() { |
| 31 | __tls_get_addr(0); |
| 32 | -- |
| 33 | 2.37.1 |
| 34 | |