Code: Select all
i586-elf-gcc -fPIC -g -W -shared -B symbolic -Werror -Wall -Wpointer-arith -Wcast-align -Wno-unused-parameter -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I ./Include/ -I ../../Kernel/Include -c "INPUT" -o "OUTPUT"
I had a problem with linking my main executable when I did that though, due to undefined references. This wasn't resolved when I attempted to link the shared library I created as a library with the -L switch. The errors were resolved when I tacked the shared library onto the end of the input object file paths, and I can boot my OS.
I know that this doesn't completely link the library though (maybe it just adds some entries to the v-tables?), because when I enter a command which uses the library I get a page fault. Clearly I need to relocate and link the library. Unfortunately, I don't know how to do this. I have the shared library loaded by GrUB as a module, so there aren't any problems accessing it. So I suppose my question is this: how do I dynamically link a shared library into my kernel? If it makes any difference (to be honest I don't see how it could), the shared library is written in C++