Hacker News new | past | comments | ask | show | jobs | submit login
Building The Linux Kernel With LLVM/Clang Continues (phoronix.com)
56 points by protomyth on Aug 30, 2012 | hide | past | favorite | 9 comments



It would be nice if we could build the GNU utilities with it. I tried building some of the basic utilities the other day, and there were configure scripts that basically did "If the compiler name doesn't start with gcc then do lots of stupid stuff" which meant it built if I symlinked "gcc-foo" to clang and built with that, but failed if I set CC to clang.


Not the only occurrence of this problem, see http://unix.stackexchange.com/questions/16350/which-sed-vers...


One gripe I have with LLVM/Clang is that it lacks the ability to use linker scripts.

I'm writing a little OS to learn how it all works, and wanted to develop on my native Mac OS instead of an Ubuntu VM, yet Apple have symlinked 'ld' to the llvm linker, which doesn't take linker scripts like gcc's ld does.


Clang is a C/C++ compiler, it has nothing to do with linking! The lld [1] project aims to be a linker, it is still relatively young.

[1] http://lld.llvm.org/


Are you blogging about this somewhere? I've always wanted to write my own OS and I'd be fascinated to follow your progress.

edit: just found the Github: https://github.com/MattRyder/Matt-OS


Yup, you can also find my blog on my website (link in my profile)

Don't expect very much, mind, it's a side-side-project but I have been starting it up more recently. :)


Has Apple ever used GNU ld? I thought they always provided their own MachO linker, even before they started migrating to LLVM/clang.


The linker included with OS X is known as ld64 (to distinguish it from an older linker). The source code is available from http://opensource.apple.com/source/ld64/ld64-133.3/, but it is not a part of the LLVM project and only uses LLVM for LTO support.

You can produce standalone binaries with it (adding sections and modifying their attributes with command-line arguments), but it doesn't support linker scripts.


You could always use the GNU ld (or gold) with the LLVM output. Binutils is a trivially easy compile on Linux, though I'm not as certain about Darwin.

Editted to add: if you're building your OS with someone else's prepackaged toolchain, you're in for a bunch of hurt. The toolchain is, broadly, part of the OS. Writing a handful of custom linker scripts isn't the only spot where you'll need to hack at this stuff.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: