Cross compiler cannot find crt0.o / crti.o / crtn.o
Posted: Sat Jun 25, 2016 1:25 pm
Context: I've been following the tutorials on the Osdev wiki. I'm now in a position where I've got the Meaty Skeleton codebase, and I've followed the OS-specific toolchain and Hosted GCC cross-compiler guides, resulting in a set of i686-substrata-* tools.
I also opted for making my own libc rather than using a prebuilt one. For now I've just provided enough of the standard headers so that libgcc builds successfully (as per the guide)
When using i686-substrata-gcc to try to build a simple user space program (literally just int main() { return 0; } ), I receive the following errors:
Ok, the first error makes sense, as I haven't yet made a crt0.o of my own. On the Creating a C library tutorial, it shows a crt0.s source for x86_64.
I apologise if my questions make no sense or have blindingly obvious answers. Any guidance is much appreciated.
I also opted for making my own libc rather than using a prebuilt one. For now I've just provided enough of the standard headers so that libgcc builds successfully (as per the guide)
When using i686-substrata-gcc to try to build a simple user space program (literally just int main() { return 0; } ), I receive the following errors:
Code: Select all
/home/martin/opt/substrata/lib/gcc/i686-substrata/6.1.0/../../../../i686-substrata/bin/ld: cannot find crt0.o: No such file or directory
/home/martin/opt/substrata/lib/gcc/i686-substrata/6.1.0/../../../../i686-substrata/bin/ld: cannot find crti.o: No such file or directory
/home/martin/opt/substrata/lib/gcc/i686-substrata/6.1.0/../../../../i686-substrata/bin/ld: cannot find crtn.o: No such file or directory
- 1. Am I correct in assuming that I can't just use that crt0.s example, because my cross toolchain is 32-bit (i686-substrata-*) and not 64-bit (x86_64-substrata-*)?
2. How would I go about making an x86 version of crt0.s? More than just changing register names and the calling convention?
3. What is involved in creating an x86_64 version of the cross toolchain?
I apologise if my questions make no sense or have blindingly obvious answers. Any guidance is much appreciated.