From 88332506254610fac89e887bd27868348da948e0 Mon Sep 17 00:00:00 2001 From: Andris Zeila Date: Wed, 5 Aug 2020 15:58:58 +0300 Subject: ...G...... [ZBX-16998] improved agent binary compatibility by removing __thread attribute when not building agent2 * commit '7f7970126f09818d4567acd2d7a91ec7a0b71106': .D........ [ZBX-16998] added changelog entry .......... [ZBX-16998] fixed agent2 build on windows ...G...... [ZBX-16998] removed __thread usage when building only C targets (cherry picked from commit 75ea8679f05b892a9d09c6ba5fe3ecb9b47e332f) --- include/zbxtypes.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include/zbxtypes.h') diff --git a/include/zbxtypes.h b/include/zbxtypes.h index b64ca0dde44..0d3a5b421ed 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -20,12 +20,20 @@ #ifndef ZABBIX_TYPES_H #define ZABBIX_TYPES_H +#include "sysinc.h" + #if defined(_WINDOWS) # define ZBX_THREAD_LOCAL __declspec(thread) #else -# if defined(HAVE_THREAD_LOCAL) && (defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__)) -# define ZBX_THREAD_LOCAL __thread -# else +/* for non windows build thread local storage is required only for agent2 */ +# if defined(ZBX_BUILD_AGENT2) +# if defined(HAVE_THREAD_LOCAL) && (defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__)) +# define ZBX_THREAD_LOCAL __thread +# else +# error "C compiler is not compatible with agent2 assembly" +# endif +# endif +# if !defined(ZBX_THREAD_LOCAL) # define ZBX_THREAD_LOCAL # endif #endif -- cgit v1.2.3