Lately I've been toying around with making an x86 OS, and decided to convert it from using a GCC cross compiler to using clang. Specifically, I made the Makefile use clang -target i386-pc-none and -m32. After some fighting, I finally managed to make it past the compile stage and into the linking stage, however I get this error:
/usr/bin/ld: i386:x86-64 architecture of input file `arch/i386/crtbegin.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `arch/i386/crtend.o' is incompatible with i386 output
Note that both of these files are actually non-existent on my OS and are just put there at some point during the build process by the compiler (I specifically tell it to do so in the Makefile). However, even though I have -m32 and the -target flags and also have a 32-bit libc installed (My OS is 64-bit, though), it doesn't try to link the 32 bit versions. How can I fix this?
Should the system crtbegin and crtend even be used? It's very late, I can't think at all.
All help is appreciated and I can provide more info along with source if needed, thank you!