Add "fake memcpy" lib so broken gcc can compile this

This commit is contained in:
Stefan `Sec` Zehl 2012-01-24 00:18:36 +01:00
parent f17893c8b1
commit f823ef2504
3 changed files with 26 additions and 2 deletions

View File

@ -43,8 +43,8 @@ $(LDFILE):
%.o : %.c %.o : %.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
%.elf: %.o $(FIRMWARE) $(LDFILE) %.elf: %.o $(FIRMWARE) $(LDFILE) libmemcpy.a
$(LD) $(LDFLAGS) -T $(LDFILE) -o $@ $< $(LD) $(LDFLAGS) -T $(LDFILE) -o $@ $< -L. -lmemcpy
$(SIZE) $@ $(SIZE) $@
%.bin: %.elf %.bin: %.elf
@ -85,6 +85,13 @@ $(OBJS): usetable.h
usetable.h: usetable.h:
./mktable.pl ./mktable.pl
help/memcpy.o: help/memcpy.c
libmemcpy.a: help/memcpy.o
$(AR) rcs $@ $<
$(RANLIB) $(RANLIBFLAGS) $@
.SUFFIXES: .SUFFIXES:
.PHONY: $(LDFILE) .PHONY: $(LDFILE)

View File

@ -0,0 +1,10 @@
#include <string.h>
#include "../usetable.h"
#undef memcpy
void * memcpy(void *dst, const void *src, size_t len){
return
(*(void * (*)(void *, const void *, size_t ))(*(TheTable+_memcpy_nr)))
(dst, src, len);
};

View File

@ -5,6 +5,7 @@
use strict; use strict;
my $DIR="l0dable"; my $DIR="l0dable";
my $memcpy;
if( -d "../$DIR"){ if( -d "../$DIR"){
chdir(".."); chdir("..");
@ -105,10 +106,16 @@ for my $idx (0..$#symb){
print C "$_,"; print C "$_,";
}; };
print I "#define $_ ($types{$_}(TheTable[$idx]))"; print I "#define $_ ($types{$_}(TheTable[$idx]))";
if($_ eq "memcpy" || $_ eq "memmove"){
$memcpy=$idx
};
}; };
print C "};"; print C "};";
if (defined($memcpy)){
print I "#define _memcpy_nr $memcpy";
};
close(I); close(I);
close(H); close(H);
close(C); close(C);