X7ROOT File Manager
Current Path:
/opt/golang/1.19.4/src/cmd/link/internal/ld
opt
/
golang
/
1.19.4
/
src
/
cmd
/
link
/
internal
/
ld
/
📁
..
📄
ar.go
(5.38 KB)
📄
asmb.go
(5.21 KB)
📄
config.go
(7.54 KB)
📄
data.go
(89.78 KB)
📄
data_test.go
(2.32 KB)
📄
deadcode.go
(15.66 KB)
📄
deadcode_test.go
(1.34 KB)
📄
decodesym.go
(9.98 KB)
📄
dwarf.go
(72.83 KB)
📄
dwarf_test.go
(46.02 KB)
📄
elf.go
(59.18 KB)
📄
elf_test.go
(2.75 KB)
📄
errors.go
(1.91 KB)
📄
execarchive.go
(901 B)
📄
execarchive_noexec.go
(343 B)
📄
fallocate_test.go
(1.64 KB)
📄
go.go
(11.84 KB)
📄
go_test.go
(2.68 KB)
📄
heap.go
(960 B)
📄
heap_test.go
(1.87 KB)
📄
issue33808_test.go
(792 B)
📄
ld.go
(8.08 KB)
📄
ld_test.go
(8.16 KB)
📄
lib.go
(76.84 KB)
📄
link.go
(5.13 KB)
📄
macho.go
(43.02 KB)
📄
macho_combine_dwarf.go
(13.11 KB)
📄
main.go
(14.01 KB)
📄
nooptcgolink_test.go
(738 B)
📄
outbuf.go
(8.05 KB)
📄
outbuf_darwin.go
(1.48 KB)
📄
outbuf_linux.go
(304 B)
📄
outbuf_mmap.go
(1.51 KB)
📄
outbuf_nofallocate.go
(342 B)
📄
outbuf_nommap.go
(805 B)
📄
outbuf_notdarwin.go
(292 B)
📄
outbuf_test.go
(2.21 KB)
📄
outbuf_windows.go
(2.28 KB)
📄
pcln.go
(28.96 KB)
📄
pe.go
(45.98 KB)
📄
stackcheck.go
(11.86 KB)
📄
stackcheck_test.go
(2.26 KB)
📄
sym.go
(3.89 KB)
📄
symtab.go
(29.49 KB)
📄
target.go
(3.77 KB)
📁
testdata
📄
typelink.go
(1.87 KB)
📄
util.go
(2.46 KB)
📄
xcoff.go
(51.88 KB)
Editing: outbuf_windows.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ld import ( "reflect" "syscall" "unsafe" ) // Mmap maps the output file with the given size. It unmaps the old mapping // if it is already mapped. It also flushes any in-heap data to the new // mapping. func (out *OutBuf) Mmap(filesize uint64) error { oldlen := len(out.buf) if oldlen != 0 { out.munmap() } err := out.f.Truncate(int64(filesize)) if err != nil { Exitf("resize output file failed: %v", err) } low, high := uint32(filesize), uint32(filesize>>32) fmap, err := syscall.CreateFileMapping(syscall.Handle(out.f.Fd()), nil, syscall.PAGE_READWRITE, high, low, nil) if err != nil { return err } defer syscall.CloseHandle(fmap) ptr, err := syscall.MapViewOfFile(fmap, syscall.FILE_MAP_READ|syscall.FILE_MAP_WRITE, 0, 0, uintptr(filesize)) if err != nil { return err } bufHdr := (*reflect.SliceHeader)(unsafe.Pointer(&out.buf)) bufHdr.Data = ptr bufHdr.Len = int(filesize) bufHdr.Cap = int(filesize) // copy heap to new mapping if uint64(oldlen+len(out.heap)) > filesize { panic("mmap size too small") } copy(out.buf[oldlen:], out.heap) out.heap = out.heap[:0] return nil } func (out *OutBuf) munmap() { if out.buf == nil { return } // Apparently unmapping without flush may cause ACCESS_DENIED error // (see issue 38440). err := syscall.FlushViewOfFile(uintptr(unsafe.Pointer(&out.buf[0])), 0) if err != nil { Exitf("FlushViewOfFile failed: %v", err) } // Issue 44817: apparently the call below may be needed (according // to the Windows docs) in addition to the FlushViewOfFile call // above, " ... to flush all the dirty pages plus the metadata for // the file and ensure that they are physically written to disk". // Windows DOC links: // // https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-flushviewoffile // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-flushfilebuffers err = syscall.FlushFileBuffers(syscall.Handle(out.f.Fd())) if err != nil { Exitf("FlushFileBuffers failed: %v", err) } err = syscall.UnmapViewOfFile(uintptr(unsafe.Pointer(&out.buf[0]))) out.buf = nil if err != nil { Exitf("UnmapViewOfFile failed: %v", err) } }
Upload File
Create Folder