5 ms·
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 o
by csmattryder 14y ago
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.
- ajross 14y agoYou 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.
- TallGuyShort 14y agoAre 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 https://github.com/MattRyder/Matt-OS
- csmattryder 14y agoYup, 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. :)
- maximilianburke 14y agoHas Apple ever used GNU ld? I thought they always provided their own MachO linker, even before they started migrating to LLVM/clang.
- cokernel_hacker 14y agoClang 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/ http://lld.llvm.org/
- cwzwarich 14y agoThe 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/ 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.