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: elf_test.go
//go:build cgo // +build cgo // 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 ( "debug/elf" "internal/testenv" "io/ioutil" "os" "os/exec" "path/filepath" "runtime" "strings" "testing" ) func TestDynSymShInfo(t *testing.T) { t.Parallel() testenv.MustHaveGoBuild(t) dir := t.TempDir() const prog = ` package main import "net" func main() { net.Dial("", "") } ` src := filepath.Join(dir, "issue33358.go") if err := ioutil.WriteFile(src, []byte(prog), 0666); err != nil { t.Fatal(err) } binFile := filepath.Join(dir, "issue33358") cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", binFile, src) if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("%v: %v:\n%s", cmd.Args, err, out) } fi, err := os.Open(binFile) if err != nil { t.Fatalf("failed to open built file: %v", err) } defer fi.Close() elfFile, err := elf.NewFile(fi) if err != nil { t.Skip("The system may not support ELF, skipped.") } section := elfFile.Section(".dynsym") if section == nil { t.Fatal("no dynsym") } symbols, err := elfFile.DynamicSymbols() if err != nil { t.Fatalf("failed to get dynamic symbols: %v", err) } var numLocalSymbols uint32 for i, s := range symbols { if elf.ST_BIND(s.Info) != elf.STB_LOCAL { numLocalSymbols = uint32(i + 1) break } } if section.Info != numLocalSymbols { t.Fatalf("Unexpected sh info, want greater than 0, got: %d", section.Info) } } func TestNoDuplicateNeededEntries(t *testing.T) { testenv.MustHaveGoBuild(t) testenv.MustHaveCGO(t) // run this test on just a small set of platforms (no need to test it // across the board given the nature of the test). pair := runtime.GOOS + "-" + runtime.GOARCH switch pair { case "linux-amd64", "linux-arm64", "freebsd-amd64", "openbsd-amd64": default: t.Skip("no need for test on " + pair) } t.Parallel() dir := t.TempDir() wd, err := os.Getwd() if err != nil { t.Fatalf("Failed to get working directory: %v", err) } path := filepath.Join(dir, "x") argv := []string{"build", "-o", path, filepath.Join(wd, "testdata", "issue39256")} out, err := exec.Command(testenv.GoToolPath(t), argv...).CombinedOutput() if err != nil { t.Fatalf("Build failure: %s\n%s\n", err, string(out)) } f, err := elf.Open(path) if err != nil { t.Fatalf("Failed to open ELF file: %v", err) } libs, err := f.ImportedLibraries() if err != nil { t.Fatalf("Failed to read imported libraries: %v", err) } var count int for _, lib := range libs { if lib == "libc.so" || strings.HasPrefix(lib, "libc.so.") { count++ } } if got, want := count, 1; got != want { t.Errorf("Got %d entries for `libc.so`, want %d", got, want) } }
Upload File
Create Folder