x86/boot: #undef memcpy etc in string.c
PATCH RESEND 1/1 x86/boot: #undef memcpy etc in string.c
From: Michael Davidson <[email protected]>
undef memcpy and friends in boot/string.c so that the functions defined here will have the correct names, otherwise we end up up trying to redefine __builtin_memcpy etc. Surprisingly, gcc allows this (and, helpfully, discards the __builtin_ prefix from the function name when compiling it), but clang does not.
Adding these #undef's appears to preserve what I assume was the original intent of the code.
---
Original post: https://lkml.org/lkml/2017/3/16/1035
arch/x86/boot/string.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/boot/string.c +9 -0
@@ -16,6 +16,15 @@#include "ctype.h" #include "string.h" +/* +* Undef these macros so that the functions that we provide +* here will have the correct names regardless of how string.h +* may have chosen to #define them. +*/ +#undef memcpy +#undef memset +#undef memcmp +int memcmp (const void *s1,const void *s2,size_t len) {bool diff;
Signature · 1 line
2.14.0.rc0.284.gd933b75aa4-goog
tip-bot for Michael Davidson
merge bot[tip:x86/urgent] x86/boot: #undef memcpy() et al in string.c
x86/boot: #undef memcpy() et al in string.c
Commit-ID: 18d5e6c34a8eda438d5ad8b3b15f42dab01bf05d Gitweb: http://git.kernel.org/tip/18d5e6c34a8eda438d5ad8b3b15f42dab01bf05d Author: Michael Davidson <[email protected]> AuthorDate: Mon, 24 Jul 2017 16:51:55 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 25 Jul 2017 11:13:55 +0200
x86/boot: #undef memcpy() et al in string.c
undef memcpy() and friends in boot/string.c so that the functions defined here will have the correct names, otherwise we end up up trying to redefine __builtin_memcpy() etc.
Surprisingly, GCC allows this (and, helpfully, discards the __builtin_ prefix from the function name when compiling it), but clang does not.
Adding these #undef's appears to preserve what I assume was the original intent of the code.
--- arch/x86/boot/string.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/boot/string.c +9 -0
@@ -16,6 +16,15 @@#include "ctype.h" #include "string.h" +/* +* Undef these macros so that the functions that we provide +* here will have the correct names regardless of how string.h +* may have chosen to #define them. +*/ +#undef memcpy +#undef memset +#undef memcmp +int memcmp (const void *s1,const void *s2,size_t len) {bool diff;