[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH 11/15] build: rename CFLAGS to XEN_CFLAGS in xen/Makefile
This is a preparatory patch. A future patch will not even use $(CFLAGS) to seed $(XEN_CFLAGS). Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- xen/Makefile | 41 ++++++++++++++--------------- xen/arch/arm/arch.mk | 4 +-- xen/arch/riscv/arch.mk | 4 +-- xen/arch/x86/arch.mk | 58 +++++++++++++++++++++--------------------- 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index c4a83fca76..b3bffe8c6f 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -259,6 +259,7 @@ export KBUILD_DEFCONFIG := $(ARCH)_defconfig export XEN_TREEWIDE_CFLAGS := $(CFLAGS) XEN_AFLAGS = +XEN_CFLAGS = $(CFLAGS) # CLANG_FLAGS needs to be calculated before calling Kconfig ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) @@ -284,7 +285,7 @@ CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3)) endif CLANG_FLAGS += -Werror=unknown-warning-option -CFLAGS += $(CLANG_FLAGS) +XEN_CFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS endif @@ -293,7 +294,7 @@ ifeq ($(call ld-ver-build-id,$(LD)),n) XEN_LDFLAGS_BUILD_ID := XEN_HAS_BUILD_ID := n else -CFLAGS += -DBUILD_ID +XEN_CFLAGS += -DBUILD_ID XEN_TREEWIDE_CFLAGS += -DBUILD_ID XEN_HAS_BUILD_ID := y XEN_LDFLAGS_BUILD_ID := --build-id=sha1 @@ -388,30 +389,30 @@ include/config/%.conf include/config/%.conf.cmd: $(KCONFIG_CONFIG) $(Q)$(MAKE) $(build)=tools/kconfig syncconfig ifeq ($(CONFIG_DEBUG),y) -CFLAGS += -O1 +XEN_CFLAGS += -O1 else -CFLAGS += -O2 +XEN_CFLAGS += -O2 endif ifeq ($(CONFIG_FRAME_POINTER),y) -CFLAGS += -fno-omit-frame-pointer +XEN_CFLAGS += -fno-omit-frame-pointer else -CFLAGS += -fomit-frame-pointer +XEN_CFLAGS += -fomit-frame-pointer endif CFLAGS-$(CONFIG_CC_SPLIT_SECTIONS) += -ffunction-sections -fdata-sections -CFLAGS += -nostdinc -fno-builtin -fno-common -CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith -$(call cc-option-add,CFLAGS,CC,-Wvla) -CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h +XEN_CFLAGS += -nostdinc -fno-builtin -fno-common +XEN_CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith +$(call cc-option-add,XEN_CFLAGS,CC,-Wvla) +XEN_CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h CFLAGS-$(CONFIG_DEBUG_INFO) += -g ifneq ($(CONFIG_CC_IS_CLANG),y) # Clang doesn't understand this command line argument, and doesn't appear to # have a suitable alternative. The resulting compiled binary does function, # but has an excessively large symbol table. -CFLAGS += -Wa,--strip-local-absolute +XEN_CFLAGS += -Wa,--strip-local-absolute endif XEN_AFLAGS += -D__ASSEMBLY__ @@ -420,14 +421,14 @@ $(call cc-option-add,XEN_AFLAGS,CC,-Wa$(comma)--noexecstack) LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments -CFLAGS += $(CFLAGS-y) +XEN_CFLAGS += $(CFLAGS-y) # allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE -CFLAGS += $(EXTRA_CFLAGS_XEN_CORE) +XEN_CFLAGS += $(EXTRA_CFLAGS_XEN_CORE) # Most CFLAGS are safe for assembly files: # -std=gnu{89,99} gets confused by #-prefixed end-of-line comments # -flto makes no sense and annoys clang -XEN_AFLAGS += $(filter-out -std=gnu% -flto,$(CFLAGS)) $(AFLAGS-y) +XEN_AFLAGS += $(filter-out -std=gnu% -flto,$(XEN_CFLAGS)) $(AFLAGS-y) # LDFLAGS are only passed directly to $(LD) LDFLAGS += $(LDFLAGS_DIRECT) $(LDFLAGS-y) @@ -439,16 +440,16 @@ CFLAGS_UBSAN := endif ifeq ($(CONFIG_LTO),y) -CFLAGS += -flto +XEN_CFLAGS += -flto LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so endif ifdef building_out_of_srctree - CFLAGS += -I$(objtree)/include - CFLAGS += -I$(objtree)/arch/$(TARGET_ARCH)/include + XEN_CFLAGS += -I$(objtree)/include + XEN_CFLAGS += -I$(objtree)/arch/$(TARGET_ARCH)/include endif -CFLAGS += -I$(srctree)/include -CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include +XEN_CFLAGS += -I$(srctree)/include +XEN_CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include # Note that link order matters! ALL_OBJS-y := common/built_in.o @@ -463,7 +464,7 @@ ALL_LIBS-y := lib/lib.a include $(srctree)/arch/$(TARGET_ARCH)/arch.mk # define new variables to avoid the ones defined in Config.mk -export XEN_CFLAGS := $(CFLAGS) +export XEN_CFLAGS := $(XEN_CFLAGS) export XEN_AFLAGS := $(XEN_AFLAGS) export XEN_LDFLAGS := $(LDFLAGS) export CFLAGS_UBSAN diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk index 58db76c4e1..300b8bf7ae 100644 --- a/xen/arch/arm/arch.mk +++ b/xen/arch/arm/arch.mk @@ -1,8 +1,8 @@ ######################################## # arm-specific definitions -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) -$(call cc-option-add,CFLAGS,CC,-Wnested-externs) +$(call cc-options-add,XEN_CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,XEN_CFLAGS,CC,-Wnested-externs) # Prevent floating-point variables from creeping into Xen. CFLAGS-$(CONFIG_ARM_32) += -msoft-float diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk index 7448f759b4..aadf373ce8 100644 --- a/xen/arch/riscv/arch.mk +++ b/xen/arch/riscv/arch.mk @@ -1,7 +1,7 @@ ######################################## # RISCV-specific definitions -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-options-add,XEN_CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64 @@ -12,7 +12,7 @@ riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c # into the upper half _or_ the lower half of the address space. # -mcmodel=medlow would force Xen into the lower half. -CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany +XEN_CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany # TODO: Drop override when more of the build is working override ALL_OBJS-y = arch/$(TARGET_ARCH)/built_in.o diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index 13ec88a628..5df3cf6bc3 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -3,42 +3,42 @@ export XEN_IMG_OFFSET := 0x200000 -CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-generic -CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-default -CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +XEN_CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-generic +XEN_CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-default +XEN_CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) # Prevent floating-point variables from creeping into Xen. -CFLAGS += -msoft-float - -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) -$(call cc-option-add,CFLAGS,CC,-Wnested-externs) -$(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX) -$(call as-option-add,CFLAGS,CC,"crc32 %eax$(comma)%eax",-DHAVE_AS_SSE4_2) -$(call as-option-add,CFLAGS,CC,"invept (%rax)$(comma)%rax",-DHAVE_AS_EPT) -$(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND) -$(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE) -$(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT) -$(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED) -$(call as-option-add,CFLAGS,CC,"clac",-DHAVE_AS_CLAC_STAC) -$(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB) -$(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM) -$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) -$(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR) -$(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD) +XEN_CFLAGS += -msoft-float + +$(call cc-options-add,XEN_CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,XEN_CFLAGS,CC,-Wnested-externs) +$(call as-option-add,XEN_CFLAGS,CC,"vmcall",-DHAVE_AS_VMX) +$(call as-option-add,XEN_CFLAGS,CC,"crc32 %eax$(comma)%eax",-DHAVE_AS_SSE4_2) +$(call as-option-add,XEN_CFLAGS,CC,"invept (%rax)$(comma)%rax",-DHAVE_AS_EPT) +$(call as-option-add,XEN_CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND) +$(call as-option-add,XEN_CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE) +$(call as-option-add,XEN_CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT) +$(call as-option-add,XEN_CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED) +$(call as-option-add,XEN_CFLAGS,CC,"clac",-DHAVE_AS_CLAC_STAC) +$(call as-option-add,XEN_CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB) +$(call as-option-add,XEN_CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM) +$(call as-option-add,XEN_CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID) +$(call as-option-add,XEN_CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR) +$(call as-option-add,XEN_CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD) # GAS's idea of true is -1. Clang's idea is 1 -$(call as-option-add,CFLAGS,CC,\ +$(call as-option-add,XEN_CFLAGS,CC,\ ".if ((1 > 0) < 0); .error \"\";.endif",,-DHAVE_AS_NEGATIVE_TRUE) # Check to see whether the assmbler supports the .nop directive. -$(call as-option-add,CFLAGS,CC,\ +$(call as-option-add,XEN_CFLAGS,CC,\ ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE) -CFLAGS += -mno-red-zone -fpic +XEN_CFLAGS += -mno-red-zone -fpic # Xen doesn't use MMX or SSE interally. If the compiler supports it, also skip # the SSE setup for variadic function calls. -CFLAGS += -mno-mmx -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) +XEN_CFLAGS += -mno-mmx -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) ifeq ($(CONFIG_INDIRECT_THUNK),y) # Compile with gcc thunk-extern, indirect-branch-register if available. @@ -54,10 +54,10 @@ ifdef CONFIG_XEN_IBT # Force -fno-jump-tables to work around # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816 # https://github.com/llvm/llvm-project/issues/54247 -CFLAGS += -fcf-protection=branch -mmanual-endbr -fno-jump-tables -$(call cc-option-add,CFLAGS,CC,-fcf-check-attribute=no) +XEN_CFLAGS += -fcf-protection=branch -mmanual-endbr -fno-jump-tables +$(call cc-option-add,XEN_CFLAGS,CC,-fcf-check-attribute=no) else -$(call cc-option-add,CFLAGS,CC,-fcf-protection=none) +$(call cc-option-add,XEN_CFLAGS,CC,-fcf-protection=none) endif # If supported by the compiler, reduce stack alignment to 8 bytes. But allow @@ -91,7 +91,7 @@ efi-check := arch/x86/efi/check $(shell mkdir -p $(dir $(efi-check))) # Check if the compiler supports the MS ABI. -XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-check).c -o $(efi-check).o,y) +XEN_BUILD_EFI := $(call if-success,$(CC) $(XEN_CFLAGS) -c $(srctree)/$(efi-check).c -o $(efi-check).o,y) # Check if the linker supports PE. EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 @@ -129,4 +129,4 @@ export EFI_LDFLAGS endif # Set up the assembler include path properly for older toolchains. -CFLAGS += -Wa,-I$(objtree)/include -Wa,-I$(srctree)/include +XEN_CFLAGS += -Wa,-I$(objtree)/include -Wa,-I$(srctree)/include -- Anthony PERARD
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |