3 ms·
Also, it’s extremely common to leave libc dynamically linked for operational reasons. It’s my understanding that by default Go statically links everything but l
by ashtonkem 7y ago
Also, it’s extremely common to leave libc dynamically linked for operational reasons. It’s my understanding that by default Go statically links everything but libc.
- tyingq 7y agoSure. Wasn't suggesting it as the default. Just curious why it wasn't an option.
- ashtonkem 7y agoI always assumed that that’s done for portability reasons, since libc deals with a lot of os specific details.
- loeg 7y agoSymbol versioning for backwards compatibility is only possible with dynamic libraries, for example. Static linking is of course always backwards compatible for a given binary artifact, but is significantly bloatier and makes it harder to apply security fixes.
- loeg 7y agoGo doesn't link libc at all, generally.
- ashtonkem 7y agoI stand corrected.
- vetinari 7y agoNot on Linux, with some exceptions (it wants to play nice with nsswitch, after all). It does/has to on macOS, especially if you want your binaries to work on more than a single system release.
- loeg 7y agoOn Linux it has avoided libc for nsswitch in the common case since 2015: https://github.com/golang/go/issues/10485 https://github.com/golang/go/issues/10485 Golang has only very recently (in its lifetime) and grudgingly admitted that operating systems that provide ABI stability at the DSO layer, rather than the Syscall layer, exist. It has been Linux-first for most of its life, and on Linux syscalls are the ABI stability layer. Not so pretty much anywhere else. On MacOS, Go links libSystem rather than libc. And this was new in 2018: https://golang.org/doc/go1.11#runtime https://golang.org/doc/go1.11#runtime despite having a Mac port since ~2012. Prior to that they ignored the system ABI stability layer and just did raw Darwin syscalls. They still do so on the BSDs, despite this explicitly not being the supported stability interface.