[coreboot] r3175 - in trunk/payloads/libpayload: . libc

svn at coreboot.org svn at coreboot.org
Thu Mar 20 02:13:28 CET 2008


Author: uwe
Date: 2008-03-20 02:13:28 +0100 (Thu, 20 Mar 2008)
New Revision: 3175

Modified:
   trunk/payloads/libpayload/Makefile
   trunk/payloads/libpayload/libc/string.c
Log:
libpayload: Add -Os to the CFLAGS

Adding -Os to the CFLAGS gains us about 25% smaller code (give or take).
Unfortunately, it exposes a strange issue where strcpy() suddenly goes
missing - we think that strcpy() is being provided by libgcc, and that
for some reason, -Os changes the beahavior.  Oh, well - add a quick
strcpy() function and we're good.

Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>



Modified: trunk/payloads/libpayload/Makefile
===================================================================
--- trunk/payloads/libpayload/Makefile	2008-03-20 01:11:28 UTC (rev 3174)
+++ trunk/payloads/libpayload/Makefile	2008-03-20 01:13:28 UTC (rev 3175)
@@ -61,7 +61,7 @@
 
 INCLUDES := -I./include
 INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
-CFLAGS := -Werror -fno-stack-protector -nostdinc $(INCLUDES)
+CFLAGS := -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
 
 libpayload.a: $(TARGETS-y)
 	$(AR) rc $@ $(TARGETS-y)

Modified: trunk/payloads/libpayload/libc/string.c
===================================================================
--- trunk/payloads/libpayload/libc/string.c	2008-03-20 01:11:28 UTC (rev 3174)
+++ trunk/payloads/libpayload/libc/string.c	2008-03-20 01:13:28 UTC (rev 3175)
@@ -142,6 +142,11 @@
 	return d;
 }
 
+char *strcpy(char *d, const char *s)
+{
+	return strncpy(d, s, strlen(s));
+}
+
 char *strncat(char *d, const char *s, int n)
 {
 	char *p = d + strlen(d);





More information about the coreboot mailing list