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
$(CC) $(CFLAGS) -o $@ $<
%.elf: %.o $(FIRMWARE) $(LDFILE)
$(LD) $(LDFLAGS) -T $(LDFILE) -o $@ $<
%.elf: %.o $(FIRMWARE) $(LDFILE) libmemcpy.a
$(LD) $(LDFLAGS) -T $(LDFILE) -o $@ $< -L. -lmemcpy
$(SIZE) $@
%.bin: %.elf
@ -85,6 +85,13 @@ $(OBJS): usetable.h
usetable.h:
./mktable.pl
help/memcpy.o: help/memcpy.c
libmemcpy.a: help/memcpy.o
$(AR) rcs $@ $<
$(RANLIB) $(RANLIBFLAGS) $@
.SUFFIXES:
.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;
my $DIR="l0dable";
my $memcpy;
if( -d "../$DIR"){
chdir("..");
@ -105,10 +106,16 @@ for my $idx (0..$#symb){
print C "$_,";
};
print I "#define $_ ($types{$_}(TheTable[$idx]))";
if($_ eq "memcpy" || $_ eq "memmove"){
$memcpy=$idx
};
};
print C "};";
if (defined($memcpy)){
print I "#define _memcpy_nr $memcpy";
};
close(I);
close(H);
close(C);