git: 5a02f004fbac - main - sdt: Disable SDT probes in kernel modules for GCC on aarch64

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 17 Feb 2026 20:48:16 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a02f004fbacee9b2d59b59b11f8910e5736b89c

commit 5a02f004fbacee9b2d59b59b11f8910e5736b89c
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-02-17 20:48:04 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-02-17 20:48:04 +0000

    sdt: Disable SDT probes in kernel modules for GCC on aarch64
    
    For PIC code, the existing assembly constraints do compile on aarch64.
    Some kernel modules build ok using the 'p' constraint with the 'a'
    operand modifier, but not all.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D55166
---
 sys/sys/sdt.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 0be4e9ba6240..26c60831f667 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -212,6 +212,12 @@ struct sdt_tracepoint {
 	STAILQ_ENTRY(sdt_tracepoint) tracepoint_entry;
 };
 
+/* XXX: GCC is not able to compile probes in kernel modules for aarch64. */
+#if !defined(__clang__) && defined(KLD_MODULE) && defined(__aarch64__)
+#undef __sdt_used
+#define __sdt_used	__unused
+#define __SDT_PROBE(prov, mod, func, name, uniq, f, ...)
+#else
 #define __SDT_PROBE(prov, mod, func, name, uniq, f, ...) do {		\
 	__WEAK(__CONCAT(__start_set_, _SDT_TRACEPOINT_SET));		\
 	__WEAK(__CONCAT(__stop_set_, _SDT_TRACEPOINT_SET));		\
@@ -234,6 +240,7 @@ __sdt_probe##uniq:;							\
 		f(_SDT_PROBE_NAME(prov, mod, func, name).id, __VA_ARGS__); \
 	}								\
 } while (0)
+#endif
 #define _SDT_PROBE(prov, mod, func, name, uniq, f, ...)			\
 	__SDT_PROBE(prov, mod, func, name, uniq, f, __VA_ARGS__)
 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)	\