diff mbox

[RFC,lttng-ust,v2] Fix: allow non-LGPL modules to use tracepoints

Message ID 1466024069-20156-1-git-send-email-mathieu.desnoyers@efficios.com
State RFC, archived
Headers show

Commit Message

Mathieu Desnoyers June 15, 2016, 8:54 p.m. UTC
Non-LGPL modules that use tracepoint instrumentation, but have no
compile unit defining either TRACEPOINT_DEFINE or
TRACEPOINT_CREATE_PROBES fail to build due to undefined reference to
`tracepoint_dlopen_ptr'.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 include/lttng/tracepoint.h | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Comments

Sebastien Boisvert June 15, 2016, 9:22 p.m. UTC | #1
It links now.

Tested-by: Sebastien Boisvert <sboisvert at gydle.com>

On 06/15/2016 04:54 PM, Mathieu Desnoyers wrote:
> Non-LGPL modules that use tracepoint instrumentation, but have no
> compile unit defining either TRACEPOINT_DEFINE or
> TRACEPOINT_CREATE_PROBES fail to build due to undefined reference to
> `tracepoint_dlopen_ptr'.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
>  include/lttng/tracepoint.h | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
> index 03bc913..d469765 100644
> --- a/include/lttng/tracepoint.h
> +++ b/include/lttng/tracepoint.h
> @@ -241,17 +241,6 @@ static inline void tracepoint_disable_destructors(void)
>  	__tracepoints__disable_destructors = 1;
>  }
>  
> -#if defined(TRACEPOINT_DEFINE) || defined(TRACEPOINT_CREATE_PROBES)
> -
> -/*
> - * These weak symbols, the constructor, and destructor take care of
> - * registering only _one_ instance of the tracepoints per shared-ojbect
> - * (or for the whole main program).
> - */
> -int __tracepoint_registered
> -	__attribute__((weak, visibility("hidden")));
> -int __tracepoint_ptrs_registered
> -	__attribute__((weak, visibility("hidden")));
>  struct lttng_ust_tracepoint_dlopen tracepoint_dlopen
>  	__attribute__((weak, visibility("hidden")));
>  /*
> @@ -304,6 +293,18 @@ __tracepoint__init_urcu_sym(void)
>  }
>  #endif
>  
> +#if defined(TRACEPOINT_DEFINE) || defined(TRACEPOINT_CREATE_PROBES)
> +
> +/*
> + * These weak symbols, the constructor, and destructor take care of
> + * registering only _one_ instance of the tracepoints per shared-ojbect
> + * (or for the whole main program).
> + */
> +int __tracepoint_registered
> +	__attribute__((weak, visibility("hidden")));
> +int __tracepoint_ptrs_registered
> +	__attribute__((weak, visibility("hidden")));
> +
>  static void lttng_ust_notrace __attribute__((constructor))
>  __tracepoints__init(void);
>  static void
>
diff mbox

Patch

diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
index 03bc913..d469765 100644
--- a/include/lttng/tracepoint.h
+++ b/include/lttng/tracepoint.h
@@ -241,17 +241,6 @@  static inline void tracepoint_disable_destructors(void)
 	__tracepoints__disable_destructors = 1;
 }
 
-#if defined(TRACEPOINT_DEFINE) || defined(TRACEPOINT_CREATE_PROBES)
-
-/*
- * These weak symbols, the constructor, and destructor take care of
- * registering only _one_ instance of the tracepoints per shared-ojbect
- * (or for the whole main program).
- */
-int __tracepoint_registered
-	__attribute__((weak, visibility("hidden")));
-int __tracepoint_ptrs_registered
-	__attribute__((weak, visibility("hidden")));
 struct lttng_ust_tracepoint_dlopen tracepoint_dlopen
 	__attribute__((weak, visibility("hidden")));
 /*
@@ -304,6 +293,18 @@  __tracepoint__init_urcu_sym(void)
 }
 #endif
 
+#if defined(TRACEPOINT_DEFINE) || defined(TRACEPOINT_CREATE_PROBES)
+
+/*
+ * These weak symbols, the constructor, and destructor take care of
+ * registering only _one_ instance of the tracepoints per shared-ojbect
+ * (or for the whole main program).
+ */
+int __tracepoint_registered
+	__attribute__((weak, visibility("hidden")));
+int __tracepoint_ptrs_registered
+	__attribute__((weak, visibility("hidden")));
+
 static void lttng_ust_notrace __attribute__((constructor))
 __tracepoints__init(void);
 static void