提交 a47f0d63 编写于 作者: O ohair

7038711: Fix CC_VER checks for compiler options, fix use of -Wno-clobber

Reviewed-by: igor
上级 ebb14969
...@@ -251,9 +251,8 @@ LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) ...@@ -251,9 +251,8 @@ LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
# statically link libgcc but will print a warning with the flag. We don't # statically link libgcc but will print a warning with the flag. We don't
# want the warning, so check gcc version first. # want the warning, so check gcc version first.
# #
CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) ifeq ($(CC_MAJORVER),3)
ifeq ("$(CC_VER_MAJOR)", "3") OTHER_LDFLAGS += -static-libgcc
OTHER_LDFLAGS += -static-libgcc
endif endif
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch) # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
......
...@@ -457,14 +457,15 @@ else ...@@ -457,14 +457,15 @@ else
# On X86, make sure tail call optimization is off # On X86, make sure tail call optimization is off
# The z and y are the tail call optimizations. # The z and y are the tail call optimizations.
ifeq ($(ARCH_FAMILY), i586) ifeq ($(ARCH_FAMILY), i586)
ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1) CC_NEWER_THAN_58 := \
ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 8), 1) $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
# Somehow, tail call optimization is creeping in. \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) )
# Make sure it is off. ifeq ($(CC_NEWER_THAN_58),1)
# WARNING: These may cause compiler warnings about duplicate -O options # Somehow, tail call optimization is creeping in.
CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz # Make sure it is off.
CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz # WARNING: These may cause compiler warnings about duplicate -O options
endif CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
endif endif
endif endif
...@@ -481,14 +482,15 @@ else ...@@ -481,14 +482,15 @@ else
CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
endif endif
ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1) CC_NEWER_THAN_56 := \
ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 6), 1) $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
# Do NOT use frame pointer register as a general purpose opt register \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
CC_OPT/NONE += -xregs=no%frameptr ifeq ($(CC_NEWER_THAN_56),1)
CXX_OPT/NONE += -xregs=no%frameptr # Do NOT use frame pointer register as a general purpose opt register
CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr CC_OPT/NONE += -xregs=no%frameptr
CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr CXX_OPT/NONE += -xregs=no%frameptr
endif CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
endif endif
endif endif
...@@ -566,8 +568,10 @@ else ...@@ -566,8 +568,10 @@ else
CFLAGS_REQUIRED_sparc += -xregs=no%appl CFLAGS_REQUIRED_sparc += -xregs=no%appl
CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
endif endif
ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) CC_NEWER_THAN_56 := \
# We MUST allow data alignment of 4 for sparc V8 (32bit) $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
\( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
ifeq ($(CC_NEWER_THAN_56),1)
# Presents an ABI issue with customer JNI libs? We must be able to # Presents an ABI issue with customer JNI libs? We must be able to
# to handle 4byte aligned objects? (rare occurance, but possible?) # to handle 4byte aligned objects? (rare occurance, but possible?)
CFLAGS_REQUIRED_sparc += -xmemalign=4s CFLAGS_REQUIRED_sparc += -xmemalign=4s
......
...@@ -87,6 +87,8 @@ endif ...@@ -87,6 +87,8 @@ endif
# Get gcc version # Get gcc version
_CC_VER :=$(shell $(CC) -dumpversion 2>&1 ) _CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
CC_VER :=$(call GetVersion,"$(_CC_VER)") CC_VER :=$(call GetVersion,"$(_CC_VER)")
CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
CC_MINORVER :=$(call MinorVersion,$(CC_VER))
# Name of compiler # Name of compiler
COMPILER_NAME = GCC$(call MajorVersion,$(CC_VER)) COMPILER_NAME = GCC$(call MajorVersion,$(CC_VER))
......
...@@ -117,7 +117,10 @@ ifeq ($(ARCH_FAMILY), i586) ...@@ -117,7 +117,10 @@ ifeq ($(ARCH_FAMILY), i586)
LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64 LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64
endif endif
# Pick the options we want based on the compiler being used. (5.9 or newer) # Pick the options we want based on the compiler being used. (5.9 or newer)
ifeq ($(shell expr $(CC_MINORVER) \>= 9), 1) CC_59_OR_NEWER := \
$(shell expr $(CC_MAJORVER) \> 5 \| \
\( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \>= 9 \) )
ifeq ($(CC_59_OR_NEWER), 1)
XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32) XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32)
XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64) XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64)
LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32) LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32)
......
...@@ -73,9 +73,14 @@ ifeq ($(PLATFORM), linux) ...@@ -73,9 +73,14 @@ ifeq ($(PLATFORM), linux)
# Recommended way to avoid such warning is to declare the variable as # Recommended way to avoid such warning is to declare the variable as
# volatile to prevent the optimization. However, this approach does not # volatile to prevent the optimization. However, this approach does not
# work because we have to declare all variables as volatile in result. # work because we have to declare all variables as volatile in result.
ifndef CROSS_COMPILE_ARCH ifndef CROSS_COMPILE_ARCH
OTHER_CFLAGS += -Wno-clobbered CC_43_OR_NEWER := \
endif $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
\( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
ifeq ($(CC_43_OR_NEWER),1)
OTHER_CFLAGS += -Wno-clobbered
endif
endif
endif endif
include $(BUILDDIR)/common/Mapfile-vers.gmk include $(BUILDDIR)/common/Mapfile-vers.gmk
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册