--- /dev/null
+/*
+ * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Test compiler support for weak symbols with hidden visibility. */
+char __tracepoint_test_symbol[9] __attribute__((weak, visibility("hidden")));
+
+__attribute__((visibility("hidden")))
+void *lttng_ust_tp_check_weak_hidden(void)
+{
+ return __tracepoint_test_symbol;
+}
#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;
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)