Skip to content

Commit 3fd3649

Browse files
aarzillibradfitz
authored andcommitted
misc/cgo/testplugin: disable DWARF tests on darwin
For some reason on darwin the linker still can't add debug sections to plugins. Executables importing "plugin" do have them, however. Because of issue 25841, plugins on darwin would likely have bad debug info anyway so, for now, this isn't a great loss. This disables the check for debug sections in plugins for darwin only. Updates #27502 Change-Id: Ib8f62dac1e485006b0c2b3ba04f86d733db5ee9a Reviewed-on: https://go-review.googlesource.com/133435 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent bcf3e06 commit 3fd3649

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

misc/cgo/testplugin/src/checkdwarf/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ func main() {
7171
}
7272

7373
if exe == nil {
74-
fmt.Fprintf(os.Stderr, "could not open %s", exePath)
74+
fmt.Fprintf(os.Stderr, "could not open %s\n", exePath)
7575
os.Exit(1)
7676
}
7777

7878
data, err := exe.DWARF()
7979
if err != nil {
80-
fmt.Fprintf(os.Stderr, "error opening DWARF: %v", err)
80+
fmt.Fprintf(os.Stderr, "%s: error opening DWARF: %v\n", exePath, err)
8181
os.Exit(1)
8282
}
8383

8484
rdr := data.Reader()
8585
for {
8686
e, err := rdr.Next()
8787
if err != nil {
88-
fmt.Fprintf(os.Stderr, "error reading DWARF: %v", err)
88+
fmt.Fprintf(os.Stderr, "%s: error reading DWARF: %v\n", exePath, err)
8989
os.Exit(1)
9090
}
9191
if e == nil {
@@ -101,6 +101,6 @@ func main() {
101101
}
102102
}
103103

104-
fmt.Fprintf(os.Stderr, "no entry with a name ending in %q was found", dieSuffix)
104+
fmt.Fprintf(os.Stderr, "%s: no entry with a name ending in %q was found\n", exePath, dieSuffix)
105105
os.Exit(1)
106106
}

misc/cgo/testplugin/test.bash

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=unnamed2.so u
3333
GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" host
3434

3535
# test that DWARF sections are emitted for plugins and programs importing "plugin"
36-
go run src/checkdwarf/main.go plugin2.so plugin2.UnexportedNameReuse
36+
if [ $GOOS != "darwin" ]; then
37+
# On macOS, for some reason, the linker doesn't add debug sections to .so,
38+
# see issue #27502.
39+
go run src/checkdwarf/main.go plugin2.so plugin2.UnexportedNameReuse
40+
fi
3741
go run src/checkdwarf/main.go host main.main
3842

3943
LD_LIBRARY_PATH=$(pwd) ./host

0 commit comments

Comments
 (0)