Commit 6c041c54bc710cf818afd630f31161ce0352ebcd

Authored by ths
1 parent 11f29511

Disable compiler options dangerous for op compilation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2495 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 16 additions and 19 deletions
Makefile.target
... ... @@ -70,16 +70,26 @@ BASE_LDFLAGS+=-static
70 70 endif
71 71  
72 72 # We require -O2 to avoid the stack setup prologue in EXIT_TB
73   -OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
  73 +OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
  74 +
  75 +# cc-option
  76 +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
  77 +
  78 +cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
  79 + > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
  80 +
  81 +OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
  82 +OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
  83 +OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
  84 +OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
  85 +OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
  86 +OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
  87 +OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
  88 +OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
74 89  
75 90 ifeq ($(ARCH),i386)
76 91 HELPER_CFLAGS+=-fomit-frame-pointer
77 92 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
78   -ifeq ($(HAVE_GCC3_OPTIONS),yes)
79   -OP_CFLAGS+= -falign-functions=0 -fno-gcse
80   -else
81   -OP_CFLAGS+= -malign-functions=0
82   -endif
83 93 ifdef TARGET_GPROF
84 94 USE_I386_LD=y
85 95 endif
... ... @@ -163,11 +173,6 @@ ifeq ($(ARCH),mips)
163 173 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
164 174 endif
165 175  
166   -ifeq ($(HAVE_GCC3_OPTIONS),yes)
167   -# very important to generate a return at the end of every operation
168   -OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
169   -endif
170   -
171 176 ifeq ($(CONFIG_DARWIN),yes)
172 177 LIBS+=-lmx
173 178 endif
... ...
configure
... ... @@ -475,11 +475,6 @@ int main(void) {
475 475 }
476 476 EOF
477 477  
478   -have_gcc3_options="no"
479   -if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
480   - have_gcc3_options="yes"
481   -fi
482   -
483 478 ##########################################
484 479 # SDL probe
485 480  
... ... @@ -654,9 +649,6 @@ echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
654 649 echo "MAKE=$make" >> $config_mak
655 650 echo "INSTALL=$install" >> $config_mak
656 651 echo "CC=$cc" >> $config_mak
657   -if test "$have_gcc3_options" = "yes" ; then
658   - echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
659   -fi
660 652 echo "HOST_CC=$host_cc" >> $config_mak
661 653 echo "AR=$ar" >> $config_mak
662 654 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
... ...