diff mbox

Makefile: disable PIE before testing asm goto

Message ID 20180516055136.6F4EAA095A@unicorn.suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Kubecek May 16, 2018, 5:51 a.m. UTC
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(-)

Comments

Peter Zijlstra May 16, 2018, 8:16 a.m. UTC | #1
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>
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada May 17, 2018, 1:34 p.m. UTC | #2
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!
diff mbox

Patch

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