kumquat-buildroot/package/liburcu/0002-fix-don-t-use-C-thread_local-on-MacOs.patch
Fabrice Fontaine 828daae908 package/liburcu: fix build with gcc 4.8
Fix the following lttng-tools build failure raised since bump of liburcu
to version 0.13.0 in commit 9cedbcf494 and
109267f653:

In file included from ../../../src/common/error.h:16:0,
                 from directory-handle.c:9:
../../../src/common/error.h:44:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'struct'
 extern DECLARE_URCU_TLS(struct log_time, error_log_time);
                         ^
This is fixed by upstream
0003-Always-use-__thread-for-Thread-local-storage-except-on-MSVC.patch.
Also include upstream 0002-fix-don-t-use-C-thread_local-on-MacOs.patch
to avoid conflicts.

Fixes:
 - http://autobuild.buildroot.org/results/70d645593c9e164d0d044da1b0128cda9c96e830

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-11-09 23:02:56 +01:00

42 lines
1.6 KiB
Diff

From e915ab84fd0c02d37504f3eb1e1f3be93ea6dc37 Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Thu, 9 Sep 2021 12:11:16 -0400
Subject: [PATCH] fix: don't use C++ thread_local on MacOs
Recent versions of Apple's clang++ do support 'thread_local' but the
implementation generates additional helper symbols. This is a problem
when accessing an extern TLS variable in a C++ compile unit that is
provided by a C library that doesn't have those extra symbols.
Fallback to using '__thread' on MacOs.
Change-Id: I87cb5b3c9293f7bf66f7115f453b546dd793a449
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
[Retrieved from:
https://github.com/urcu/userspace-rcu/commit/e915ab84fd0c02d37504f3eb1e1f3be93ea6dc37]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
include/urcu/tls-compat.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/urcu/tls-compat.h b/include/urcu/tls-compat.h
index 24ef1b9a..25cf375a 100644
--- a/include/urcu/tls-compat.h
+++ b/include/urcu/tls-compat.h
@@ -34,7 +34,12 @@ extern "C" {
#ifdef CONFIG_RCU_TLS
-#if defined (__cplusplus) && (__cplusplus >= 201103L)
+/*
+ * Don't use C++ 'thread_local' on MacOs, the implementation is incompatible
+ * with C and will result in a link error when accessing an extern variable
+ * provided by the C library from C++ code.
+ */
+#if defined (__cplusplus) && (__cplusplus >= 201103L) && !defined(__APPLE__)
# define URCU_TLS_STORAGE_CLASS thread_local
#elif defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
# define URCU_TLS_STORAGE_CLASS _Thread_local