Skip to content

Commit

Permalink
Don't link against libc; compile -Os (optimized for size). Shaves abo…
Browse files Browse the repository at this point in the history
…ut 8k.
  • Loading branch information
rwcr committed May 9, 2006
1 parent 62100b6 commit e6f0902
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/ipodloader2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

CROSS ?= arm-uclinux-elf-
CC = $(CROSS)gcc
MYCFLAGS = -O2 -Wall -std=gnu99 -ffreestanding -nostdinc -fomit-frame-pointer
LD = $(CROSS)ld
MYCFLAGS = -Os -Wall -std=gnu99 -ffreestanding -nostdinc -fomit-frame-pointer
# -DDEBUG
MYCPPFLAGS= -O2 -Wall -nostdinc -fomit-frame-pointer -mstructure-size-boundary=8
MYLDFLAGS = -Wl,-Tarm_elf_40.x -nostartfiles -fomit-frame-pointer
MYCPPFLAGS= -Os -Wall -nostdinc -fomit-frame-pointer -mstructure-size-boundary=8
MYLDFLAGS = -Tarm_elf_40.x `$(CC) -print-libgcc-file-name`
OBJCOPY = $(CROSS)objcopy

OBJFILES = startup.o loader.o fb.o ipodhw.o console.o minilibc.o ata2.o vfs.o fat32.o ext2.o fwfs.o keypad.o menu.o config.o macpartitions.o
Expand All @@ -26,7 +27,8 @@ loader.bin: loader.elf

loader.elf: $(OBJFILES)
@echo "Linking $@"
@$(CC) $(MYLDFLAGS) $(LDFLAGS) -o $@ $^
@$(LD) -o $@ $^ $(MYLDFLAGS)
# @$(CC) $(MYLDFLAGS) $(LDFLAGS) -o $@ $^

%.o:%.cc
@echo "Compiling $<"
Expand Down
6 changes: 6 additions & 0 deletions tools/ipodloader2/minilibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,12 @@ char *mlc_strncpy(char *dest,const char *src,size_t count) {
else return(0x00);
}

/* gcc emits code that calls memcpy() */
void *memcpy (void *dest, const void *src, size_t n)
{
return mlc_memcpy (dest, src, n);
}

void *mlc_memcpy(void *dest, const void *src, size_t n) {
// rewrite by TT 31Mar06, taking odd dest into account

Expand Down

0 comments on commit e6f0902

Please sign in to comment.