6 ms·
Go 1.3 Linker Overhaul
- tomcam 13y agoBeen a while since I looked at ELF but it would sure be nice if it used, say, a well-defined ELF subset to make use of the many ELF tools out there already.
- zellyn 13y agoThe article mentions that possibility.
- acqq 13y agoInterestingly, they want to do the opposite of what Microsoft did with their C++ compiler and linker. To enable "whole program optimizations" Microsoft's compiler writers added the intermediate code analysis, optimizations and code generation to the linker, allowing to, for example, if it is beneficial, inline function invocations for small functions that aren't declared as inline and that come from the different module. So their linker can now do both the classical linking (what Go authors have as the goal now) and the "linker does the code optimization, including intra-module, and generation." Did Go ever use intra-modules optimizations in their linker? Do Go authors really find there's no need for that, when they want to fix the new object code format to only the "generated code" one?
- twotwotwo 13y agoGo's gc toolchain (as opposed to gccgo) tends to emphasize compile speed over producing optimal executables, so they may be flat-out deciding to leave some potential whole-program optimizations on the table to for link speed--pure speculation, though. (And don't know re: your question.)
- coldtea 13y ago>tends to emphasize compile speed over producing optimal executables So they opted to handle the easy problem.
- jesstaa 13y agoCompile time is a big deal when you have millions of lines of code that constantly change and very expensive devs that are spending large amounts of time waiting. The infrastructure Google uses to distribute and track builds across datacentres and the world to make compile time of large applications bearable isn't exactly trivial. Optimal executables aren't that important most of the time. Hardware is cheaper than dev time and the gain of 'optimal' isn't much for the compile time trade off.
- coldtea 13y ago>Compile time is a big deal when you have millions of lines of code that constantly change and very expensive devs that are spending large amounts of time waiting. 1) Sure. Most of us do not. So why should we care and/or trade other stuff for compile time improvements? 2) That's when you don't have a module loading system and have to build everything everytime.
- 1631- 13y ago1) no comment. 2) This is about the linker, not the compiler. You should compare the compilation times with the linking times instead of making assumptions.
- girvo 13y ago1) Cause the creators of the language decided to. Don't like it, feel free to fork it.
- coldtea 13y ago>Cause the creators of the language decided to Which is an no-op answer. That can be the answer for any kind of engineering decision, including the most idiotic ones. We're concerned with what's best here, not merely with what has been decided. >Don't like it, feel free to fork it Another BS non answer.
- acqq 13y agoNow that the modules are mentioned in the discussion: can one Go application consist of more .so or .dlls all writren in Go at all?
- jlouis 13y agoGo links static executables only.
- acqq 13y agoThanks. In my top post when I asked about intra-modules optimizations I've naturally meant "compiler produced pre-linking object" modules, but after the discussion I've recognized that I totally missed that "already compiled objects loaded for execution" (i.e. .so or .dlls) are also an important feature for a language that intends to support seriously big projects. Are there any plans for making ".so" modules in native Go?
- LukeShu 13y ago> Are there any plans for making ".so" modules in native Go? Not from the main team, no. They support compiling `.a` library files that can be statically linked, but the authors of Go generally consider dynamic linking to be harmful.[0] However, because Android development requires `.so` files, the goandroid project[1] contains patches to make go support shared libraries. [0]: http://harmful.cat-v.org/software/dynamic-linking/ http://harmful.cat-v.org/software/dynamic-linking/ [1]: https://github.com/eliasnaur/goandroid https://github.com/eliasnaur/goandroid
- noselasd 13y ago> Did Go ever use intra-modules optimizations in their linker? gcgo can do inlining across module boundaries.