statically-linked Go programs and libc
statically-linked Go programs and libc
Posted Aug 19, 2022 20:14 UTC (Fri) by dkg (subscriber, #55359)In reply to: The ABI status of ELF hash tables by pbonzini
Parent article: The ABI status of ELF hash tables
@pbonzini wrote:
> Any statically linked program, which includes any Go program, is essentially shipping its own libc.
Are you sure about this? gosop is a Go program, and all the Go bits are statically-linked, but it still dynamically loads libc
0 dkg@alice:~$ ldd $(which gosop) linux-vdso.so.1 (0x00007ffe414fd000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdedda00000) /lib64/ld-linux-x86-64.so.2 (0x00007fdeddcc5000) 0 dkg@alice:~$
Posted Aug 19, 2022 20:36 UTC (Fri)
by dtlin (subscriber, #36537)
[Link]
Depends on how it is built. cgo will use libc, but if a binary is built with CGO_ENABLED=0, then
statically-linked Go programs and libc
$ ldd /usr/bin/tailscale
not a dynamic executable