|
1 |
| -From 28e98de6638031d0ab539469ab0387a95f2d3316 Mon Sep 17 00:00:00 2001 |
| 1 | +From f5de4c534f03c9d8c81bd35aac8512a5396378a7 Mon Sep 17 00:00:00 2001 |
2 | 2 | From: Nathan Chancellor < [email protected]>
|
3 | 3 | Date: Tue, 25 Sep 2018 13:32:33 -0700
|
4 | 4 | Subject: [PATCH] DO-NOT-UPSTREAM: x86: Avoid warnings/errors due to lack of
|
5 | 5 | asm goto
|
6 | 6 |
|
7 |
| -This isn't strictly required right now and it prevents us from building |
8 |
| -with Clang. It's supposedly in the works though, progress can be tracked |
9 |
| -below. |
| 7 | +We don't want to see an inordinate amount of warning spam from |
| 8 | +the BPF samples and after reverting commits 4a789213c9a5 ("x86 |
| 9 | +uaccess: Introduce __put_user_goto") and a959dc88f9c8 ("Use |
| 10 | +__put_user_goto in __put_user_size() and unsafe_put_user()"), we |
| 11 | +can successfully compile an x86 kernel with Clang. |
| 12 | + |
| 13 | +This is obviously not a long term solution. LLVM/Clang support for |
| 14 | +asm goto can be tracked at the below link. |
10 | 15 |
|
11 | 16 | Link: https://github.com/ClangBuiltLinux/linux/issues/6
|
12 | 17 | Signed-off-by: Nathan Chancellor < [email protected]>
|
13 | 18 | ---
|
14 |
| - arch/x86/Makefile | 3 +-- |
| 19 | + arch/x86/Makefile | 9 +++++---- |
15 | 20 | arch/x86/boot/compressed/Makefile | 3 +++
|
16 | 21 | drivers/firmware/efi/libstub/Makefile | 4 ++++
|
17 |
| - 3 files changed, 8 insertions(+), 2 deletions(-) |
| 22 | + 3 files changed, 12 insertions(+), 4 deletions(-) |
18 | 23 |
|
19 | 24 | diff --git a/arch/x86/Makefile b/arch/x86/Makefile
|
20 |
| -index 75ef499a66e2..bb705df20a68 100644 |
| 25 | +index ce0d0424a53d..094a0f11c943 100644 |
21 | 26 | --- a/arch/x86/Makefile
|
22 | 27 | +++ b/arch/x86/Makefile
|
23 |
| -@@ -301,8 +301,7 @@ vdso_install: |
| 28 | +@@ -235,6 +235,11 @@ ifdef CONFIG_RETPOLINE |
| 29 | + endif |
| 30 | + endif |
| 31 | + |
| 32 | ++# Avoid warnings in arch/x86/include/asm/cpufeature.h when building with Clang |
| 33 | ++ifndef CONFIG_CC_HAS_ASM_GOTO |
| 34 | ++ KBUILD_CFLAGS += -D__BPF_TRACING__ |
| 35 | ++endif |
| 36 | ++ |
| 37 | + archscripts: scripts_basic |
| 38 | + $(Q)$(MAKE) $(build)=arch/x86/tools relocs |
| 39 | + |
| 40 | +@@ -305,10 +310,6 @@ vdso_install: |
| 41 | + |
24 | 42 | archprepare: checkbin
|
25 | 43 | checkbin:
|
26 |
| - ifndef CC_HAVE_ASM_GOTO |
| 44 | +-ifndef CONFIG_CC_HAS_ASM_GOTO |
27 | 45 | - @echo Compiler lacks asm-goto support.
|
28 | 46 | - @exit 1
|
29 |
| -+KBUILD_CFLAGS += -D__BPF_TRACING__ |
30 |
| - endif |
| 47 | +-endif |
31 | 48 | ifdef CONFIG_RETPOLINE
|
32 | 49 | ifeq ($(RETPOLINE_CFLAGS),)
|
| 50 | + @echo "You are building kernel with non-retpoline compiler." >&2 |
33 | 51 | diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
|
34 |
| -index 466f66c8a7f8..deb2a7fef08c 100644 |
| 52 | +index 466f66c8a7f8..000bd188beb0 100644 |
35 | 53 | --- a/arch/x86/boot/compressed/Makefile
|
36 | 54 | +++ b/arch/x86/boot/compressed/Makefile
|
37 | 55 | @@ -38,6 +38,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
|
38 | 56 | KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
39 | 57 | KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
|
40 | 58 | KBUILD_CFLAGS += -Wno-pointer-sign
|
41 |
| -+ifndef CC_HAVE_ASM_GOTO |
| 59 | ++ifndef CONFIG_CC_HAS_ASM_GOTO |
42 | 60 | +KBUILD_CFLAGS += -D__BPF_TRACING__
|
43 | 61 | +endif
|
44 | 62 |
|
45 | 63 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
|
46 | 64 | GCOV_PROFILE := n
|
47 | 65 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
|
48 |
| -index c51627660dbb..167572144766 100644 |
| 66 | +index d9845099635e..68ff33dc075d 100644 |
49 | 67 | --- a/drivers/firmware/efi/libstub/Makefile
|
50 | 68 | +++ b/drivers/firmware/efi/libstub/Makefile
|
51 |
| -@@ -21,6 +21,10 @@ cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ |
| 69 | +@@ -24,6 +24,10 @@ cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ |
52 | 70 |
|
53 | 71 | cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt
|
54 | 72 |
|
55 |
| -+ifndef CC_HAVE_ASM_GOTO |
| 73 | ++ifndef CONFIG_CC_HAS_ASM_GOTO |
56 | 74 | +cflags-$(CONFIG_X86) += -D__BPF_TRACING__
|
57 | 75 | +endif
|
58 | 76 | +
|
59 | 77 | KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
|
60 | 78 | -D__NO_FORTIFY \
|
61 | 79 | $(call cc-option,-ffreestanding) \
|
62 | 80 | --
|
63 |
| -2.20.0 |
| 81 | +2.22.0.rc3 |
64 | 82 |
|
0 commit comments