github.com/bir3/gocompiler@v0.9.2202/src/cmd/link/internal/ld/outbuf_nommap.go (about)

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows
     6  
     7  package ld
     8  
     9  // Mmap allocates an in-heap output buffer with the given size. It copies
    10  // any old data (if any) to the new buffer.
    11  func (out *OutBuf) Mmap(filesize uint64) error {
    12  	// We need space to put all the symbols before we apply relocations.
    13  	oldheap := out.heap
    14  	if filesize < uint64(len(oldheap)) {
    15  		panic("mmap size too small")
    16  	}
    17  	out.heap = make([]byte, filesize)
    18  	copy(out.heap, oldheap)
    19  	return nil
    20  }
    21  
    22  func (out *OutBuf) munmap() { panic("unreachable") }