summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-01-03 11:17:47 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-11 16:16:58 +0100
commitc35c352679b729d776df41ec14c0e1177e44db3e (patch)
treee84267471178450948de9ba97e43ccf255f0c0ae /include/linux
parent17e1c100e8f2ce385a5dba58583d69736979df0c (diff)
downloadbarebox-c35c352679b729d776df41ec14c0e1177e44db3e.tar.gz
barebox-c35c352679b729d776df41ec14c0e1177e44db3e.tar.xz
compiler: define __ll_elem for linker list elements
When built with clang + AddressSanitizer, global variables end up with a redzone that breaks linker list elements. The __no_sanitize_address attribute prevents these redzones, but GCC isn't happy about applying it to anything but functions. Therefore define a __ll_elem macro for defining linker list elements that takes care to avoid these redzones when building with clang. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101748.2629927-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler_types.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 9ef8115a39..d925b3da29 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -274,6 +274,12 @@ struct ftrace_likely_data {
#define __cold __attribute__((cold))
#define __section(S) __attribute__((__section__(#S)))
+#ifdef __clang__
+#define __ll_elem(S) __section(S) __used __no_sanitize_address
+#else
+#define __ll_elem(S) __section(S) __used
+#endif
+
#ifdef CONFIG_ENABLE_MUST_CHECK
#define __must_check __attribute__((warn_unused_result))