- because it must not require %-sign escaping, as we most certainly \
- have some %-signs in the format string. */ \
- asm volatile ( \
- ".section __markers_strings,\"aw\",@progbits\n\t" \
- "__mstrtab_" XSTR(channel) "_" XSTR(name) "_" XSTR(unique) ":\n\t" \
- "__mstrtab_" XSTR(channel) "_" XSTR(name) "_channel_" XSTR(unique) ":\n\t" \
- ".string \"" XSTR(channel) "\"\n\t" \
- "__mstrtab_" XSTR(channel) "_" XSTR(name) "_name_" XSTR(unique) ":\n\t" \
- ".string \"" XSTR(name) "\"\n\t" \
- "__mstrtab_" XSTR(channel) "_" XSTR(name) "_format_" XSTR(unique) ":\n\t" \
- ".string " XSTR(format) "\n\t" \
- ".previous\n\t" \
- ".section __markers,\"aw\",@progbits\n\t" \
- ".align 8\n\t" \
- _ASM_PTR "__mstrtab_" XSTR(channel) "_" XSTR(name) "_channel_" XSTR(unique) "\n\t" /* channel string */ \
- _ASM_PTR "__mstrtab_" XSTR(channel) "_" XSTR(name) "_name_" XSTR(unique) "\n\t" /* name string */ \
- _ASM_PTR "__mstrtab_" XSTR(channel) "_" XSTR(name) "_format_" XSTR(unique) "\n\t" /* format string */ \
- ".byte 0\n\t" /* state imv */ \
- ".byte 0\n\t" /* ptype */ \
- ".word 0\n\t" /* channel_id */ \
- ".word 0\n\t" /* event_id */ \
- ".align " XSTR(__SIZEOF_POINTER__) "\n\t" /* alignment */ \
- _ASM_PTR "marker_probe_cb\n\t" /* call */ \
- _ASM_PTR "__mark_empty_function\n\t" /* marker_probe_closure single.field1 */ \
- _ASM_PTR "0\n\t" /* marker_probe_closure single.field2 */ \
- _ASM_PTR "0\n\t" /* marker_probe_closure *multi */ \
- _ASM_PTR "0\n\t" /* tp_name */ \
- _ASM_PTR "0\n\t" /* tp_cb */ \
- "__mark_location_" XSTR(unique) ":\n\t" \
- _ASM_PTR "(1f)\n\t" /* location */ \
- ".previous\n\t" \
- "1:\n\t" \
- ); \
- asm volatile ( \
- "mov ""__mstrtab_" XSTR(channel) "_" XSTR(name) "_" XSTR(unique) ", %[pmark_struct]\n\t" \
- : [pmark_struct] "=r" (__pmark_##channel##_##name) \
- ); \
- \
- save_registers(®s)
-
-
-#define DEFINE_MARKER(channel, name, format) \
- _DEFINE_MARKER(channel, name, NULL, NULL, format, __COUNTER__)
-
-#define DEFINE_MARKER_TP(channel, name, tp_name, tp_cb, format) \
- _DEFINE_MARKER(channel, name, #tp_name, tp_cb, format, __COUNTER__)
+ * because it must not require %-sign escaping, as we most certainly \
+ * have some %-signs in the format string. \
+ */ \
+ asm volatile ( \
+ /* We only define these symbols if they have not yet been defined. Indeed, \
+ * if two markers with the same channel/name are on the same line, they \
+ * will try to create the same symbols, resulting in a conflict. This \
+ * is not unusual as it can be the result of function inlining. \
+ */ \
+ ".ifndef __mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) "\n\t" \
+ /*".section __ust_marker_strings\n\t"*/ \
+ ".section __ust_marker_strings,\"aw\"\n\t" \
+ "__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ":\n\t" \
+ ".string \"" __stringify(channel) "\"\n\t" \
+ "__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ":\n\t" \
+ ".string \"" __stringify(name) "\"\n\t" \
+ "__mstrtab_" __stringify(channel) "_" __stringify(name) "_format_" __stringify(unique) ":\n\t" \
+ ".string " "\"" format "\"" "\n\t" \
+ ".previous\n\t" \
+ ".endif\n\t" \
+ ); \
+ asm volatile ( \
+ /*".section __ust_marker\n\t"*/ \
+ ".section __ust_marker,\"aw\"\n\t" \
+ "2:\n\t" \
+ _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ")\n\t" /* channel string */ \
+ _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ")\n\t" /* name string */ \
+ _ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_format_" __stringify(unique) ")\n\t" /* format string */ \
+ ".byte 0\n\t" /* state imv */ \
+ ".byte 0\n\t" /* ptype */ \
+ ".hword 0\n\t" /* channel_id */ \
+ ".hword 0\n\t" /* event_id */ \
+ ".balign " __stringify(__WORDSIZE) " / 8\n\t" /* alignment */ \
+ _ASM_PTR "(ust_marker_probe_cb)\n\t" /* call */ \
+ _ASM_PTR "(__ust_marker_empty_function)\n\t" /* ust_marker_probe_closure single.field1 */ \
+ _ASM_PTR "0\n\t" /* ust_marker_probe_closure single.field2 */ \
+ _ASM_PTR "0\n\t" /* ust_marker_probe_closure *multi */ \
+ _ASM_PTR "0\n\t" /* tp_name */ \
+ _ASM_PTR "0\n\t" /* tp_cb */ \
+ _ASM_PTR "(1f)\n\t" /* location */ \
+ ".previous\n\t" \
+ /*".section __ust_marker_ptrs\n\t"*/ \
+ ".section __ust_marker_ptrs,\"aw\"\n\t" \
+ _ASM_PTR "(2b)\n\t" \
+ ".previous\n\t" \
+ "1:\n\t" \
+ ARCH_COPY_ADDR("%[outptr]") \
+ : [outptr] "=r" (m) ); \
+ \
+ save_registers(&__ust_marker_regs)
+
+
+#define DEFINE_UST_MARKER(name, format, unique, m) \
+ _DEFINE_UST_MARKER(ust, name, NULL, NULL, format, unique, m)
+
+#define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format) \
+ _DEFINE_UST_MARKER_TP(ust, name, #tp_name, tp_cb, format)
+
+#define _DEFINE_UST_MARKER_TP(channel, name, tp_name_str, tp_cb, format)\
+ static const char __mstrtab_##channel##_##name[] \
+ __attribute__((section("__ust_marker_strings"))) \
+ = #channel "\0" #name "\0" format; \
+ static struct ust_marker __ust_marker_##channel##_##name\
+ __attribute__((section("__ust_marker"))) = \
+ { __mstrtab_##channel##_##name, \
+ &__mstrtab_##channel##_##name[sizeof(#channel)],\
+ &__mstrtab_##channel##_##name[sizeof(#channel) + sizeof(#name)], \
+ 0, 0, 0, 0, ust_marker_probe_cb, \
+ { __ust_marker_empty_function, NULL}, \
+ NULL, tp_name_str, tp_cb }; \
+ static struct ust_marker * const __ust_marker_ptr_##channel##_##name \
+ __attribute__((used, section("__ust_marker_ptrs"))) = \
+ &__ust_marker_##channel##_##name;