Commit 3fd36498 authored by Alessandro Arzilli's avatar Alessandro Arzilli Committed by Brad Fitzpatrick

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/133435Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent bcf3e063
...@@ -71,13 +71,13 @@ func main() { ...@@ -71,13 +71,13 @@ func main() {
} }
if exe == nil { if exe == nil {
fmt.Fprintf(os.Stderr, "could not open %s", exePath) fmt.Fprintf(os.Stderr, "could not open %s\n", exePath)
os.Exit(1) os.Exit(1)
} }
data, err := exe.DWARF() data, err := exe.DWARF()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "error opening DWARF: %v", err) fmt.Fprintf(os.Stderr, "%s: error opening DWARF: %v\n", exePath, err)
os.Exit(1) os.Exit(1)
} }
...@@ -85,7 +85,7 @@ func main() { ...@@ -85,7 +85,7 @@ func main() {
for { for {
e, err := rdr.Next() e, err := rdr.Next()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "error reading DWARF: %v", err) fmt.Fprintf(os.Stderr, "%s: error reading DWARF: %v\n", exePath, err)
os.Exit(1) os.Exit(1)
} }
if e == nil { if e == nil {
...@@ -101,6 +101,6 @@ func main() { ...@@ -101,6 +101,6 @@ func main() {
} }
} }
fmt.Fprintf(os.Stderr, "no entry with a name ending in %q was found", dieSuffix) fmt.Fprintf(os.Stderr, "%s: no entry with a name ending in %q was found\n", exePath, dieSuffix)
os.Exit(1) os.Exit(1)
} }
...@@ -33,7 +33,11 @@ GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=unnamed2.so u ...@@ -33,7 +33,11 @@ GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=unnamed2.so u
GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" host GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" host
# test that DWARF sections are emitted for plugins and programs importing "plugin" # test that DWARF sections are emitted for plugins and programs importing "plugin"
go run src/checkdwarf/main.go plugin2.so plugin2.UnexportedNameReuse if [ $GOOS != "darwin" ]; then
# On macOS, for some reason, the linker doesn't add debug sections to .so,
# see issue #27502.
go run src/checkdwarf/main.go plugin2.so plugin2.UnexportedNameReuse
fi
go run src/checkdwarf/main.go host main.main go run src/checkdwarf/main.go host main.main
LD_LIBRARY_PATH=$(pwd) ./host LD_LIBRARY_PATH=$(pwd) ./host
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment