Fix: ust-urcu: allow legacy applications without _LGPL_SOURCE
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Dec 2020 15:07:24 +0000 (10:07 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Dec 2020 15:07:35 +0000 (10:07 -0500)
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 <mathieu.desnoyers@efficios.com>
Change-Id: Iaa574647442254b34682ea36b858a30e2ecdf98e

liblttng-ust/tracepoint.c

index cf7cf63c992d16e90647aa5856d82059bf05c2db..ce7dbbb283947f608978d4948c2df62656f1275a 100644 (file)
@@ -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),
This page took 0.026732 seconds and 5 git commands to generate.