aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-06-24 15:55:43 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-06-24 15:55:43 -0700
commite93f618c0b216dd9392dc0865ad28ea53e971cdc (patch)
tree8ca260c37babfe93598e0e329063be308034d81f
parent67222ab2f96d1bd29566b3452f1a003d0641609a (diff)
downloadsyslinux-elf-e93f618c0b216dd9392dc0865ad28ea53e971cdc.tar.gz
syslinux-elf-e93f618c0b216dd9392dc0865ad28ea53e971cdc.tar.xz
syslinux-elf-e93f618c0b216dd9392dc0865ad28ea53e971cdc.zip
MCONFIG: build GCCOPT one step at a time, don't align stack
Some gcc options are only valid together with other gcc options, so build GCCOPT one bit at a time, and change gcc_ok to take already existing GCCOPT flags into account. This lets us build with -mpreferred-stack-boundary=2, which is only valid on 32 bits and therefore with -m32. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--MCONFIG3
-rw-r--r--MCONFIG.embedded16
-rw-r--r--com32/MCONFIG15
-rw-r--r--com32/lib/MCONFIG16
4 files changed, 31 insertions, 19 deletions
diff --git a/MCONFIG b/MCONFIG
index b98c5723..894bf235 100644
--- a/MCONFIG
+++ b/MCONFIG
@@ -41,7 +41,8 @@ CHMOD = chmod
CC = gcc
gcc_ok = $(shell tmpf=gcc_ok.$$$$.tmp; \
- if $(CC) $(1) -c $(topdir)/dummy.c -o $$tmpf 2>/dev/null ; \
+ if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \
+ -o $$tmpf 2>/dev/null ; \
then echo '$(1)'; else echo '$(2)'; fi; \
rm -f $$tmpf)
diff --git a/MCONFIG.embedded b/MCONFIG.embedded
index 586afc3e..b5c8f5da 100644
--- a/MCONFIG.embedded
+++ b/MCONFIG.embedded
@@ -16,14 +16,16 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-m32,) \
- $(call gcc_ok,-ffreestanding,) \
- $(call gcc_ok,-fno-stack-protector,) \
- $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
- $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
- $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
- -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
+GCCOPT := $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-ffreestanding,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
-msoft-float
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
diff --git a/com32/MCONFIG b/com32/MCONFIG
index 6d25b2d4..0fa78028 100644
--- a/com32/MCONFIG
+++ b/com32/MCONFIG
@@ -17,11 +17,16 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
- $(call gcc_ok,-fPIE,-fPIC) \
- -mregparm=3 -DREGPARM=3 -march=i386 -Os
+GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += -mregparm=3 -DREGPARM=3 -march=i386 -Os
+GCCOPT += $(call gcc_ok,-fPIE,-fPIC)
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
com32 := $(topdir)/com32
RELOCS := $(com32)/tools/relocs
diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG
index ba23c91e..d5395294 100644
--- a/com32/lib/MCONFIG
+++ b/com32/lib/MCONFIG
@@ -2,10 +2,15 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
- $(call gcc_ok,-fPIE,-fPIC)
+GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += $(call gcc_ok,-fPIE,-fPIC)
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
INCLUDE = -I.
STRIP = strip --strip-all -R .comment -R .note
@@ -23,8 +28,7 @@ LIBFLAGS = -DDYNAMIC_CRC_TABLE -DPNG_NO_CONSOLE_IO \
REQFLAGS = $(GCCOPT) -g -mregparm=3 -DREGPARM=3 -D__COM32__ \
-nostdinc -iwithprefix include -I. -I./sys -I../include
-OPTFLAGS = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \
- -falign-labels=0 -ffast-math -fomit-frame-pointer
+OPTFLAGS = -Os -march=i386 -ffast-math -fomit-frame-pointer
WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline
CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS)