So, I decided I was going to go a different route and synthesize my own libc out of BSD libcs out there(most notably OpenBSDs)
Well, I got all the string stuff copied in and made a nice generic makefile for it and got it to all compile. Then I put it into a library with
Code: Select all
/usr/cross/i586-elf/bin/ar crs ${OUTFILE} ${OBJS}
so libc.a goes into my lib directory and I make a simple C program that includes string.h and references strlen
the relevant part of my linker script is
Code: Select all
ENTRY (__main)
OUTPUT_FORMAT(binary)
STARTUP(../../lib/crt0.o)
SEARCH_DIR(../../lib)
Code: Select all
LDFLAGS = -nostartfiles -nodefaultlibs -nostdlib -lc
...
login.bin: ${OBJS}
ld -T ../../A56.ld ${LDFLAGS} ${OBJS} -o ${OUTFILE}
anyone see what I'm doing wrong here with lcreating and linking with this library?
edit:
oh wait, I didn't compile the sources with the cross compiler, only tried linking them.
but now I have a problem with my cross compiler. It didn't generate _types.h and cdefs.h files, and I tried copying them from my main compiler's include, but it doesn't work cause the cross compiler doesn't recognize __int32 and such things used internally