Skip to content

Commit 8438ee7

Browse files
mkubecekmasahir0y
authored andcommitted
Makefile: disable PIE before testing asm goto
Since commit e501ce9 ("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: e501ce9 ("x86: Force asm-goto") Reported-by: Andreas Faerber <[email protected]> Signed-off-by: Michal Kubecek <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent c64ba04 commit 8438ee7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
500500
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
501501
export RETPOLINE_CFLAGS
502502

503+
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
504+
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
505+
503506
# check for 'asm goto'
504507
ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
505508
CC_HAVE_ASM_GOTO := 1
@@ -621,8 +624,6 @@ endif # $(dot-config)
621624
# Defaults to vmlinux, but the arch makefile usually adds further targets
622625
all: vmlinux
623626

624-
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
625-
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
626627
CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \
627628
$(call cc-option,-fno-tree-loop-im) \
628629
$(call cc-disable-warning,maybe-uninitialized,)

0 commit comments

Comments
 (0)