LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Makefile: disable PIE before testing asm goto
@ 2018-05-16 5:51 Michal Kubecek
2018-05-16 8:16 ` Peter Zijlstra
2018-05-17 13:34 ` Masahiro Yamada
0 siblings, 2 replies; 3+ messages in thread
From: Michal Kubecek @ 2018-05-16 5:51 UTC (permalink / raw)
To: Masahiro Yamada, Michal Marek
Cc: linux-kbuild, linux-kernel, Peter Zijlstra, Andreas Faerber
Since commit e501ce957a78 ("x86: Force asm-goto"), aarch64 build on
distributions which enable PIE by default (e.g. openSUSE Tumbleweed) does
not detect support for asm goto correctly. The problem is that ARM specific
part of scripts/gcc-goto.sh fails with PIE even with recent gcc versions.
Moving the asm goto detection up in Makefile put it before the place where
we disable PIE. As a result, kernel is built without jump label support.
Move the lines disabling PIE before the asm goto test to make it work.
Fixes: e501ce957a78 ("x86: Force asm-goto")
Reported-by: Andreas Faerber <afaerber@suse.com>
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index ba3106b36597..5532a15c4781 100644
--- a/Makefile
+++ b/Makefile
@@ -500,6 +500,9 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
export RETPOLINE_CFLAGS
+KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
+
# check for 'asm goto'
ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
CC_HAVE_ASM_GOTO := 1
@@ -621,8 +624,6 @@ endif # $(dot-config)
# Defaults to vmlinux, but the arch makefile usually adds further targets
all: vmlinux
-KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
-KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
export CFLAGS_GCOV CFLAGS_KCOV
--
2.16.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: disable PIE before testing asm goto
2018-05-16 5:51 [PATCH] Makefile: disable PIE before testing asm goto Michal Kubecek
@ 2018-05-16 8:16 ` Peter Zijlstra
2018-05-17 13:34 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2018-05-16 8:16 UTC (permalink / raw)
To: Michal Kubecek
Cc: Masahiro Yamada, Michal Marek, linux-kbuild, linux-kernel,
Andreas Faerber
On Wed, May 16, 2018 at 07:51:36AM +0200, Michal Kubecek wrote:
> Since commit e501ce957a78 ("x86: Force asm-goto"), aarch64 build on
> distributions which enable PIE by default (e.g. openSUSE Tumbleweed) does
> not detect support for asm goto correctly. The problem is that ARM specific
> part of scripts/gcc-goto.sh fails with PIE even with recent gcc versions.
> Moving the asm goto detection up in Makefile put it before the place where
> we disable PIE. As a result, kernel is built without jump label support.
Ugh, that's nasty. Thanks for fixing that.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: disable PIE before testing asm goto
2018-05-16 5:51 [PATCH] Makefile: disable PIE before testing asm goto Michal Kubecek
2018-05-16 8:16 ` Peter Zijlstra
@ 2018-05-17 13:34 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-05-17 13:34 UTC (permalink / raw)
To: Michal Kubecek
Cc: Michal Marek, Linux Kbuild mailing list,
Linux Kernel Mailing List, Peter Zijlstra, Andreas Faerber
2018-05-16 14:51 GMT+09:00 Michal Kubecek <mkubecek@suse.cz>:
> Since commit e501ce957a78 ("x86: Force asm-goto"), aarch64 build on
> distributions which enable PIE by default (e.g. openSUSE Tumbleweed) does
> not detect support for asm goto correctly. The problem is that ARM specific
> part of scripts/gcc-goto.sh fails with PIE even with recent gcc versions.
> Moving the asm goto detection up in Makefile put it before the place where
> we disable PIE. As a result, kernel is built without jump label support.
>
> Move the lines disabling PIE before the asm goto test to make it work.
>
> Fixes: e501ce957a78 ("x86: Force asm-goto")
> Reported-by: Andreas Faerber <afaerber@suse.com>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> ---
Applied to linux-kbuild/fixes. Thanks!
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-17 13:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 5:51 [PATCH] Makefile: disable PIE before testing asm goto Michal Kubecek
2018-05-16 8:16 ` Peter Zijlstra
2018-05-17 13:34 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).