+/*
+ * Tracepoint dynamic linkage handling (callbacks). Hidden visibility: shared
+ * across objects in a module/main executable. The callbacks are used to
+ * control and check if the destructors should be executed.
+ *
+ * IMPORTANT: this structure is part of the ABI between instrumented
+ * applications and UST. Fields need to be only added at the end, never
+ * reordered, never removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+struct lttng_ust_tracepoint_destructors_syms {
+ uint32_t struct_size;
+
+ void (*tracepoint_disable_destructors)(void);
+ int (*tracepoint_get_destructors_state)(void);
+
+ /* End of base ABI. Fields below should be used after checking struct_size. */
+};
+
+extern struct lttng_ust_tracepoint_destructors_syms tracepoint_destructors_syms;
+extern struct lttng_ust_tracepoint_destructors_syms *tracepoint_destructors_syms_ptr;
+
+struct lttng_ust_tracepoint_destructors_syms tracepoint_destructors_syms
+ __attribute__((weak, visibility("hidden"))) = {
+ .struct_size = sizeof(struct lttng_ust_tracepoint_destructors_syms),
+};
+struct lttng_ust_tracepoint_destructors_syms *tracepoint_destructors_syms_ptr
+ __attribute__((weak, visibility("hidden")));
+
+static inline void tracepoint_disable_destructors(void)
+{
+ if (!tracepoint_dlopen_ptr)
+ tracepoint_dlopen_ptr = &tracepoint_dlopen;
+ if (!tracepoint_destructors_syms_ptr)
+ tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms;
+ if (tracepoint_dlopen_ptr->liblttngust_handle
+ && tracepoint_destructors_syms_ptr->tracepoint_disable_destructors)
+ tracepoint_destructors_syms_ptr->tracepoint_disable_destructors();
+}
+
+#ifndef _LGPL_SOURCE
+static inline void
+__tracepoint__init_urcu_sym(void)
+ lttng_ust_notrace;
+static inline void
+__tracepoint__init_urcu_sym(void)
+{
+ if (!tracepoint_dlopen_ptr)
+ tracepoint_dlopen_ptr = &tracepoint_dlopen;
+ /*
+ * Symbols below are needed by tracepoint call sites and probe
+ * providers.
+ */
+ if (!tracepoint_dlopen_ptr->rcu_read_lock_sym)
+ tracepoint_dlopen_ptr->rcu_read_lock_sym =
+ URCU_FORCE_CAST(void (*)(void),
+ dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+ "tp_rcu_read_lock"));
+ if (!tracepoint_dlopen_ptr->rcu_read_unlock_sym)
+ tracepoint_dlopen_ptr->rcu_read_unlock_sym =
+ URCU_FORCE_CAST(void (*)(void),
+ dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+ "tp_rcu_read_unlock"));
+ if (!tracepoint_dlopen_ptr->rcu_dereference_sym)
+ tracepoint_dlopen_ptr->rcu_dereference_sym =
+ URCU_FORCE_CAST(void *(*)(void *p),
+ dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+ "tp_rcu_dereference_sym"));
+}
+#else
+static inline void
+__tracepoint__init_urcu_sym(void)
+ lttng_ust_notrace;
+static inline void
+__tracepoint__init_urcu_sym(void)
+{
+}
+#endif
+
+static void
+__tracepoints__init(void)
+ lttng_ust_notrace __attribute__((constructor));