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@amd.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3175 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Jordan Crouse 2008-03-20 01:13:28 +00:00 committed by Uwe Hermann
parent 3a406feb17
commit 2c7bb9e84f
2 changed files with 6 additions and 1 deletions

View File

@ -61,7 +61,7 @@ include $(PLATFORM-y) $(BUILD-y)
INCLUDES := -I./include INCLUDES := -I./include
INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)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) libpayload.a: $(TARGETS-y)
$(AR) rc $@ $(TARGETS-y) $(AR) rc $@ $(TARGETS-y)

View File

@ -142,6 +142,11 @@ char *strncpy(char *d, const char *s, int n)
return d; 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 *strncat(char *d, const char *s, int n)
{ {
char *p = d + strlen(d); char *p = d + strlen(d);