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

Posting this news article is my way to get the attention of Debian, Arch, Gentoo, Homebrew, NixOS, and other package maintainers. As an upstream compiler developer [1], I want to depend on LLD instead of the system linker, and the sooner LLD becomes ubiquitous in the various package managers, the sooner I can depend on it. (Of course I could ask my users to compile it from source, but that increases overhead of people getting started.)

Further evidence that it is time for LLD to be distributed along with LLVM: http://lists.llvm.org/pipermail/llvm-dev/2017-February/11030...

[1]: http://ziglang.org/



As someone mildly informed of Rust language development, I can confirm that they as well would be over the moon if LLD were usable on all LLVM targets. It's been a long, long anticipated feature.


Package maintainers aren't like the President. You don't need news media to get their attention. You can just e-mail them.


That sounds like an O(N) solution.

More seriously, being a package maintainer myself I know that the goal is to serve the users and create packages that users expect. So, the best way to get package maintainers to include LLD is to get users to expect it.


Well they kind of are, it's up to them to decide what kind of software millions of users are able to install.


can you elaborate on the advantages offered by using LLD over the system linker? is it purely for the sake of consistency, or does this decrease the size of your compiler's frontend component?


To me, the biggest advantage is cross compiling.

I started working on a proof of concept operating system, and according to the OS Dev Wiki, the first thing you have to do to get started is to build a cross compiler. This is because by default the C compiler and linker are compiled only for the current system. When I started making the OS in Zig, however, I did not have to build a special cross compilation version of Zig, because it supports cross compilation out of the box for every target and OS. For example, unlike in C, compiler_rt/libgcc are shipped with the compiler in source form and built lazily for the desired target.

So not having to build or obtain a special gcc was nice, however, I did have to build a cross compiled GNU binutils so that I could use an ARM linker on an x86_64 host. If I can depend on LDD, then I can support cross compiling for every target with no other dependencies needed.


This "first build a cross compiler" is ingrained for OS/embedded people. It is a shame, because it is just a GCC weirdness.


Yes, I still remember the days where each compiler had its own linker, optimized for the specific language semantics.

Using the system linker means throwing away those benefits, in name of lowest common denominator.


Go (well, its main compiler, not gccgo) is one of the few languages that does everything by itself. It's awesome. I can just tell it to compile to FreeBSD/arm on a Darwin/amd64 box and it will just fucking do it!


System linkers are a UNIX thing.

On the majority of other OSes, each programming language used to have its own linker.

This is why although I dislike some of Go's decisions, I am quite supportive of its uptake.

- Bostraped language, with very few dependencies on C

- Runtime library makes direct use of syscalls, instead of taking the easy way and depend on libc

- It has its own linker

- Despite the GC hate and the whole discussion what is "systems programming", people are indeed slowly using for such purposes


I spend essentially all of my time cross compiling stuff (as in, 99% of my development is cross compilation; I have two projects with a local target, on earth of which is never used on that target an is one of which is seldom used on that target: almost all of my users are using my software on non-native targets from any of my development systems). I have one project in particular which targets 20 different operating system / platform combinations as part of one build process.

I can tell you that even when I am using clang and LLVM to target another system, except for minor variations where I am targeting the same operating system and the same vendor with the same target executable format across only different CPU vendors (i.e.: Apple), I still have to end up with different full cross-compiler tool chains, often based on entirely different forks of the code base for LLVM.

Even if it were possible, and it is not clear to me that it is or that it would even be desirable (as you still need a set of highly platform-specific libraries and header files, even for weirdly quirked-up core libraries like the moral equivalents of libgcc that are needed for every subplatform, due to symbol visibility), in practice we just aren't there yet, as there are too many extremely subtle platform differences... the only way we could even get close to this dream would really be to have a mindset that a platform is a massive file of configuration warts that you pass to the compiler, as opposed to some trivial flags like -mllvm -arm-reserve-r9.


To me, the biggest advantage is cross compiling

Not all system linkers have this problem. For example, Solaris ld(1) is perfectly capable of cross-linking any valid ELF file.


> can you elaborate on the advantages offered by using LLD over the system linker?

Performance.

>> (usually more than 2x faster than GNU gold).

I switched from bfd to gold to realize a ~6x performance gain on a project (~1 minute linking -> ~10 seconds linking, times 10-20 subprojects, times a few build configurations - really adds up!) I'll keep in mind that I now also have the option to switch to LLD for another 2x (12x total?)


In addition to that, I don't know anything about LLD, but when a compiler toolchain for language X also has its own linker, it means the linker can take advantage of the language semantics, which aren't necessarily properly supported in a system linker.

As an example, many of the C++'s drawbacks regarding build systems was because Bjarne wanted that the generated object files and libraries could be transparently linked by a linker that only understood C.


What makes LLD faster than gold? gold's improvement on gnu ld was focusing on ELF output and removing BFD internal representation.

And shouldn't the name be llld?


The amount of work it took to replace the gnu linker with LLD in freebsd was non trivial. But it's just about ready to be turned on in base.


I'm really looking forward to this. I've hit the 2^16 symbol limit in the ancient GNU ld in base several times over the last few years (the version in ports is fine). It will be great to have a default linker without such 16-bit limits.


Given his current attitudes on LLVM, I'm sure Stallman will se exceeding such a limit as an attack on free software ;)

Seriously though. I guess the majority of major FOSS software out there have a goal of retaining GNU compatibility, so I'd be surprised if this turned out to be an issue.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: