aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mk/com32.mk4
-rw-r--r--mk/elf.mk4
-rw-r--r--mk/embedded.mk5
-rw-r--r--mk/lib.mk4
4 files changed, 17 insertions, 0 deletions
diff --git a/mk/com32.mk b/mk/com32.mk
index 89ede83e..55dc10c2 100644
--- a/mk/com32.mk
+++ b/mk/com32.mk
@@ -48,6 +48,10 @@ 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)
+ifndef EFI_BUILD
+GCCOPT += -mregparm=3 -DREGPARM=3
+endif
+
com32 := $(topdir)/com32
RELOCS := $(com32)/tools/relocs
diff --git a/mk/elf.mk b/mk/elf.mk
index faca4e1a..8f2421a8 100644
--- a/mk/elf.mk
+++ b/mk/elf.mk
@@ -60,6 +60,10 @@ CFLAGS = $(GCCOPT) -W -Wall \
-I$(com32)/libutil/include -I$(com32)/include \
-I$(com32)/include/sys $(GPLINCLUDE) -I$(core)/include \
-I$(objdir) -DLDLINUX=\"$(LDLINUX)\"
+ifndef EFI_BUILD
+CFLAGS += -mregparm=3 -DREGPARM=3
+endif
+
SFLAGS = $(GCCOPT) -D__COM32__
LDFLAGS = -m elf_$(ARCH) -shared --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld --as-needed
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
diff --git a/mk/embedded.mk b/mk/embedded.mk
index 5a7632e9..1614d8bc 100644
--- a/mk/embedded.mk
+++ b/mk/embedded.mk
@@ -38,7 +38,12 @@ GCCOPT += $(call gcc_ok,-ffreestanding,)
GCCOPT += $(call gcc_ok,-fno-stack-protector,)
GCCOPT += $(call gcc_ok,-fwrapv,)
GCCOPT += $(call gcc_ok,-freg-struct-return,)
+ifdef EFI_BUILD
GCCOPT += -Os -fomit-frame-pointer -msoft-float
+else
+GCCOPT += -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
+ -msoft-float
+endif
GCCOPT += $(call gcc_ok,-fno-exceptions,)
GCCOPT += $(call gcc_ok,-fno-asynchronous-unwind-tables,)
GCCOPT += $(call gcc_ok,-fno-strict-aliasing,)
diff --git a/mk/lib.mk b/mk/lib.mk
index 596e9284..6ae26c86 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -54,6 +54,10 @@ WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winl
CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS)
+ifndef EFI_BUILD
+CFLAGS += -mregparm=3 -DREGPARM=3
+endif
+
VPATH = $(SRC)
LIBOTHER_OBJS = \
atoi.o atol.o atoll.o calloc.o creat.o \