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>
Showing
Please register or sign in to comment