CrazyLib

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Mastermind

CrazyLib

Post 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...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:CrazyLib

Post 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 ...
Post Reply