summaryrefslogtreecommitdiff
path: root/include/linux/instruction_pointer.h
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-06-30 10:16:00 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2026-06-30 10:16:00 +0200
commit827b9aabd3ea3e96d5e48abed9f44dbd1e550d4e (patch)
tree845a97a83f20fe0585840a66d9eed8fcf1286772 /include/linux/instruction_pointer.h
parent3b3bce4a692ac60d9f4a341e6b597dd1fd0a28f9 (diff)
parentdc59e4fea9d83f03bad6bddf3fa2e52491777482 (diff)
Merge drm/drm-next into drm-misc-next
Backmerging to get drm-misc-next to v7.2-rc1. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'include/linux/instruction_pointer.h')
-rw-r--r--include/linux/instruction_pointer.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/instruction_pointer.h b/include/linux/instruction_pointer.h
index aa0b3ffea935..ea5bc756bd99 100644
--- a/include/linux/instruction_pointer.h
+++ b/include/linux/instruction_pointer.h
@@ -8,6 +8,30 @@
#ifndef _THIS_IP_
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
+/*
+ * The current generic definition of _THIS_IP_ is considered broken by GCC [1]
+ * and Clang [2]. In particular, the address of a label is only expected to be
+ * used with a computed goto.
+ *
+ * [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120071
+ * [2] https://github.com/llvm/llvm-project/issues/138272
+ *
+ * Mark it as broken, so that appropriate fallback options can be implemented
+ * for architectures that do not define their own _THIS_IP_.
+ */
+#define HAS_BROKEN_THIS_IP
+#endif
+
+/*
+ * _CODE_LOCATION_ provides a unique identifier for the current code location.
+ * When _THIS_IP_ is broken (generic version), we fall back to a static marker
+ * which guarantees uniqueness and resolves to a constant address at link time,
+ * avoiding runtime overhead and compiler optimizations breaking it.
+ */
+#ifdef HAS_BROKEN_THIS_IP
+#define _CODE_LOCATION_ ({ static const char __here; (unsigned long)&__here; })
+#else
+#define _CODE_LOCATION_ _THIS_IP_
#endif
#endif /* _LINUX_INSTRUCTION_POINTER_H */