From: Mathieu Desnoyers Date: Thu, 10 Dec 2020 15:07:24 +0000 (-0500) Subject: Fix: ust-urcu: allow legacy applications without _LGPL_SOURCE X-Git-Tag: v2.13.0-rc1~411 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a58c831a07058055a6e14d09d0e5a3f40f47eae3;p=lttng-ust.git Fix: ust-urcu: allow legacy applications without _LGPL_SOURCE Allow legacy instrumented applications without _LGPL_SOURCE to use the legacy v1 tracepoint registration API without requiring the liburcu-bp symbols to be present in the symbol table. Signed-off-by: Mathieu Desnoyers Change-Id: Iaa574647442254b34682ea36b858a30e2ecdf98e --- diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index cf7cf63c..ce7dbbb2 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -175,8 +175,22 @@ static void lttng_ust_tracepoint_set_v1_used(void) if (!lttng_ust_liburcu_bp_synchronize_rcu) { lttng_ust_liburcu_bp_synchronize_rcu = URCU_FORCE_CAST(void (*)(void), dlsym(RTLD_DEFAULT, "synchronize_rcu_bp")); + /* + * Allow legacy applications compiled without + * _LGPL_SOURCE to use v1 API. Those are not + * required to be linked against liburcu-bp, + * so in those situations the liburcu-bp symbols + * are not present in the global symbol table, + * and we do not need to call urcu-bp + * synchronize. + * + * However, nothing prevents a _LGPL_SOURCE + * instrumented library loaded afterwards to + * require liburcu-bp, so we need to check again + * in that situation. + */ if (!lttng_ust_liburcu_bp_synchronize_rcu) - abort(); + return; } if (!lttng_ust_liburcu_bp_before_fork) { lttng_ust_liburcu_bp_before_fork = URCU_FORCE_CAST(void (*)(void),