aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>2019-08-02 12:37:56 +0200
committerJulian Veit <claymore1298@gmail.com>2020-12-08 17:42:58 +0100
commitbe6d50a2c7e51b82257ab8174ce33fc2506763c8 (patch)
tree7238d1e8c1a495dec9fe523c08ca7d9221382332
parentb06cff64bc8cf5db2f7da372a7e022ccb9432abd (diff)
Backport minimal compiler_attributes.h to support GCC 9r11.0
This adds support for __copy to v4.9.y so that we can use it in init/exit_module to avoid -Werror=missing-attributes errors on GCC 9. Link: https://lore.kernel.org/lkml/259986242.BvXPX32bHu@devpool35/ Cc: <stable@vger.kernel.org> Suggested-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Change-Id: Ibaca0389f344f776fa69f0dff9d59a3f1191c133
-rw-r--r--include/linux/compiler.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 42ab2f2e7e9..2831e6ff9c2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -48,6 +48,22 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#ifdef __KERNEL__
+/*
+ * Minimal backport of compiler_attributes.h to add support for __copy
+ * to v4.9.y so that we can use it in init/exit_module to avoid
+ * -Werror=missing-attributes errors on GCC 9.
+ */
+#ifndef __has_attribute
+# define __has_attribute(x) __GCC4_has_attribute_##x
+# define __GCC4_has_attribute___copy__ 0
+#endif
+
+#if __has_attribute(__copy__)
+# define __copy(symbol) __attribute__((__copy__(symbol)))
+#else
+# define __copy(symbol)
+#endif
+
#ifdef __GNUC__
#include <linux/compiler-gcc.h>
#endif