Right now I'm almost satisified with how things build, here's a quick overview
./build.sh
- Passes control to /stdcpp/build.sh, which builds my "standard" library (it's not really standard if its mine )
-- If an error occours, build stops and prints out errors
- Passes control to /kernel/build.sh, which builds my kernel, linking to all required .o files
.asm are compiled to .ao, .c to .o, and .cpp to .opp. If globally usable, files are placed into a ./out/ directory.
The problem is that I've got a library file that needs both a .cpp and .asm. I can get it to work by linking the kernel to both the .ao and .opp, but I'd rather combine the .ao and .opp so that I can have full functionality while only linking to one file. (This would maintain the globally usability)
The concept is to compile the parts in the source structure, link the resulting parts, and send the single, usable output to ./out/
I gave it a try by running the following command
Code: Select all
i686-elf-ld stdo.ao stdo.opp -o ${BUILD}/out/stdo.lo -ffreestanding -O2 -nostdlib -shared
Unfortunately doing this builds fine, but it breaks the OS, so I'd imagine that I'm missing something low-level.
TLDR I've got two static library files resulting from nasm and gcc that need to be linked together to be used. Since they aren't executable I cannot (I assume) link using
Code: Select all
gcc -T linker.ld -o file.elf -ffreestanding -O2 -nostdlib file.o file1.o -lgcc
How do I go about linking them together so I can then link to the single file everywhere it is used?