Page 1 of 1

CrazyLib

Posted: Tue Apr 01, 2003 9:34 pm
by Mastermind
I've compiled this library into a *.o file. Can I link my kernel and other prgms to it? What i mean is this:

Code: Select all

gxx -c kernel.c -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions

NASM -f coff kernel2.asm

ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel2.o libc.o kernel.o

libc.o is the compiled library.
When i tried linking the kernel with the lib, the linker said that there were several bad references (as if it cannot find the functions in the libc.o).
What can I do to make it work? Someone told me to declare every lib function as extern, but it still didn't work... Solution please?

Thanks in advance...

Re:CrazyLib

Posted: Wed Apr 02, 2003 2:33 am
by Pype.Clicker
maybe you should give your library another name (libc is usually the C language support library or something alike :-/ )

i would suggest you to check what is in libc.o using objdump -x libc.o ...

also make sure there isn't an extra leading "_" in the symbols it exports. Could you show us a few of these linking errors and how libc.o and kernel.c do use these symbols ?

Under some system, the linker will also fail to retrieve the proper function if it has a different return type than what is expected ...