public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86/boot: define CC_HAVE_ASM_GOTO
@ 2018-09-27 20:47 ndesaulniers
  2018-09-27 21:40 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: ndesaulniers @ 2018-09-27 20:47 UTC (permalink / raw)
  To: bp, mingo, tglx
  Cc: Nick Desaulniers, H. Peter Anvin, x86, Kirill A. Shutemov,
	Masahiro Yamada, Greg Kroah-Hartman, Matthias Kaehlcke, Kees Cook,
	Cao jin, linux-kernel

Early prototypes of Clang with asm goto support produce 6 instances of
the following warning:

In file included from arch/x86/boot/compressed/misc.h:20:
In file included from ./include/linux/elf.h:5:
In file included from ./arch/x86/include/asm/elf.h:8:
In file included from ./include/linux/thread_info.h:38:
In file included from ./arch/x86/include/asm/thread_info.h:53:
./arch/x86/include/asm/cpufeature.h:150:2: warning: "Compiler lacks
ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
[-W#warnings]
your compiler arguments"
 ^

Since 6 files under arch/x86/boot/compressed/ include
arch/x86/boot/compressed/misc.h AND
arch/x86/boot/compressed/Makefile happens to redefine KBUILD_CFLAGS,
which set these variables in the top level MAKEFILE.

Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
v1 -> v2:
  Updated commit message to provide more context as per Borislav.

 arch/x86/boot/compressed/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 28764dacf018..158c0b4e178a 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -56,6 +56,13 @@ KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
 endif
 LDFLAGS_vmlinux := -T
 
+# check for 'asm goto'
+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
+  CC_HAVE_ASM_GOTO := 1
+  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
 hostprogs-y	:= mkpiggy
 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
 
-- 
2.19.0.605.g01d371f741-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-01 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 20:47 [PATCH v2] x86/boot: define CC_HAVE_ASM_GOTO ndesaulniers
2018-09-27 21:40 ` Kees Cook
2018-09-27 21:51 ` Borislav Petkov
2018-09-27 22:17   ` Nick Desaulniers
2018-10-01 17:32     ` Borislav Petkov
2018-10-01 17:38 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox