From f88d9b82e8bd8ae38fba666b5825ffb41769f81a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 9 Aug 2022 12:25:22 -0700
Subject: [PATCH] monkey: Fix TLS detection testcase

Clang15 errors out on compiling the check and disables TLS

Fixes errors like

error: call to undeclared function '__tls_get_addr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
         __tls_get_addr(0);
         ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/monkey/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt
index 15e62e8..96ac2bd 100644
--- a/lib/monkey/CMakeLists.txt
+++ b/lib/monkey/CMakeLists.txt
@@ -178,6 +178,8 @@ endif()
 # Use old Pthread TLS
 if(NOT MK_PTHREAD_TLS)
   check_c_source_compiles("
+     #include <sys/types.h>
+     extern void *__tls_get_addr(size_t *v);
      __thread int a;
      int main() {
          __tls_get_addr(0);
-- 
2.37.1

