Anyone nerdy enough writes their own compiler. Lots of people have written their own compressor or archiver; it's still an area of active research.
But linkers? It's kinda a solved problem, and so uninteresting (?). But it's a very large and fiddly problem, and so hard to toy around casually.
Heck, there's way, way more people writing their own *operating system* than their own linker. Or C compiler. Or basically anything you can think of.
@Azure Rust uses the system linker. Using llvm's code generation to do link-time code optimization (equivalent to what the Java/Clojure people call tree shaking?) is still an unstable feature.
I know this because Windows link.exe does this automatically and someone euphoniously titled WindowsBunny likes to brag about it.
@icefox Tree shaking just gets rid of everything that isn't used. Lisp systems do it when distributing standalone executables. Stalin uses it as a prequel to partially specializing the heck out of everything.
Link time optimization is (or should be) way more than just a tree shake.
@Azure a combination of tree shake, inlining and then optimization based on the IR resulting of the inlining? I am fuzzy on the details.
@Azure Iirc most C compilers stop at function-level tree shake, which is Often Good Enough for technology to mostly stop there since the late 90s.
@kellerfuchs @Azure iirc the thing is that some languages don't have an idea of "linker" as a separate thing. Ocaml is like this too, a think? The compiler combines things itself and there's no "separately compiled but still part of the same program" stage. The combination happens at the AST/IR level, not the object file level.
Not sure if this is correct. I think it's how Rust's link time optimization works though.
@icefox @Azure No, OCaml does go from source files to cm{a,o,xa,xs} (compiled object & library files) and cmi (compiled API description), and then links them into ELF executables.
It just so happens that the compiler and linker are the same program (or rather, the byte-code compiler and linker are se same, and so are the native code versions)
@kellerfuchs @Azure I need to code more ocaml then, I guess.
It got sorta eclipsed by C#, then F#, now Rust.
@kellerfuchs @Azure *pounces!*
Language evangelism simultaneously the most boring and most enthralling topic ever. Fortunately, I don't need to pursue it right now.
@Azure @kellerfuchs Honestly I think formal methods are The Future, I think we just have a generation or two more of stuff to learn before The Future arrives.
Hopefully I'm wrong! Even if it will mean inconveniently learning a whole new field.
@icefox I don't think this is actually true Link time optimization is relatively recent and something the LLVM people have been working on.
And a lot of the limitations of C++ come from it having to be compatible with the C linker. I think things like Rust and Haskell, say, implicitly have their own linker but also use the standard system linker to link with C libraries for foreign calls.