mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Replace test-gcc-flag with Linux-style cc-option.
Improve on Linux implementation by looking for any output on stdout/stderr. This indicates badness. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
923fbdf607
commit
f9038804d6
5 files changed
+28
-25
No files matched your search
@@ -26,7 +26,10 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
|
||||
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
|
||||
endif
|
||||
|
||||
test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep " $(2) " >/dev/null 2>&1 && echo $(2))
|
||||
# cc-option
|
||||
# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
|
||||
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
|
||||
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
|
||||
|
||||
ifneq ($(debug),y)
|
||||
CFLAGS += -DNDEBUG
|
||||
@@ -42,8 +45,8 @@ CFLAGS += -Wall -Wstrict-prototypes
|
||||
# result of any casted expression causes a warning.
|
||||
CFLAGS += -Wno-unused-value
|
||||
|
||||
HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
|
||||
HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,)
|
||||
CFLAGS += $(call cc-option,$(CC),-Wdeclaration-after-statement,)
|
||||
|
||||
LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
|
||||
CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
|
||||
|
||||
@@ -32,9 +32,9 @@ DEFINES =-DDEBUG
|
||||
XENINC =-I$(XEN_ROOT)/tools/libxc
|
||||
|
||||
# Disable PIE/SSP if GCC supports them. They can break us.
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-nopie)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
|
||||
CFLAGS += $(call cc-option,$(CC),-nopie,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
|
||||
|
||||
OBJCOPY = objcopy
|
||||
CFLAGS += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
|
||||
|
||||
@@ -32,9 +32,9 @@ DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR)
|
||||
XENINC=-I$(XEN_ROOT)/tools/libxc
|
||||
|
||||
# Disable PIE/SSP if GCC supports them. They can break us.
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-nopie)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
|
||||
CFLAGS += $(call cc-option,$(CC),-nopie,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
|
||||
|
||||
CPP = cpp -P
|
||||
OBJCOPY = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
|
||||
|
||||
@@ -23,7 +23,7 @@ VPATH+=:$(SRC_PATH)/linux-user
|
||||
DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
|
||||
endif
|
||||
CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
|
||||
SSE2 := $(call test-gcc-flag,$(CC),-msse2)
|
||||
SSE2 := $(call cc-option,$(CC),-msse2,)
|
||||
ifeq ($(SSE2),-msse2)
|
||||
CFLAGS += -DUSE_SSE2=1 -msse2
|
||||
endif
|
||||
|
||||
+15
-15
@@ -11,26 +11,26 @@ HAS_VGA := y
|
||||
pae ?= n
|
||||
supervisor_mode_kernel ?= n
|
||||
|
||||
CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
|
||||
CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
|
||||
CFLAGS += -I$(BASEDIR)/include
|
||||
CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
|
||||
CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
|
||||
CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
|
||||
CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
|
||||
CFLAGS += -I$(BASEDIR)/include
|
||||
CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
|
||||
CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
|
||||
|
||||
# Prevent floating-point variables from creeping into Xen.
|
||||
CFLAGS += -msoft-float
|
||||
CFLAGS += -msoft-float
|
||||
|
||||
# Disable PIE/SSP if GCC supports them. They can break us.
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-nopie)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector)
|
||||
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
|
||||
CFLAGS += $(call cc-option,$(CC),-nopie,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
|
||||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
|
||||
|
||||
ifeq ($(TARGET_SUBARCH)$(pae),x86_32y)
|
||||
CFLAGS += -DCONFIG_X86_PAE=1
|
||||
CFLAGS += -DCONFIG_X86_PAE=1
|
||||
endif
|
||||
|
||||
ifeq ($(supervisor_mode_kernel),y)
|
||||
CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
|
||||
CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
|
||||
endif
|
||||
|
||||
ifeq ($(XEN_TARGET_ARCH),x86_32)
|
||||
@@ -39,11 +39,11 @@ x86_64 := n
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_SUBARCH),x86_64)
|
||||
CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
|
||||
CFLAGS += -fno-asynchronous-unwind-tables
|
||||
CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
|
||||
CFLAGS += -fno-asynchronous-unwind-tables
|
||||
# -fvisibility=hidden reduces -fpic cost, if it's available
|
||||
CFLAGS += $(shell $(CC) -v --help 2>&1 | grep " -fvisibility=" | \
|
||||
grep -q hidden && echo "-DGCC_HAS_VISIBILITY_ATTRIBUTE")
|
||||
CFLAGS += $(call cc-option,$(CC),-fvisibility=hidden,)
|
||||
CFLAGS := $(subst -fvisibility=hidden,-DGCC_HAS_VISIBILITY_ATTRIBUTE,$(CFLAGS))
|
||||
x86_32 := n
|
||||
x86_64 := y
|
||||
endif
|
||||
|
||||