ThisMayWork wrote:Thank you for your reply. I understand why using my host's compiler can be a bad idea, but why is the linker OS-related? I mean, of course in this case it's missing an option and god knows what else, but generally it's not OS specific, right?
A linker must not be OS specific in general, but the linker that you for your system get most probably is. You should really build your own, because the bare i686-elf toolchain that you make builds clean elf binaries without including anything that you don't want to be included.
Your OS X linker will most probably link the
CRT objects (required so that the program can even start on the OS) and some system libraries to your binary. This can only be bypassed by passing a lot of ugly flags to your compiler & linker - you will not need to do that if you make a cross toolchain.
For example you later will also want modify the LD it so that it includes things you want, like libraries specific to your OS - this is then called a
OS specific toolchain. For the beginning, a simple cross compiler is enough, later you can do a lot of cool stuff by using that