Skip to content

Commit a537101

Browse files
arndbmpe
authored andcommitted
powerpc/Makefile: Allow overriding CPP
Unlike all other arches, powerpc doesn't allow the user to override CPP, because it sets it unconditionally in the arch Makefile. This can lead to strange build failures. Instead add the required flags to KBUILD_CPPFLAGS, which are passed to CPP, CC and AS invocations by the generic Makefile logic. Reported-by: Arnd Bergmann <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Closes: https://lore.kernel.org/all/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> [mpe: Rebase, write change log, add Arnd's SoB as communicated privately] Signed-off-by: Michael Ellerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 4aa5cc1 commit a537101

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

arch/powerpc/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
6262
endif
6363

6464
ifdef CONFIG_CPU_LITTLE_ENDIAN
65-
KBUILD_CFLAGS += -mlittle-endian
65+
KBUILD_CPPFLAGS += -mlittle-endian
6666
KBUILD_LDFLAGS += -EL
6767
LDEMULATION := lppc
6868
GNUTARGET := powerpcle
6969
MULTIPLEWORD := -mno-multiple
7070
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
7171
else
72-
KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
72+
KBUILD_CPPFLAGS += $(call cc-option,-mbig-endian)
7373
KBUILD_LDFLAGS += -EB
7474
LDEMULATION := ppc
7575
GNUTARGET := powerpc
@@ -95,7 +95,7 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
9595
aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
9696

9797
ifeq ($(HAS_BIARCH),y)
98-
KBUILD_CFLAGS += -m$(BITS)
98+
KBUILD_CPPFLAGS += -m$(BITS)
9999
KBUILD_AFLAGS += -m$(BITS)
100100
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
101101
endif
@@ -176,7 +176,6 @@ KBUILD_CPPFLAGS += -I $(srctree)/arch/powerpc $(asinstr)
176176
KBUILD_AFLAGS += $(AFLAGS-y)
177177
KBUILD_CFLAGS += $(CC_FLAGS_NO_FPU)
178178
KBUILD_CFLAGS += $(CFLAGS-y)
179-
CPP = $(CC) -E $(KBUILD_CFLAGS)
180179

181180
CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
182181
ifdef CONFIG_CPU_BIG_ENDIAN

arch/powerpc/kernel/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
5050
ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
5151

5252
# Filter flags that clang will warn are unused for linking
53-
ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
53+
ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
5454

5555
CC32FLAGS := -m32
5656
CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc

0 commit comments

Comments
 (0)