Makefile: disable PIE before testing asm goto

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>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

authored by Michal Kubecek and committed by Masahiro Yamada 8438ee76 c64ba044

Changed files
+3 -2
+3 -2
Makefile
··· 500 500 RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) 501 501 export RETPOLINE_CFLAGS 502 502 503 + KBUILD_CFLAGS += $(call cc-option,-fno-PIE) 504 + KBUILD_AFLAGS += $(call cc-option,-fno-PIE) 505 + 503 506 # check for 'asm goto' 504 507 ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) 505 508 CC_HAVE_ASM_GOTO := 1 ··· 624 621 # Defaults to vmlinux, but the arch makefile usually adds further targets 625 622 all: vmlinux 626 623 627 - KBUILD_CFLAGS += $(call cc-option,-fno-PIE) 628 - KBUILD_AFLAGS += $(call cc-option,-fno-PIE) 629 624 CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \ 630 625 $(call cc-option,-fno-tree-loop-im) \ 631 626 $(call cc-disable-warning,maybe-uninitialized,)