From 0319f2601355d8a8d5635e9a195845ea340c8ae1 Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Sun, 20 Sep 2015 20:33:19 +0200 Subject: [PATCH] x86: boot: llvmlinux: Workaround LLVM Bug PR3997 For more details see [1]. [1] https://llvm.org/bugs/show_bug.cgi?id=3997 --- arch/x86/boot/memory.c | 6 ++++++ arch/x86/boot/string.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index db75d07c3645..d49115f80fbb 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c @@ -64,7 +64,13 @@ static int detect_memory_e820(void) break; } +/* Workaround LLVM Bug PR3997 */ +#ifdef __clang__ + memcpy(desc, &buf, sizeof(*desc)); + desc++; +#else *desc++ = buf; +#endif /* __clang__ */ count++; } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map)); diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h index 725e820602b1..31a431e9d4e2 100644 --- a/arch/x86/boot/string.h +++ b/arch/x86/boot/string.h @@ -14,8 +14,11 @@ int memcmp(const void *s1, const void *s2, size_t len); * Access builtin version by default. If one needs to use optimized version, * do "undef memcpy" in .c file and link against right string.c */ +/* Workaround LLVM Bug PR3997 */ +#ifndef __clang__ #define memcpy(d,s,l) __builtin_memcpy(d,s,l) #define memset(d,c,l) __builtin_memset(d,c,l) #define memcmp __builtin_memcmp +#endif /* __clang__ */ #endif /* BOOT_STRING_H */ -- 2.9.0