Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It still cant build a fully working out of the box Linux kernel for x86, eg no 16 bit early boot stuff, patches for various stuff, some things not working.

It is stable though. Linux is just a hard target...



why is linux a hard target? Don't know much about compilers/how kernel compilation goes but still would appreciate some basic explanation.


1. It has always been targetted at gcc, so no serious portability work has been done, more of a co-development thing. Linux will only compile correctly on a few recent versions of gcc, you cant compile old kernels on new gcc or vice versa. 2. There is a lot of inline assembler (including oddities like x86 16 bit code) that has to work exactly as specified, such as for creating memory barriers say, or other low level constructs. Inline assembler is non standard, although clang does now implement the gcc stuff. 3. You are making an ABI, so everything must be laid out exactly the same way. Portable C does not give you exact control of padding, again there are gcc extensions. 4. Testing is hard - there are a huge number of optional modules, as well as SMP and non SMP builds, so even if you build the code with a new compiler without a lot of people using it it is hard to be sure it really works. There is no test suite...

Probably some more reasons too...


Our cparser compiler cannot even try to compile Linux, because it does not support the gcc -regparm and the -softfloat arguments. These are features that do not matter for applications (on x86).

-regparm changes the calling convention, so the first arguments must be stored in registers instead of the stack

-softfloat uses library functions to emulate floating point operations instead of the FPU




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: