X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Ftracepoint.c;h=a594d73ddd7bc6a3c893acd3d645635d23bc6c73;hb=18d24538d964e8d3b86df9fa68d44ba136a4d8c0;hp=5fd1126aa42d3b03c5709994aaad61c4ddaa11ae;hpb=73de71c37c352edfcd67a9122d4b9eb1347a5f66;p=lttng-ust.git diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index 5fd1126a..a594d73d 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -43,6 +43,9 @@ #include "jhash.h" #include "error.h" +/* Test compiler support for weak symbols with hidden visibility. */ +char __tracepoint_test_symbol[9] __attribute__((weak, visibility("hidden"))); + /* Set to 1 to enable tracepoint debug output */ static const int tracepoint_debug; static int initialized; @@ -803,11 +806,26 @@ int tracepoint_unregister_lib(struct lttng_ust_tracepoint * const *tracepoints_s return 0; } +/* + * Report in debug message whether the compiler correctly supports weak + * hidden symbols. This test checks that the address associated with two + * weak symbols with hidden visibility is the same when declared within + * two compile units part of the same module. + */ +static void check_weak_hidden(void) +{ + DBG("Your compiler support for weak symbols with hidden visibility is %s", + __tracepoint_test_symbol == lttng_ust_tp_check_weak_hidden() ? + "OK" : + "BROKEN. Please upgrade or fix your compiler to use LTTng-UST tracepoints."); +} + void init_tracepoint(void) { if (uatomic_xchg(&initialized, 1) == 1) return; init_usterr(); + check_weak_hidden(); } void exit_tracepoint(void)