From: Michael Jeanson Date: Wed, 12 Dec 2018 20:01:38 +0000 (-0500) Subject: Fix: symbol aliases with TLS compat X-Git-Tag: v0.11.0~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=99bfa9e9e88b273c5a3134eafb9c31938f3af7d6;p=userspace-rcu.git Fix: symbol aliases with TLS compat Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/src/urcu-bp.c b/src/urcu-bp.c index 0653f9d..54fda16 100644 --- a/src/urcu-bp.c +++ b/src/urcu-bp.c @@ -151,8 +151,7 @@ URCU_ATTR_ALIAS("urcu_bp_gp") extern struct urcu_bp_gp rcu_gp_bp; * by both the reader and the writers. */ DEFINE_URCU_TLS(struct urcu_bp_reader *, urcu_bp_reader); -URCU_ATTR_ALIAS("urcu_bp_reader") -extern struct urcu_bp_reader *rcu_reader_bp; +DEFINE_URCU_TLS_ALIAS(struct urcu_bp_reader *, urcu_bp_reader, rcu_reader_bp); static CDS_LIST_HEAD(registry); diff --git a/src/urcu-qsbr.c b/src/urcu-qsbr.c index 6ff933a..ab20ebe 100644 --- a/src/urcu-qsbr.c +++ b/src/urcu-qsbr.c @@ -81,8 +81,7 @@ URCU_ATTR_ALIAS("urcu_qsbr_gp") extern struct urcu_gp rcu_gp_qsbr; * writers. */ DEFINE_URCU_TLS(struct urcu_qsbr_reader, urcu_qsbr_reader); -URCU_ATTR_ALIAS("urcu_qsbr_reader") -extern struct urcu_qsbr_reader rcu_reader_qsbr; +DEFINE_URCU_TLS_ALIAS(struct urcu_qsbr_reader, urcu_qsbr_reader, rcu_reader_qsbr); static CDS_LIST_HEAD(registry); diff --git a/src/urcu-utils.h b/src/urcu-utils.h index 3c3c7a1..eab6212 100644 --- a/src/urcu-utils.h +++ b/src/urcu-utils.h @@ -33,4 +33,18 @@ #define URCU_ATTR_ALIAS(x) __attribute__((alias(x))) #endif +#ifdef CONFIG_RCU_TLS +#define DEFINE_URCU_TLS_ALIAS_1(type, name, alias) \ + URCU_ATTR_ALIAS(#name) \ + extern type alias + +#else +#define DEFINE_URCU_TLS_ALIAS_1(type, name, alias) \ + URCU_ATTR_ALIAS("*__tls_access_" #name) \ + type *__tls_access_ ## alias() +#endif + +#define DEFINE_URCU_TLS_ALIAS(type, name, alias) \ + DEFINE_URCU_TLS_ALIAS_1(type, name, alias) + #endif /* _URCU_UTILS_H */ diff --git a/src/urcu.c b/src/urcu.c index c4e2dde..2cac0b6 100644 --- a/src/urcu.c +++ b/src/urcu.c @@ -138,8 +138,7 @@ extern struct urcu_gp alias_rcu_gp; * writers. */ DEFINE_URCU_TLS(struct urcu_reader, rcu_reader); -URCU_ATTR_ALIAS(urcu_stringify(rcu_reader)) -extern struct urcu_reader alias_rcu_reader; +DEFINE_URCU_TLS_ALIAS(struct urcu_reader, rcu_reader, alias_rcu_reader); static CDS_LIST_HEAD(registry);