]> Cypherpunks repositories - gostls13.git/commit
cmd/link: mmap output file
authorCherry Zhang <cherryyz@google.com>
Thu, 4 Apr 2019 02:41:48 +0000 (22:41 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 19 Apr 2019 18:24:44 +0000 (18:24 +0000)
commitb2f94d3e88775fae4cf19d34c87a61efa814d079
tree2dae74e2a7345b247c33bf422ec88b93f463eae3
parent47150aafbfaadf1f193b8840df02f388998e83ab
cmd/link: mmap output file

Use mmap for writing most of the output file content,
specifically, the sections and segments. After layout, we
already know the sizes and file offsets for the sections and
segments. So we can just write the bytes by copying to a mmap'd
backing store.

The writing of the output file is split into two parts. The first
part writes the sections and segments to the mmap'd region. The
second part writes some extra content, for which we don't know
the size, so we use direct file IO.

This is in preparation for mmap'ing input files read-only.

Change-Id: I9f3b4616a9f96bfd5c940d74c50aacd6d330f7d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/170738
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
24 files changed:
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/amd64/obj.go
src/cmd/link/internal/arm/asm.go
src/cmd/link/internal/arm/obj.go
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/arm64/obj.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/ld/outbuf.go
src/cmd/link/internal/ld/outbuf_mmap.go [new file with mode: 0644]
src/cmd/link/internal/ld/outbuf_nommap.go [new file with mode: 0644]
src/cmd/link/internal/mips/asm.go
src/cmd/link/internal/mips/obj.go
src/cmd/link/internal/mips64/asm.go
src/cmd/link/internal/mips64/obj.go
src/cmd/link/internal/ppc64/asm.go
src/cmd/link/internal/ppc64/obj.go
src/cmd/link/internal/s390x/asm.go
src/cmd/link/internal/s390x/obj.go
src/cmd/link/internal/wasm/asm.go
src/cmd/link/internal/wasm/obj.go
src/cmd/link/internal/x86/asm.go
src/cmd/link/internal/x86/obj.go