1 --- a/tools/scripts/Makefile.include
2 +++ b/tools/scripts/Makefile.include
3 @@ -72,8 +72,6 @@ $(call allow-override,CXX,$(CROSS_COMPIL
4 $(call allow-override,STRIP,$(CROSS_COMPILE)strip)
7 -CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
10 HOSTAR ?= $(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX)
11 HOSTCC ?= $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
12 @@ -84,6 +82,9 @@ HOSTCC ?= gcc
16 +CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
17 +HOSTCC_NO_CLANG := $(shell $(HOSTCC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
19 # Some tools require Clang, LLC and/or LLVM utils
22 @@ -92,8 +93,9 @@ LLVM_OBJCOPY ?= llvm-objcopy
23 LLVM_STRIP ?= llvm-strip
25 ifeq ($(CC_NO_CLANG), 1)
26 -EXTRA_WARNINGS += -Wstrict-aliasing=3
28 + ifeq ($(HOSTCC_NO_CLANG), 1)
29 + EXTRA_WARNINGS += -Wstrict-aliasing=3
31 else ifneq ($(CROSS_COMPILE),)
32 # Allow userspace to override CLANG_CROSS_FLAGS to specify their own
33 # sysroots and flags or to avoid the GCC call in pure Clang builds.
34 --- a/tools/include/linux/types.h
35 +++ b/tools/include/linux/types.h
36 @@ -56,6 +56,7 @@ typedef __s8 s8;
43 typedef __u16 __bitwise __le16;
44 --- a/tools/objtool/include/objtool/objtool.h
45 +++ b/tools/objtool/include/objtool/objtool.h
48 #include <objtool/elf.h>
51 #define __weak __attribute__((weak))
54 --- a/tools/include/asm-generic/bitops/fls.h
55 +++ b/tools/include/asm-generic/bitops/fls.h
57 #ifndef _ASM_GENERIC_BITOPS_FLS_H_
58 #define _ASM_GENERIC_BITOPS_FLS_H_
63 * fls - find last (most-significant) bit set
64 * @x: the word to search
66 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
69 +#define fls __linux_fls
70 static __always_inline int fls(unsigned int x)
73 --- a/tools/lib/string.c
74 +++ b/tools/lib/string.c
75 @@ -96,6 +96,7 @@ int strtobool(const char *s, bool *res)
76 * If libc has strlcpy() then that version will override this
81 #pragma clang diagnostic push
82 #pragma clang diagnostic ignored "-Wignored-attributes"
83 @@ -114,6 +115,7 @@ size_t __weak strlcpy(char *dest, const
85 #pragma clang diagnostic pop
90 * skip_spaces - Removes leading whitespace from @str.