From 6c041c54bc710cf818afd630f31161ce0352ebcd Mon Sep 17 00:00:00 2001 From: ths Date: Sun, 18 Mar 2007 23:23:31 +0000 Subject: [PATCH] Disable compiler options dangerous for op compilation. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2495 c046a42c-6fe2-441c-8c8c-71466251a162 --- Makefile.target | 27 ++++++++++++++++----------- configure | 8 -------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Makefile.target b/Makefile.target index c0a79f9699..38899ff14f 100644 --- a/Makefile.target +++ b/Makefile.target @@ -70,16 +70,26 @@ BASE_LDFLAGS+=-static endif # We require -O2 to avoid the stack setup prologue in EXIT_TB -OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing +OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing + +# cc-option +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) + +cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ + > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) + +OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "") +OP_CFLAGS+=$(call cc-option, -fno-gcse, "") +OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "") +OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "") +OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "") +OP_CFLAGS+=$(call cc-option, -fno-align-labels, "") +OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "") +OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) ifeq ($(ARCH),i386) HELPER_CFLAGS+=-fomit-frame-pointer OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer -ifeq ($(HAVE_GCC3_OPTIONS),yes) -OP_CFLAGS+= -falign-functions=0 -fno-gcse -else -OP_CFLAGS+= -malign-functions=0 -endif ifdef TARGET_GPROF USE_I386_LD=y endif @@ -163,11 +173,6 @@ ifeq ($(ARCH),mips) BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld endif -ifeq ($(HAVE_GCC3_OPTIONS),yes) -# very important to generate a return at the end of every operation -OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls -endif - ifeq ($(CONFIG_DARWIN),yes) LIBS+=-lmx endif diff --git a/configure b/configure index 515d1f38ec..d64fd04be9 100755 --- a/configure +++ b/configure @@ -475,11 +475,6 @@ int main(void) { } EOF -have_gcc3_options="no" -if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then - have_gcc3_options="yes" -fi - ########################################## # SDL probe @@ -654,9 +649,6 @@ echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h echo "MAKE=$make" >> $config_mak echo "INSTALL=$install" >> $config_mak echo "CC=$cc" >> $config_mak -if test "$have_gcc3_options" = "yes" ; then - echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak -fi echo "HOST_CC=$host_cc" >> $config_mak echo "AR=$ar" >> $config_mak echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak -- 2.11.0