public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compiler-gcc.h: Disable __retain on gcc-11
@ 2024-09-24 13:55 Geert Uytterhoeven
  2024-09-24 17:21 ` Miguel Ojeda
  2024-09-24 17:29 ` Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2024-09-24 13:55 UTC (permalink / raw)
  To: Tony Ambardar, Daniel Borkmann, Miguel Ojeda, Jiri Olsa,
	Andrew Morton, Arnd Bergmann
  Cc: linux-kernel, Geert Uytterhoeven

All my gcc-11 compilers (Ubuntu 11.4.0-1ubuntu1~22.04) claim to support
the __retain__ attribute, but only riscv64-linux-gnu-gcc-11 and
x86_64-linux-gnu-gcc-11 (not x86_64-linux-gnux32-gcc-11!) actually do.
The arm-linux-gnueabi-gcc-11.5.0 compiler from kernel.org crosstool
fails in the same way:

    error: ‘retain’ attribute ignored [-Werror=attributes]

All my gcc-12 compilers seem to support the attribute.

Play it safe, and disable __retain unconditionally on gcc-11.

Fixes: 0a5d3258d7c97295 ("compiler_types.h: Define __retain for __attribute__((__retain__))")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 include/linux/compiler-gcc.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index f805adaa316e9a21..bedeb76b63a34745 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -145,3 +145,12 @@
 #if GCC_VERSION < 90100
 #undef __alloc_size__
 #endif
+
+/*
+ * Most 11.x compilers claim to support it, but only riscv64-linux-gnu-gcc and
+ * x86_64-linux-gnu-gcc actually do.
+ */
+#if GCC_VERSION < 120000
+#undef __retain
+#define __retain
+#endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-01 17:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 13:55 [PATCH] compiler-gcc.h: Disable __retain on gcc-11 Geert Uytterhoeven
2024-09-24 17:21 ` Miguel Ojeda
2024-09-24 18:30   ` Geert Uytterhoeven
2024-09-30 23:50     ` Tony Ambardar
2024-10-01 15:32     ` Miguel Ojeda
2024-09-24 17:29 ` Andreas Schwab
2024-09-30 23:51   ` Tony Ambardar
2024-10-01 17:45     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox