Fix: update debug message about weak-hidden symbols
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 23 May 2016 15:37:07 +0000 (11:37 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 23 May 2016 15:55:33 +0000 (11:55 -0400)
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 <mathieu.desnoyers@efficios.com>
liblttng-ust/tracepoint-internal.h
liblttng-ust/tracepoint-weak-test.c
liblttng-ust/tracepoint.c

index 3cc95e566b909fe3b705390af0c14d16018ca4c3..70842382c9036bb97304bec2cc5ac67a1fe2e781 100644 (file)
@@ -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 */
index e691fbb1f352742460c17e29fbf22887882ca160..dad2ece0cb76e04b71531e8efe28778a4f4a3ec3 100644 (file)
  */
 
 /* 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;
 }
index a594d73ddd7bc6a3c893acd3d645635d23bc6c73..db5886009de5f620f24880e884b1345618470a2d 100644 (file)
 #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)
This page took 0.02706 seconds and 4 git commands to generate.