aboutsummaryrefslogtreecommitdiff
path: root/Makefile.target
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-18 23:23:31 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-18 23:23:31 +0000
commit6c041c54bc710cf818afd630f31161ce0352ebcd (patch)
tree256f46e96e4347c664ca17d2241de61fa4fdead4 /Makefile.target
parent11f295118c5b78910b0b26c1a856944016895ec8 (diff)
Disable compiler options dangerous for op compilation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2495 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'Makefile.target')
-rw-r--r--Makefile.target27
1 files changed, 16 insertions, 11 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