...
1
2
3
4
5 package ld
6
7 import (
8 "internal/testenv"
9 "runtime"
10 "strings"
11 "testing"
12 )
13
14 const prog = `
15 package main
16
17 import "log"
18
19 func main() {
20 log.Fatalf("HERE")
21 }
22 `
23
24 func TestIssue33808(t *testing.T) {
25 if runtime.GOOS != "darwin" {
26 return
27 }
28 testenv.MustHaveGoBuild(t)
29 testenv.MustHaveCGO(t)
30 t.Parallel()
31
32 dir := t.TempDir()
33
34 f := gobuild(t, dir, prog, "-ldflags=-linkmode=external")
35 f.Close()
36
37 syms, err := f.Symbols()
38 if err != nil {
39 t.Fatalf("Error reading symbols: %v", err)
40 }
41
42 name := "log.Fatalf"
43 for _, sym := range syms {
44 if strings.Contains(sym.Name, name) {
45 return
46 }
47 }
48 t.Fatalf("Didn't find %v", name)
49 }
50
View as plain text