kbuild: remove cc-option-yn
Subsystems (7)
cover kbuild: remove cc-option-yn
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to remove cc-option-yn. Do so, and update the docs.
Base is linux-next.
Nick Desaulniers (7):
MIPS: replace cc-option-yn uses with cc-option
s390: replace cc-option-yn uses with cc-option
powerpc: replace cc-option-yn uses with cc-option
arc: replace cc-option-yn uses with cc-option
x86: remove cc-option-yn test for -mtune=
Makefile: replace cc-option-yn uses with cc-option
kbuild: remove cc-option-yn, update Docs
Documentation/kbuild/makefiles.rst | 22 ++++++--------- Makefile | 2 +- arch/arc/Makefile | 3 +- arch/mips/Makefile | 44 +++++++++++++++--------------- arch/mips/sgi-ip22/Platform | 4 +-- arch/powerpc/Makefile | 12 ++++---- arch/powerpc/boot/Makefile | 5 +--- arch/s390/Makefile | 14 +++++----- arch/x86/Makefile_32.cpu | 6 ---- scripts/Makefile.compiler | 5 ---- 10 files changed, 49 insertions(+), 68 deletions(-)
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
PATCH 1/7 MIPS: replace cc-option-yn uses with cc-option
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to pursue removing cc-option-yn.
--- arch/mips/Makefile | 44 ++++++++++++++++++------------------- arch/mips/sgi-ip22/Platform | 4 ++-- 2 files changed, 24 insertions(+), 24 deletions(-)
arch/mips/Makefile +22 -22
@@ -58,9 +58,7 @@ endif ifdef CONFIG_FUNCTION_GRAPH_TRACER ifndef KBUILD_MCOUNT_RA_ADDRESS - ifeq ($(call cc-option-yn,-mmcount-ra-address), y) - cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS - endif + cflags-y += $(call cc-option,-mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS) endif endif cflags-y += $(call cc-option, -mno-check-zero-division)
@@ -208,31 +206,33 @@ cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) # been fixed properly. mips-cflags := $(cflags-y) ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y) -smartmips-ase := $(call cc-option-yn,$(mips-cflags) -msmartmips) -cflags-$(smartmips-ase) += -msmartmips -Wa,--no-warn +cflags-y += $(call cc-option,-msmartmips -Wa$(comma)--no-warn) endif ifeq ($(CONFIG_CPU_MICROMIPS),y) -micromips-ase := $(call cc-option-yn,$(mips-cflags) -mmicromips) -cflags-$(micromips-ase) += -mmicromips +cflags-y += $(call cc-option,-mmicromips) endif ifeq ($(CONFIG_CPU_HAS_MSA),y) -toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa) -cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA +ifneq ($(call cc-option,-mhard-float -mfp64 -Wa$(comma)-mmsa),) +cflags-y += -DTOOLCHAIN_SUPPORTS_MSA +endif +endif +ifneq ($(call cc-option,-mvirt),) +cflags-y += -DTOOLCHAIN_SUPPORTS_VIRT endif -toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) -cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT # For -mmicromips, use -Wa,-fatal-warnings to catch unsupported -mxpa which # only warns -xpa-cflags-y := $(mips-cflags) -xpa-cflags-$(micromips-ase) += -mmicromips -Wa$(comma)-fatal-warnings -toolchain-xpa := $(call cc-option-yn,$(xpa-cflags-y) -mxpa) -cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA -toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc) -cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC -toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp) -cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP -toolchain-ginv := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv) -cflags-$(toolchain-ginv) += -DTOOLCHAIN_SUPPORTS_GINV +ifneq ($(call cc-option,-mmicromips -Wa$(comma)-fatal-warnings -mxpa),) +cflags-y += -DTOOLCHAIN_SUPPORTS_XPA +endif +ifneq ($(call cc-option,-Wa$(comma)-mcrc),) +cflags-y += -DTOOLCHAIN_SUPPORTS_CRC +endif +ifneq ($(call cc-option,-Wa$(comma)-mdsp),) +cflags-y += -DTOOLCHAIN_SUPPORTS_DSP +endif +ifneq ($(call cc-option,-Wa$(comma)-mginv),) +cflags-y += -DTOOLCHAIN_SUPPORTS_GINV +endif # # Firmware support
@@ -277,7 +277,7 @@ ifdef CONFIG_64BIT endif endif - ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy) + ifeq ($(KBUILD_SYM32)$(call cc-option,-msym32), y-msym32) cflags-y += -msym32 -DKBUILD_64BIT_SYM32 else ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
arch/mips/sgi-ip22/Platform +2 -2
@@ -24,8 +24,8 @@ endif # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys # ifdef CONFIG_SGI_IP28 - ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n) - $(error gcc doesn't support needed option -mr10k-cache-barrier=store) + ifeq ($(call cc-option,-march=r10000 -mr10k-cache-barrier=store),) + $(error $(CC) doesn't support needed option -mr10k-cache-barrier=store) endif endif cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=store -I$(srctree)/arch/mips/include/asm/mach-ip28
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Nathan Chancellor
maintainerRe: [PATCH 1/7] MIPS: replace cc-option-yn uses with cc-option
Quoted 37 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Thomas Bogendoerfer <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/mips/Makefile | 44 ++++++++++++++++++------------------- arch/mips/sgi-ip22/Platform | 4 ++-- 2 files changed, 24 insertions(+), 24 deletions(-)arch/mips/Makefile +1
-3@@ -58,9 +58,7 @@ endif ifdef CONFIG_FUNCTION_GRAPH_TRACER ifndef KBUILD_MCOUNT_RA_ADDRESS - ifeq ($(call cc-option-yn,-mmcount-ra-address), y) - cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS - endif + cflags-y += $(call cc-option,-mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS) endif endif cflags-y += $(call cc-option, -mno-check-zero-division)
arch/mips/Makefile cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) · line 209
Quoted 6 lines
arch/mips/Makefile +1
-2@@ -208,31 +206,33 @@ cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) # been fixed properly. mips-cflags := $(cflags-y) ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y) -smartmips-ase := $(call cc-option-yn,$(mips-cflags) -msmartmips) -cflags-$(smartmips-ase) += -msmartmips -Wa,--no-warn +cflags-y += $(call cc-option,-msmartmips -Wa$(comma)--no-warn)
I do not think this diff and most of the ones that follow are equivalent, as you are no longer including the previously checked flags in the cc-option invocation, which could change the result (options that follow may depend on a prior selected flag).
I think that as long as you add $(cflags-y) to all of the cc-option tests, it should be fine. I guess cflags-y could be eliminated but it looks like this variable exists so that the flags can be added to both KBUILD_CFLAGS and KBUILD_AFLAGS at the same time so removing it would duplicate a lot of things.
Quoted 59 lines
arch/mips/Makefile +20
-17endif ifeq ($(CONFIG_CPU_MICROMIPS),y) -micromips-ase := $(call cc-option-yn,$(mips-cflags) -mmicromips) -cflags-$(micromips-ase) += -mmicromips +cflags-y += $(call cc-option,-mmicromips) endif ifeq ($(CONFIG_CPU_HAS_MSA),y) -toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa) -cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA +ifneq ($(call cc-option,-mhard-float -mfp64 -Wa$(comma)-mmsa),) +cflags-y += -DTOOLCHAIN_SUPPORTS_MSA +endif +endif +ifneq ($(call cc-option,-mvirt),) +cflags-y += -DTOOLCHAIN_SUPPORTS_VIRT endif -toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) -cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT # For -mmicromips, use -Wa,-fatal-warnings to catch unsupported -mxpa which # only warns -xpa-cflags-y := $(mips-cflags) -xpa-cflags-$(micromips-ase) += -mmicromips -Wa$(comma)-fatal-warnings -toolchain-xpa := $(call cc-option-yn,$(xpa-cflags-y) -mxpa) -cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA -toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc) -cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC -toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp) -cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP -toolchain-ginv := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv) -cflags-$(toolchain-ginv) += -DTOOLCHAIN_SUPPORTS_GINV +ifneq ($(call cc-option,-mmicromips -Wa$(comma)-fatal-warnings -mxpa),) +cflags-y += -DTOOLCHAIN_SUPPORTS_XPA +endif +ifneq ($(call cc-option,-Wa$(comma)-mcrc),) +cflags-y += -DTOOLCHAIN_SUPPORTS_CRC +endif +ifneq ($(call cc-option,-Wa$(comma)-mdsp),) +cflags-y += -DTOOLCHAIN_SUPPORTS_DSP +endif +ifneq ($(call cc-option,-Wa$(comma)-mginv),) +cflags-y += -DTOOLCHAIN_SUPPORTS_GINV +endif # # Firmware support@@ -277,7 +277,7 @@ ifdef CONFIG_64BIT endif endif - ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy) + ifeq ($(KBUILD_SYM32)$(call cc-option,-msym32), y-msym32) cflags-y += -msym32 -DKBUILD_64BIT_SYM32 else ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)arch/mips/sgi-ip22/Platform +0
-0
arch/mips/sgi-ip22/Platform endif · line 28
Quoted 7 lines
arch/mips/sgi-ip22/Platform +2
-2@@ -24,8 +24,8 @@ endif # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys # ifdef CONFIG_SGI_IP28 - ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n) - $(error gcc doesn't support needed option -mr10k-cache-barrier=store) + ifeq ($(call cc-option,-march=r10000 -mr10k-cache-barrier=store),) + $(error $(CC) doesn't support needed option -mr10k-cache-barrier=store)
Heh :)
Quoted 4 lines
arch/mips/sgi-ip22/Platform +0
-0endif endif cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=store -I$(srctree)/arch/mips/include/asm/mach-ip28
PATCH 2/7 s390: replace cc-option-yn uses with cc-option
In reply to Nick Desaulnierscc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to pursue removing cc-option-yn.
--- arch/s390/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/s390/Makefile +7 -7
@@ -70,7 +70,7 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include # cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls -ifeq ($(call cc-option-yn,-mpacked-stack -mbackchain -msoft-float),y) +ifneq ($(call cc-option,-mpacked-stack -mbackchain -msoft-float),) cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK endif
@@ -78,22 +78,22 @@ endif KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y) KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y) -ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) +ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),) cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) -ifneq ($(call cc-option-yn,-mstack-size=8192),y) +ifeq ($(call cc-option,-mstack-size=8192),) cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) endif endif ifdef CONFIG_WARN_DYNAMIC_STACK - ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) + ifneq ($(call cc-option,-mwarn-dynamicstack),) KBUILD_CFLAGS += -mwarn-dynamicstack KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack endif endif ifdef CONFIG_EXPOLINE - ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y) + ifneq ($(call cc-option,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),) CC_FLAGS_EXPOLINE := -mindirect-branch=thunk CC_FLAGS_EXPOLINE += -mfunction-return=thunk CC_FLAGS_EXPOLINE += -mindirect-branch-table
@@ -104,10 +104,10 @@ ifdef CONFIG_EXPOLINE endif ifdef CONFIG_FUNCTION_TRACER - ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n) + ifeq ($(call cc-option,-mfentry -mnop-mcount),) # make use of hotpatch feature if the compiler supports it cc_hotpatch := -mhotpatch=0,3 - ifeq ($(call cc-option-yn,$(cc_hotpatch)),y) + ifneq ($(call cc-option,$(cc_hotpatch)),) CC_FLAGS_FTRACE := $(cc_hotpatch) KBUILD_AFLAGS += -DCC_USING_HOTPATCH KBUILD_CFLAGS += -DCC_USING_HOTPATCH
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Re: [PATCH 2/7] s390: replace cc-option-yn uses with cc-option
Quoted 11 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
Quoted 7 lines
This allows us to pursue removing cc-option-yn.
Cc Heiko Carstens <[email protected]>Cc Vasily Gorbik <[email protected]>Cc Christian Borntraeger <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>
Quoted 58 lines
--- arch/s390/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)arch/s390/Makefile +7
-7@@ -70,7 +70,7 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include # cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls -ifeq ($(call cc-option-yn,-mpacked-stack -mbackchain -msoft-float),y) +ifneq ($(call cc-option,-mpacked-stack -mbackchain -msoft-float),) cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK endif@@ -78,22 +78,22 @@ endif KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y) KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y) -ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) +ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),) cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE) -ifneq ($(call cc-option-yn,-mstack-size=8192),y) +ifeq ($(call cc-option,-mstack-size=8192),) cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) endif endif ifdef CONFIG_WARN_DYNAMIC_STACK - ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y) + ifneq ($(call cc-option,-mwarn-dynamicstack),) KBUILD_CFLAGS += -mwarn-dynamicstack KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack endif endif ifdef CONFIG_EXPOLINE - ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y) + ifneq ($(call cc-option,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),) CC_FLAGS_EXPOLINE := -mindirect-branch=thunk CC_FLAGS_EXPOLINE += -mfunction-return=thunk CC_FLAGS_EXPOLINE += -mindirect-branch-table@@ -104,10 +104,10 @@ ifdef CONFIG_EXPOLINE endif ifdef CONFIG_FUNCTION_TRACER - ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n) + ifeq ($(call cc-option,-mfentry -mnop-mcount),) # make use of hotpatch feature if the compiler supports it cc_hotpatch := -mhotpatch=0,3 - ifeq ($(call cc-option-yn,$(cc_hotpatch)),y) + ifneq ($(call cc-option,$(cc_hotpatch)),) CC_FLAGS_FTRACE := $(cc_hotpatch) KBUILD_AFLAGS += -DCC_USING_HOTPATCH KBUILD_CFLAGS += -DCC_USING_HOTPATCH
Re: [PATCH 2/7] s390: replace cc-option-yn uses with cc-option
In reply to Nick DesaulniersQuoted 13 lines · Nick Desaulniers
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Quoted 8 lines
Cc Heiko Carstens <[email protected]>Cc Vasily Gorbik <[email protected]>Cc Christian Borntraeger <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/s390/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Re: [PATCH 2/7] s390: replace cc-option-yn uses with cc-option
Quoted 24 lines · Heiko Carstens
Quoted 13 lines · Nick Desaulniers
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Quoted 8 lines
Cc Heiko Carstens <[email protected]>Cc Vasily Gorbik <[email protected]>Cc Christian Borntraeger <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/s390/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Quoted 1 line
Acked-by Heiko Carstens <[email protected]>
Applied to linux-kbuild.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 3/7 powerpc: replace cc-option-yn uses with cc-option
In reply to Nick Desaulnierscc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to pursue removing cc-option-yn.
--- arch/powerpc/Makefile | 12 ++++++------ arch/powerpc/boot/Makefile | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-)
arch/powerpc/Makefile +6 -6
@@ -12,12 +12,12 @@ # Rewritten by Cort Dougan and Paul Mackerras # -HAS_BIARCH := $(call cc-option-yn, -m32) +HAS_BIARCH := $(call cc-option,-m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32) ifeq ($(CROSS32_COMPILE),) ifdef CONFIG_PPC32 # These options will be overridden by any -mcpu option that the CPU
@@ -107,7 +107,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32) KBUILD_CFLAGS += -m$(BITS) KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
@@ -125,7 +125,9 @@ LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) ifdef CONFIG_PPC64 -ifeq ($(call cc-option-yn,-mcmodel=medium),y) +ifeq ($(call cc-option,-mcmodel=medium),) + export NO_MINIMAL_TOC := -mno-minimal-toc +else # -mcmodel=medium breaks modules because it uses 32bit offsets from # the TOC pointer to create pointers where possible. Pointers into the # percpu data area are created by this method.
@@ -135,8 +137,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y) # kernel percpu data space (starting with 0xc...). We need a full # 64bit relocation for this to work, hence -mcmodel=large. KBUILD_CFLAGS_MODULE += -mcmodel=large -else - export NO_MINIMAL_TOC := -mno-minimal-toc endif endif
arch/powerpc/boot/Makefile +1 -4
@@ -66,10 +66,7 @@ ifdef CONFIG_DEBUG_INFO BOOTCFLAGS += -g endif -ifeq ($(call cc-option-yn, -fstack-protector),y) -BOOTCFLAGS += -fno-stack-protector -endif - +BOOTCFLAGS += $(call cc-option,-fstack-protector) BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) DTC_FLAGS ?= -p 1024
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Nathan Chancellor
maintainerRe: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
Quoted 76 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Michael Ellerman <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/powerpc/Makefile | 12 ++++++------ arch/powerpc/boot/Makefile | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-)arch/powerpc/Makefile +6
-6@@ -12,12 +12,12 @@ # Rewritten by Cort Dougan and Paul Mackerras # -HAS_BIARCH := $(call cc-option-yn, -m32) +HAS_BIARCH := $(call cc-option,-m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32) ifeq ($(CROSS32_COMPILE),) ifdef CONFIG_PPC32 # These options will be overridden by any -mcpu option that the CPU@@ -107,7 +107,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32) KBUILD_CFLAGS += -m$(BITS) KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)@@ -125,7 +125,9 @@ LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) ifdef CONFIG_PPC64 -ifeq ($(call cc-option-yn,-mcmodel=medium),y) +ifeq ($(call cc-option,-mcmodel=medium),) + export NO_MINIMAL_TOC := -mno-minimal-toc +else # -mcmodel=medium breaks modules because it uses 32bit offsets from # the TOC pointer to create pointers where possible. Pointers into the # percpu data area are created by this method.@@ -135,8 +137,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y) # kernel percpu data space (starting with 0xc...). We need a full # 64bit relocation for this to work, hence -mcmodel=large. KBUILD_CFLAGS_MODULE += -mcmodel=large -else - export NO_MINIMAL_TOC := -mno-minimal-toc endif endifarch/powerpc/boot/Makefile +0
-0
arch/powerpc/boot/Makefile ifdef CONFIG_DEBUG_INFO · line 69
Quoted 8 lines
arch/powerpc/boot/Makefile +1
-4@@ -66,10 +66,7 @@ ifdef CONFIG_DEBUG_INFO BOOTCFLAGS += -g endif -ifeq ($(call cc-option-yn, -fstack-protector),y) -BOOTCFLAGS += -fno-stack-protector -endif - +BOOTCFLAGS += $(call cc-option,-fstack-protector)
This was previously disabling the stack protector but now it is enabling it. Just remove the ifeq conditional altogether as the kernel assumes -fno-stack-protector is always supported after commit 893ab00439a4 ("kbuild: remove cc-option test of -fno-stack-protector").
Quoted 4 lines
arch/powerpc/boot/Makefile +0
-0BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) DTC_FLAGS ?= -p 1024
Michael Ellerman
reviewerRe: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
In reply to Nick DesaulniersQuoted 29 lines · Nick Desaulniers
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Michael Ellerman <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/powerpc/Makefile | 12 ++++++------ arch/powerpc/boot/Makefile | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-)arch/powerpc/Makefile +0
-0@@ -12,12 +12,12 @@ # Rewritten by Cort Dougan and Paul Mackerras
arch/powerpc/Makefile line 20
Quoted 10 lines
arch/powerpc/Makefile +2
-2# -HAS_BIARCH := $(call cc-option-yn, -m32) +HAS_BIARCH := $(call cc-option,-m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32)
I don't love that we have to repeat "-m32" in each check.
I'm pretty sure you can use ifdef here, because HAS_BIARCH is a simple variable (assigned with ":=").
ie, this can be:
ifdef HAS_BIARCH
And that avoids having to spell out "-m32" everywhere.
cheers
Re: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
Quoted 47 lines · Michael Ellerman
Quoted 29 lines · Nick Desaulniers
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Michael Ellerman <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/powerpc/Makefile | 12 ++++++------ arch/powerpc/boot/Makefile | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-)arch/powerpc/Makefile +0
-0@@ -12,12 +12,12 @@ # Rewritten by Cort Dougan and Paul Mackerrasarch/powerpc/Makefile line 20
Quoted 10 lines
arch/powerpc/Makefile +2
-2# -HAS_BIARCH := $(call cc-option-yn, -m32) +HAS_BIARCH := $(call cc-option,-m32) # Set default 32 bits cross compilers for vdso and boot wrapper CROSS32_COMPILE ?= -ifeq ($(HAS_BIARCH),y) +ifeq ($(HAS_BIARCH),-m32)I don't love that we have to repeat "-m32" in each check.
I'm pretty sure you can use ifdef here, because
HAS_BIARCHis a simple variable (assigned with ":=").
Quoted 8 lines
ie, this can be:
ifdef
HAS_BIARCHAnd that avoids having to spell out "-m32" everywhere.
cheers
Yes.
Comments from Nathan and Michael
both sound good.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 4/7 arc: replace cc-option-yn uses with cc-option
In reply to Nick Desaulnierscc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to pursue removing cc-option-yn.
--- arch/arc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arc/Makefile +1 -2
@@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"") cflags-y += $(tune-mcpu-def-y) else tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) -tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) -ifeq ($(tune-mcpu-ok),y) +ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu) else # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Nathan Chancellor
maintainerRe: [PATCH 4/7] arc: replace cc-option-yn uses with cc-option
Quoted 25 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Vineet Gupta <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arc/Makefile +0
-0
arch/arc/Makefile ifeq ($(CONFIG_ARC_TUNE_MCPU),"") · line 22
Quoted 7 lines
arch/arc/Makefile +1
-2@@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"") cflags-y += $(tune-mcpu-def-y) else tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) -tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) -ifeq ($(tune-mcpu-ok),y) +ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu)
Any reason not to just turn this into
cflags-y += $(call cc-option,$(tune-mcpu))
?
If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
Quoted 3 lines
arch/arc/Makefile +0
-0else # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
Re: [PATCH 4/7] arc: replace cc-option-yn uses with cc-option
Quoted 37 lines · Nathan Chancellor
Quoted 25 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Vineet Gupta <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arc/Makefile +0
-0arch/arc/Makefile ifeq ($(CONFIG_ARC_TUNE_MCPU),"") · line 22
Quoted 7 lines
arch/arc/Makefile +1
-2@@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"") cflags-y += $(tune-mcpu-def-y) else tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) -tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) -ifeq ($(tune-mcpu-ok),y) +ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu)Any reason not to just turn this into
Quoted 3 lines
cflags-y += $(call cc-option,$(tune-mcpu))
?
Yes, you'll need to pull up the source; the diff doesn't provide enough context. tune-mcpu is used in the body of the else branch hinted at by the diff. PTAL
Quoted 6 lines
If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
Quoted 3 lines
arch/arc/Makefile +0
-0else # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
Signature · 7 lines
Thanks, ~Nick Desaulniers _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 4/7] arc: replace cc-option-yn uses with cc-option
Quoted 38 lines · Nick Desaulniers' via Clang Built Linux
Quoted 37 lines · Nathan Chancellor
Quoted 25 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Vineet Gupta <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arc/Makefile +0
-0arch/arc/Makefile ifeq ($(CONFIG_ARC_TUNE_MCPU),"") · line 22
Quoted 7 lines
arch/arc/Makefile +1
-2@@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"") cflags-y += $(tune-mcpu-def-y) else tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) -tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) -ifeq ($(tune-mcpu-ok),y) +ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu)Any reason not to just turn this into
Quoted 7 lines
Quoted 3 lines
cflags-y += $(call cc-option,$(tune-mcpu))
?
Yes, you'll need to pull up the source; the diff doesn't provide enough context. tune-mcpu is used in the body of the else branch hinted at by the diff. PTAL
Ah, fair enough. The warning is a little unconventional but oh well :)
Quoted 9 lines
Quoted 6 lines
If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
Quoted 3 lines
arch/arc/Makefile +0
-0else # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
Re: [PATCH 4/7] arc: replace cc-option-yn uses with cc-option
Quoted 46 lines · Nathan Chancellor
Quoted 42 lines · Nick Desaulniers' via Clang Built Linux
Quoted 40 lines · Nathan Chancellor
Quoted 25 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Cc Vineet Gupta <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/arc/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/arc/Makefile +0
-0arch/arc/Makefile ifeq ($(CONFIG_ARC_TUNE_MCPU),"") · line 22
Quoted 7 lines
arch/arc/Makefile +1
-2@@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"") cflags-y += $(tune-mcpu-def-y) else tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) -tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) -ifeq ($(tune-mcpu-ok),y) +ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu)Any reason not to just turn this into
cflags-y += $(call cc-option,$(tune-mcpu))
?
Quoted 17 lines
Quoted 3 lines
Yes, you'll need to pull up the source; the diff doesn't provide enough context. tune-mcpu is used in the body of the else branch hinted at by the diff. PTAL
Ah, fair enough. The warning is a little unconventional but oh well :)
Reviewed-by Nathan Chancellor <[email protected]>Quoted 9 lines
Quoted 6 lines
If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
Quoted 3 lines
arch/arc/Makefile +0
-0else # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
Applied to linux-kbuild.
Signature · 7 lines
Best Regards Masahiro Yamada _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
PATCH 5/7 x86: remove cc-option-yn test for -mtune=
In reply to Nick DesaulniersAs noted in the comment, -mtune= has been supported since GCC 3.4. The minimum required version of GCC to build the kernel (as specified in Documentation/process/changes.rst) is GCC 4.9.
tune is not immediately expanded. Instead it defines a macro that will test via cc-option later values for -mtune=. But we can skip the test whether to use -mtune= vs. -mcpu=.
--- arch/x86/Makefile_32.cpu | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/Makefile_32.cpu +0 -6
@@ -2,13 +2,7 @@ # CPU tuning section - shared with UML. # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. -#-mtune exists since gcc 3.4 -HAS_MTUNE := $(call cc-option-yn, -mtune=i386) -ifeq ($(HAS_MTUNE),y) tune = $(call cc-option,-mtune=$(1),$(2)) -else -tune = $(call cc-option,-mcpu=$(1),$(2)) -endif cflags-$(CONFIG_M486SX) += -march=i486 cflags-$(CONFIG_M486) += -march=i486
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Re: [PATCH 5/7] x86: remove cc-option-yn test for -mtune=
Quoted 8 lines · Nick Desaulniers' via Clang Built Linux
As noted in the comment, -mtune= has been supported since GCC 3.4. The minimum required version of GCC to build the kernel (as specified in
Documentation/process/changes.rst) is GCC 4.9.tune is not immediately expanded. Instead it defines a macro that will test via cc-option later values for -mtune=. But we can skip the test whether to use -mtune= vs. -mcpu=.
Quoted 6 lines
Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc H. Peter Anvin <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>
Yay for removing stale checks!
Quoted 23 lines
--- arch/x86/Makefile_32.cpu | 6 ------ 1 file changed, 6 deletions(-)arch/x86/Makefile_32.cpu +0
-6@@ -2,13 +2,7 @@ # CPU tuning section - shared with UML. # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. -#-mtune exists since gcc 3.4 -HAS_MTUNE := $(call cc-option-yn, -mtune=i386) -ifeq ($(HAS_MTUNE),y) tune = $(call cc-option,-mtune=$(1),$(2)) -else -tune = $(call cc-option,-mcpu=$(1),$(2)) -endif cflags-$(CONFIG_M486SX) += -march=i486 cflags-$(CONFIG_M486) += -march=i486
Re: [PATCH 5/7] x86: remove cc-option-yn test for -mtune=
In reply to Nick DesaulniersQuoted 38 lines · Nick Desaulniers
As noted in the comment, -mtune= has been supported since GCC 3.4. The minimum required version of GCC to build the kernel (as specified in
Documentation/process/changes.rst) is GCC 4.9.tune is not immediately expanded. Instead it defines a macro that will test via cc-option later values for -mtune=. But we can skip the test whether to use -mtune= vs. -mcpu=.
Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc H. Peter Anvin <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>--- arch/x86/Makefile_32.cpu | 6 ------ 1 file changed, 6 deletions(-)arch/x86/Makefile_32.cpu +0
-7@@ -2,13 +2,7 @@ # CPU tuning section - shared with UML. # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. -#-mtune exists since gcc 3.4 -HAS_MTUNE := $(call cc-option-yn, -mtune=i386) -ifeq ($(HAS_MTUNE),y) tune = $(call cc-option,-mtune=$(1),$(2)) -else -tune = $(call cc-option,-mcpu=$(1),$(2)) -endif cflags-$(CONFIG_M486SX) += -march=i486 cflags-$(CONFIG_M486) += -march=i486 --
Quoted 2 lines
2.33.0.rc1.237.g0d66db33f3-goog
LGTM.
Perhaps, a follow-up patch can remove the tune macro too, replacing $(call tune,pentium2) with $(call cc-option,-mtune=pentium2)
--
Best Regards
Masahiro Yamada
Re: [PATCH 5/7] x86: remove cc-option-yn test for -mtune=
In reply to Nick DesaulniersQuoted 4 lines · Nick Desaulniers' via Clang Built Linux
As noted in the comment, -mtune= has been supported since GCC 3.4. The minimum required version of GCC to build the kernel (as specified in
Documentation/process/changes.rst) is GCC 4.9.
Yes, please!
Cheers,
Miguel
Re: [PATCH 5/7] x86: remove cc-option-yn test for -mtune=
Quoted 8 lines · Miguel Ojeda
Quoted 4 lines · Nick Desaulniers' via Clang Built Linux
As noted in the comment, -mtune= has been supported since GCC 3.4. The minimum required version of GCC to build the kernel (as specified in
Documentation/process/changes.rst) is GCC 4.9.
Quoted 6 lines
Yes, please!
Reviewed-by Miguel Ojeda <[email protected]>Cheers,
Miguel
Applied to linux-kbuild.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 6/7 Makefile: replace cc-option-yn uses with cc-option
In reply to Nick Desaulnierscc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to pursue removing cc-option-yn.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -967,7 +967,7 @@ ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FTRACE_MCOUNT_USE_CC CC_FLAGS_FTRACE += -mrecord-mcount ifdef CONFIG_HAVE_NOP_MCOUNT - ifeq ($(call cc-option-yn, -mnop-mcount),y) + ifneq ($(call cc-option, -mnop-mcount),) CC_FLAGS_FTRACE += -mnop-mcount CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT endif
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Re: [PATCH 6/7] Makefile: replace cc-option-yn uses with cc-option
Quoted 6 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Quoted 8 lines
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Signed-off-by Nick Desaulniers <[email protected]>
Quoted 18 lines
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -967,7 +967,7 @@ ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FTRACE_MCOUNT_USE_CC CC_FLAGS_FTRACE += -mrecord-mcount ifdef CONFIG_HAVE_NOP_MCOUNT - ifeq ($(call cc-option-yn, -mnop-mcount),y) + ifneq ($(call cc-option, -mnop-mcount),) CC_FLAGS_FTRACE += -mnop-mcount CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT endif
Re: [PATCH 6/7] Makefile: replace cc-option-yn uses with cc-option
In reply to Nick DesaulniersQuoted 35 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Signed-off-by Nick Desaulniers <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-2@@ -967,7 +967,7 @@ ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FTRACE_MCOUNT_USE_CC CC_FLAGS_FTRACE += -mrecord-mcount ifdef CONFIG_HAVE_NOP_MCOUNT - ifeq ($(call cc-option-yn, -mnop-mcount),y) + ifneq ($(call cc-option, -mnop-mcount),) CC_FLAGS_FTRACE += -mnop-mcount CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT endif --2.33.0.rc1.237.g0d66db33f3-goog
Quoted 4 lines
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210817002109.2736222-7-ndesaulniers%40google.com.
I am fine with this change, but
is there any reason why you did not touch the following hunk?
ifdef CONFIG_HAVE_FENTRY
# s390-linux-gnu-gcc did not support -mfentry until gcc-9.
ifeq ($(call cc-option-yn, -mfentry),y)
CC_FLAGS_FTRACE += -mfentry
CC_FLAGS_USING += -DCC_USING_FENTRY
endif
endifSignature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 6/7] Makefile: replace cc-option-yn uses with cc-option
Quoted 50 lines · Masahiro Yamada
Quoted 35 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)This allows us to pursue removing cc-option-yn.
Signed-off-by Nick Desaulniers <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-2@@ -967,7 +967,7 @@ ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FTRACE_MCOUNT_USE_CC CC_FLAGS_FTRACE += -mrecord-mcount ifdef CONFIG_HAVE_NOP_MCOUNT - ifeq ($(call cc-option-yn, -mnop-mcount),y) + ifneq ($(call cc-option, -mnop-mcount),) CC_FLAGS_FTRACE += -mnop-mcount CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT endif --2.33.0.rc1.237.g0d66db33f3-goog
Quoted 4 lines
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210817002109.2736222-7-ndesaulniers%40google.com.I am fine with this change, but
is there any reason why you did not touch the following hunk?
Quoted 8 lines
ifdef
CONFIG_HAVE_FENTRY# s390-linux-gnu-gcc did not support -mfentry until gcc-9. ifeq ($(call cc-option-yn, -mfentry),y) CC_FLAGS_FTRACE += -mfentry CC_FLAGS_USING += -DCC_USING_FENTRY endif endif
Ah, I just recalled that this hunk was restored
after a build error was reported:
https://lore.kernel.org/lkml/CAKwvOdkckey1=VUHApTcJYufyhdRJ=jb4qYs52f59g6ha7qphw@mail.gmail.com/
So, please send v2, changing -mfentry part in the same way.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 7/7 kbuild: remove cc-option-yn, update Docs
In reply to Nick Desaulnierscc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)
Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
This allows us to remove cc-option-yn. Do so and update the docs with examples.
--- Documentation/kbuild/makefiles.rst | 22 +++++++++------------- scripts/Makefile.compiler | 5 ----- 2 files changed, 9 insertions(+), 18 deletions(-)
Documentation/kbuild/makefiles.rst +9 -13
@@ -650,24 +650,20 @@ more details, with real examples. -march=pentium-mmx if supported by $(CC), otherwise -march=i586. The second argument to cc-option is optional, and if omitted, cflags-y will be assigned no value if first option is not supported. - Note: cc-option uses KBUILD_CFLAGS for $(CC) options + Note: cc-option uses KBUILD_CFLAGS for $(CC) options. - cc-option-yn - cc-option-yn is used to check if gcc supports a given option - and return 'y' if supported, otherwise 'n'. + cc-option can be combined with conditionals to perform actions based on tool + support. Example:: - #arch/ppc/Makefile - biarch := $(call cc-option-yn, -m32) - aflags-$(biarch) += -a32 - cflags-$(biarch) += -m32 + ifneq ($(call cc-option,$(FLAG)),) + # $(FLAG) is supported - In the above example, $(biarch) is set to y if $(CC) supports the -m32 - option. When $(biarch) equals 'y', the expanded variables $(aflags-y) - and $(cflags-y) will be assigned the values -a32 and -m32, - respectively. - Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options + Or:: + + ifeq ($(call cc-option,$(FLAG)),) + # $(FLAG) is not supported cc-disable-warning cc-disable-warning checks if gcc supports a given warning and returns
scripts/Makefile.compiler +0 -5
@@ -51,11 +51,6 @@ __cc-option = $(call try-run,\ cc-option = $(call __cc-option, $(CC),\ $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2)) -# cc-option-yn -# Usage: flag := $(call cc-option-yn,-march=winchip-c6) -cc-option-yn = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) - # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Re: [PATCH 7/7] kbuild: remove cc-option-yn, update Docs
Quoted 11 lines · Nick Desaulniers' via Clang Built Linux
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)
Quoted 4 lines
This allows us to remove cc-option-yn. Do so and update the docs with examples.
Signed-off-by Nick Desaulniers <[email protected]>
Quoted 60 lines
--- Documentation/kbuild/makefiles.rst | 22 +++++++++------------- scripts/Makefile.compiler | 5 ----- 2 files changed, 9 insertions(+), 18 deletions(-)Documentation/kbuild/makefiles.rst +9
-13@@ -650,24 +650,20 @@ more details, with real examples. -march=pentium-mmx if supported by $(CC), otherwise -march=i586. The second argument to cc-option is optional, and if omitted, cflags-y will be assigned no value if first option is not supported. - Note: cc-option uses KBUILD_CFLAGS for $(CC) options + Note: cc-option uses KBUILD_CFLAGS for $(CC) options. - cc-option-yn - cc-option-yn is used to check if gcc supports a given option - and return 'y' if supported, otherwise 'n'. + cc-option can be combined with conditionals to perform actions based on tool + support. Example:: - #arch/ppc/Makefile - biarch := $(call cc-option-yn, -m32) - aflags-$(biarch) += -a32 - cflags-$(biarch) += -m32 + ifneq ($(call cc-option,$(FLAG)),) + # $(FLAG) is supported - In the above example, $(biarch) is set to y if $(CC) supports the -m32 - option. When $(biarch) equals 'y', the expanded variables $(aflags-y) - and $(cflags-y) will be assigned the values -a32 and -m32, - respectively. - Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options + Or:: + + ifeq ($(call cc-option,$(FLAG)),) + # $(FLAG) is not supported cc-disable-warning cc-disable-warning checks if gcc supports a given warning and returnsscripts/Makefile.compiler +0
-5@@ -51,11 +51,6 @@ __cc-option = $(call try-run,\ cc-option = $(call __cc-option, $(CC),\ $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2)) -# cc-option-yn -# Usage: flag := $(call cc-option-yn,-march=winchip-c6) -cc-option-yn = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) - # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\