[coreboot] [v2] r4679 - in trunk/coreboot-v2/src: config lib

svn at coreboot.org svn at coreboot.org
Sat Sep 26 17:52:06 CEST 2009


Author: stepan
Date: 2009-09-26 17:52:05 +0200 (Sat, 26 Sep 2009)
New Revision: 4679

Added:
   trunk/coreboot-v2/src/lib/gcc.c
Modified:
   trunk/coreboot-v2/src/config/Config.lb
   trunk/coreboot-v2/src/lib/Config.lb
   trunk/coreboot-v2/src/lib/Makefile.inc
Log:
* drop libgcc from coreboot_apc.o, not needed.
* wrap libgcc calls into regparm(0) variants so that coreboot can be compiled
  with other regparm values

Signed-off-by: Stefan Reinauer <stepan at coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>



Modified: trunk/coreboot-v2/src/config/Config.lb
===================================================================
--- trunk/coreboot-v2/src/config/Config.lb	2009-09-25 22:21:47 UTC (rev 4678)
+++ trunk/coreboot-v2/src/config/Config.lb	2009-09-26 15:52:05 UTC (rev 4679)
@@ -47,7 +47,7 @@
 
 makerule coreboot_ram.o
 	depends	"src/arch/$(CONFIG_ARCH)/lib/c_start.o $(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)" 
-	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ src/arch/$(CONFIG_ARCH)/lib/c_start.o $(DRIVER) -Wl,-\( coreboot.a $(LIBGCC_FILE_NAME) -Wl,-\)"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ src/arch/$(CONFIG_ARCH)/lib/c_start.o $(DRIVER) -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,-\( coreboot.a $(LIBGCC_FILE_NAME) -Wl,-\)"
 end
 
 makerule coreboot_ram
@@ -89,7 +89,7 @@
 	end
 
 	makerule coreboot_apc.o
-		depends "src/arch/$(CONFIG_ARCH)/lib/c_start.o coreboot_apc.a $(LIBGCC_FILE_NAME)"
+		depends "src/arch/$(CONFIG_ARCH)/lib/c_start.o coreboot_apc.a"
         	action  "$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ $^"
 	end
 

Modified: trunk/coreboot-v2/src/lib/Config.lb
===================================================================
--- trunk/coreboot-v2/src/lib/Config.lb	2009-09-25 22:21:47 UTC (rev 4678)
+++ trunk/coreboot-v2/src/lib/Config.lb	2009-09-26 15:52:05 UTC (rev 4679)
@@ -17,6 +17,8 @@
 object fallback_boot.o
 object compute_ip_checksum.o
 object version.o
+object gcc.o
+
 # Force version.o to recompile every time
 makedefine .PHONY : version.o
 

Modified: trunk/coreboot-v2/src/lib/Makefile.inc
===================================================================
--- trunk/coreboot-v2/src/lib/Makefile.inc	2009-09-25 22:21:47 UTC (rev 4678)
+++ trunk/coreboot-v2/src/lib/Makefile.inc	2009-09-26 15:52:05 UTC (rev 4679)
@@ -12,6 +12,7 @@
 obj-y += cbfs.o
 obj-y += lzma.o
 #obj-y += lzmadecode.o
+obj-y += gcc.o
 
 initobj-y += uart8250.o
 initobj-y += memset.o

Added: trunk/coreboot-v2/src/lib/gcc.c
===================================================================
--- trunk/coreboot-v2/src/lib/gcc.c	                        (rev 0)
+++ trunk/coreboot-v2/src/lib/gcc.c	2009-09-26 15:52:05 UTC (rev 4679)
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2009 coresystems GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+/* GCC's libgcc handling is quite broken. While the libgcc functions
+ * are always regparm(0) the code that calls them uses whatever the
+ * compiler call specifies. Therefore we need a wrapper around those
+ * functions. See gcc bug PR41055 for more information.
+ */
+
+#define WRAP_LIBGCC_CALL(type, name) \
+	type __real_##name(type a, type b) __attribute__((regparm(0))); \
+	type __wrap_##name(type a, type b) { return __real_##name(a, b); }
+
+WRAP_LIBGCC_CALL(long long, __divdi3)
+WRAP_LIBGCC_CALL(unsigned long long, __udivdi3)
+WRAP_LIBGCC_CALL(long long, __moddi3)
+WRAP_LIBGCC_CALL(unsigned long long, __umoddi3)
+





More information about the coreboot mailing list