]> Cypherpunks repositories - gostls13.git/commit
cmd/link: directly exec archive command if external tmpdir
authorThan McIntosh <thanm@google.com>
Mon, 28 Oct 2019 15:51:13 +0000 (11:51 -0400)
committerThan McIntosh <thanm@google.com>
Mon, 4 Nov 2019 18:51:13 +0000 (18:51 +0000)
commitbf7e55b618ff4ec8e823b77c3c775d0fb4dba1ba
tree7bf42fe5e097b60c8b20488b670e83b9cd4e42e2
parent1da575a7bc501e95cbf301e372b6eaf38e41eb30
cmd/link: directly exec archive command if external tmpdir

When linking a Go archive, if the archiver invocation is the very last
thing that needs to happen in the link (no "atexit" cleanups required
remove the locally created tmpdir) then call syscall.Exec to invoke
the archiver command instead of the usual exec.Command. This has the
effect of reducing peak memory use for the linker overall, since we
don't be holding onto all of the linker's live memory while the
archiver is running.

Change-Id: Ibbe22d8d67a70cc2a4f91c68aab56d19fb77c393
Reviewed-on: https://go-review.googlesource.com/c/go/+/203821
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/ld/execarchive.go [new file with mode: 0644]
src/cmd/link/internal/ld/execarchive_noexec.go [new file with mode: 0644]
src/cmd/link/internal/ld/ld_test.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/ld/util.go