diff options
author | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | 2019-08-02 12:37:56 +0200 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2019-12-30 11:08:28 +0900 |
commit | fcec2046b384c6416ba7abd18388e0807b902b76 (patch) | |
tree | 62f85c1afe36e7abe3bd6d4e2778e060d0ee606b | |
parent | bdbf0601cd2e4512844ddc30ee3bf1016d5bc827 (diff) | |
download | linux-artik7-fcec2046b384c6416ba7abd18388e0807b902b76.tar.gz linux-artik7-fcec2046b384c6416ba7abd18388e0807b902b76.tar.bz2 linux-artik7-fcec2046b384c6416ba7abd18388e0807b902b76.zip |
Backport minimal compiler_attributes.h to support GCC 9
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>
[sw0312.kim: cherry-pick from stable linux-4.4.y commit edc966de8725 for gcc 9 build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I78e4df7e07fa807302876d9baf5fb0de4a7fb0bb
-rw-r--r-- | include/linux/compiler.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 0db1fa621d8a..b6c57751081f 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -52,6 +52,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 |