X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fust%2Ftracepoint.h;h=49a9b6e65bcc26807b57712de321df0e6abcc069;hb=8b6984b8b5c6fb912c2cf3495d322f01a5bbc8eb;hp=8be8697942f567c6890735ae4dc93bfb62df6bf7;hpb=fc1caebc8a71283c7766549ebed47300d1b52945;p=lttng-ust.git diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h index 8be86979..49a9b6e6 100644 --- a/include/ust/tracepoint.h +++ b/include/ust/tracepoint.h @@ -220,17 +220,20 @@ extern int tracepoint_register_lib(struct tracepoint * const *tracepoints_start, extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start); #define TRACEPOINT_LIB \ - extern struct tracepoint * const __start___tracepoints[] __attribute__((weak, visibility("hidden"))); \ - extern struct tracepoint * const __stop___tracepoints[] __attribute__((weak, visibility("hidden"))); \ - static void __attribute__((constructor)) __tracepoints__init(void) \ - { \ - tracepoint_register_lib(__start___tracepoints, \ - (((long)__stop___tracepoints)-((long)__start___tracepoints)) / sizeof(*__start___tracepoints)); \ - } \ - \ - static void __attribute__((destructor)) __tracepoints__destroy(void) \ - { \ - tracepoint_unregister_lib(__start___tracepoints); \ + extern struct tracepoint * const __start___tracepoints_ptrs[] __attribute__((weak, visibility("hidden"))); \ + extern struct tracepoint * const __stop___tracepoints_ptrs[] __attribute__((weak, visibility("hidden"))); \ + static struct tracepoint * const __tracepoint_ptr_dummy \ + __attribute__((used, section("__tracepoints_ptrs"))) = NULL; \ + static void __attribute__((constructor)) __tracepoints__init(void) \ + { \ + tracepoint_register_lib(__start___tracepoints_ptrs, \ + __stop___tracepoints_ptrs - \ + __start___tracepoints_ptrs); \ + } \ + \ + static void __attribute__((destructor)) __tracepoints__destroy(void) \ + { \ + tracepoint_unregister_lib(__start___tracepoints_ptrs); \ } @@ -376,6 +379,8 @@ extern int trace_event_unregister_lib(struct trace_event * const *start_trace_ev __attribute__((weak, visibility("hidden"))); \ extern struct trace_event * const __stop___trace_events_ptrs[] \ __attribute__((weak, visibility("hidden"))); \ + static struct trace_event * const __event_ptrs_dummy \ + __attribute__((used, section("__trace_events_ptrs"))) = NULL; \ static void __attribute__((constructor)) \ __trace_events__init(void) \ { \