• Cherry Zhang's avatar
    cmd/link: mmap output file · b2f94d3e
    Cherry Zhang authored
    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: default avatarAustin Clements <austin@google.com>
    b2f94d3e
obj.go 3.39 KB