From e27637b7b93bb0f00f105ff3b29e5d8d5bd5816e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 20 Jan 2022 09:57:21 +0100 Subject: [PATCH] build: simplify thread local storage handling Signed-off-by: Christian Brauner --- config/tls.m4 | 14 -------------- configure.ac | 3 --- src/lxc/compiler.h | 8 +++++++- 3 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 config/tls.m4 diff --git a/config/tls.m4 b/config/tls.m4 deleted file mode 100644 index cd032c9d7..000000000 --- a/config/tls.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# See if we have working TLS. We only check to see if it compiles, and that -# the resulting program actually runs, not whether the resulting TLS variables -# work properly; that check is done at runtime, since we can run binaries -# compiled with __thread on systems without TLS. -AC_DEFUN([LXC_CHECK_TLS], -[ - AC_MSG_CHECKING(for TLS) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ]) - AC_MSG_RESULT($have_tls) - if test "$have_tls" = "yes"; then - AC_DEFINE([HAVE_TLS],[1],[Define if the compiler supports __thread]) - AC_DEFINE([thread_local],[__thread],[Define to the compiler TLS keyword]) - fi -]) diff --git a/configure.ac b/configure.ac index e7f9d54f0..581f0d7d4 100644 --- a/configure.ac +++ b/configure.ac @@ -777,9 +777,6 @@ AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include ] AX_PTHREAD AC_SEARCH_LIBS(clock_gettime, [rt]) -# See if we support thread-local storage. -LXC_CHECK_TLS - # Hardening flags CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \ -fPIE \ diff --git a/src/lxc/compiler.h b/src/lxc/compiler.h index 4d6232382..907941d98 100644 --- a/src/lxc/compiler.h +++ b/src/lxc/compiler.h @@ -5,8 +5,14 @@ #include "config.h" -#include +#include +#include +#include #include +#include +#include +#include +#include #ifndef thread_local #if __STDC_VERSION__ >= 201112L && \