I have a strange problem when linking my user applications. When I link directly against my C library object files, no problems occur:
Code: Select all
tcc -o shell.exe -I$(INCDIR) $(LIBDIR)/crt0.o $(LIBDIR)/_syscall.o $(LIBDIR)/errno.o $(LIBDIR)/stdio.o $(LIBDIR)/stdlib.o $(LIBDIR)/string.o shell.c
Code: Select all
tiny_libmaker.exe libc.a _syscall.o errno.o stdio.o stdlib.o string.o
Code: Select all
tcc -c -o shell.o -I$(INCDIR) shell.c
tcc -o shell.exe -L$(LIBDIR) -lc $(LIBDIR)/crt0.o shell.o
tcc: undefined symbol 'stderr'
tcc: undefined symbol 'fprintf'
tcc: undefined symbol 'strcmp'
tcc: undefined symbol 'memset'
tcc: undefined symbol 'memmove'
tcc: undefined symbol 'printf'
Code: Select all
objdump -t libc.a
In archive libc.a:
_syscall.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 _syscall.c
00000000 g F .text 00000029 _sys_exit
00000029 g F .text 0000002f _sys_write
..............
stdio.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 stdio.c
00000000 l O .bss 00000400 _stdinbuf
00000400 l O .bss 00000400 _stdoutbu
00000800 l O .bss 00000400 _stderrbu
00000000 l O .data 00000010 _stdin
00000010 l O .data 00000010 _stdout
00000020 l O .data 00000010 _stderr
0000003c l O .data 00000011 L.1
00000030 g O .data 00000004 stdin
00000034 g O .data 00000004 stdout
00000038 g O .data 00000004 stderr <==
00000000 g F .text 0000002d gets_s
00000000 F *UND* 00000000 _sys_read
0000002d g F .text 0000005b printf <==
000000e0 g F .text 0000054e vsprintf
00000000 F *UND* 00000000 _sys_write
00000088 g F .text 00000058 fprintf <==
..............