From: Mathieu Desnoyers Date: Mon, 23 May 2016 15:37:07 +0000 (-0400) Subject: Fix: update debug message about weak-hidden symbols X-Git-Tag: v2.7.5~24 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=490346239d3df64bd3cda9ad88714b578d55412a;p=lttng-ust.git Fix: update debug message about weak-hidden symbols We actually deal OK with compilers that treats weak-hidden symbols as different addresses between compile units part of the same module. Simply report this without statement on whether or not the compiler producing this code is broken. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/tracepoint-internal.h b/liblttng-ust/tracepoint-internal.h index 3cc95e56..70842382 100644 --- a/liblttng-ust/tracepoint-internal.h +++ b/liblttng-ust/tracepoint-internal.h @@ -51,6 +51,8 @@ static inline void tracepoint_synchronize_unregister(void) extern void init_tracepoint(void); extern void exit_tracepoint(void); -void *lttng_ust_tp_check_weak_hidden(void); +void *lttng_ust_tp_check_weak_hidden1(void); +void *lttng_ust_tp_check_weak_hidden2(void); +void *lttng_ust_tp_check_weak_hidden3(void); #endif /* _LTTNG_TRACEPOINT_INTERNAL_H */ diff --git a/liblttng-ust/tracepoint-weak-test.c b/liblttng-ust/tracepoint-weak-test.c index e691fbb1..dad2ece0 100644 --- a/liblttng-ust/tracepoint-weak-test.c +++ b/liblttng-ust/tracepoint-weak-test.c @@ -17,10 +17,26 @@ */ /* Test compiler support for weak symbols with hidden visibility. */ -char __tracepoint_test_symbol[9] __attribute__((weak, visibility("hidden"))); +int __tracepoint_test_symbol1 __attribute__((weak, visibility("hidden"))); +void *__tracepoint_test_symbol2 __attribute__((weak, visibility("hidden"))); +struct { + char a[24]; +} __tracepoint_test_symbol3 __attribute__((weak, visibility("hidden"))); __attribute__((visibility("hidden"))) -void *lttng_ust_tp_check_weak_hidden(void) +void *lttng_ust_tp_check_weak_hidden1(void) { - return __tracepoint_test_symbol; + return &__tracepoint_test_symbol1; +} + +__attribute__((visibility("hidden"))) +void *lttng_ust_tp_check_weak_hidden2(void) +{ + return &__tracepoint_test_symbol2; +} + +__attribute__((visibility("hidden"))) +void *lttng_ust_tp_check_weak_hidden3(void) +{ + return &__tracepoint_test_symbol3; } diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index a594d73d..db588600 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -44,7 +44,11 @@ #include "error.h" /* Test compiler support for weak symbols with hidden visibility. */ -char __tracepoint_test_symbol[9] __attribute__((weak, visibility("hidden"))); +int __tracepoint_test_symbol1 __attribute__((weak, visibility("hidden"))); +void *__tracepoint_test_symbol2 __attribute__((weak, visibility("hidden"))); +struct { + char a[24]; +} __tracepoint_test_symbol3 __attribute__((weak, visibility("hidden"))); /* Set to 1 to enable tracepoint debug output */ static const int tracepoint_debug; @@ -814,10 +818,18 @@ int tracepoint_unregister_lib(struct lttng_ust_tracepoint * const *tracepoints_s */ 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."); + DBG("Your compiler treats weak symbols with hidden visibility for integer objects as %s between compile units part of the same module.", + &__tracepoint_test_symbol1 == lttng_ust_tp_check_weak_hidden1() ? + "SAME address" : + "DIFFERENT addresses"); + DBG("Your compiler treats weak symbols with hidden visibility for pointer objects as %s between compile units part of the same module.", + &__tracepoint_test_symbol2 == lttng_ust_tp_check_weak_hidden2() ? + "SAME address" : + "DIFFERENT addresses"); + DBG("Your compiler treats weak symbols with hidden visibility for 24-byte structure objects as %s between compile units part of the same module.", + &__tracepoint_test_symbol3 == lttng_ust_tp_check_weak_hidden3() ? + "SAME address" : + "DIFFERENT addresses"); } void init_tracepoint(void)