Building a Better Go Linker
11–20 of 104 posts
Re: Building a Better Go Linker
#12> its implementation fit in one Turing award winner’s head What a great unit of measure :)
Wait, how many London buses fit in a Turing award winner's head? And can they all fit in to Wales despite the number of Olympic sized swimming pools already there?
Re: Building a Better Go Linker
#13Re: Building a Better Go Linker
#14Re: Building a Better Go Linker
#15Any recommendations on resources to better understand the build process for compiled languages in general, and Go in particular?
Re: Building a Better Go Linker
#16I don't get it. A linker's task should be straightforward. In essence, it looks up addresses from strings, whose number is bounded by the lines of code written by humans. I think that there must be a lot of incidental complexity if that task somehow becomes a bottleneck. And how can it be that a binary called "cmd/compile" has 170k symbols (that's like, global definitions, right?). Not that that's a huge number in te…
Re: Building a Better Go Linker
#17I hoped they would fix how the linker uses private OS calls.
Re: Building a Better Go Linker
#18I hoped they would fix how the linker uses private OS calls.
Re: Building a Better Go Linker
#19Any recommendations on resources to better understand the build process for compiled languages in general, and Go in particular?
Re: Building a Better Go Linker
#20I don't get it. A linker's task should be straightforward. In essence, it looks up addresses from strings, whose number is bounded by the lines of code written by humans. I think that there must be a lot of incidental complexity if that task somehow becomes a bottleneck. And how can it be that a binary called "cmd/compile" has 170k symbols (that's like, global definitions, right?). Not that that's a huge number in te…
> that's like, global definitions, right? No, not just global definitions. Closures need linking, too. But the linker is doing much more than linking function entry points. Many automatic (on the stack) variables need linking so the GC can (a) trace the object graph and (b) move them when resizing the stack. Likewise, type definitions require metadata generation for GC tracing. And then there's all the debugging data…
As far as stack variables for the GC, the stack is exactly scanned for all but the last frame (I believe), but conservatively scanned for the last frame. This makes it much easier.
Types -- you're partially right. It is mostly all generated in the compiler, and deduped by the linker.
There's no reason Go's linker couldn't be much simpler and likely even simpler than a standard C linker. You might argue that Go will give up things like LTO, but Go designs out lots of the LTO problem (not PGO) by nature of how packages work, and the fact that there aren't cyclic dependencies.
Overall, the Go linker could be quite simple. It just needs some rework is all. :)