Commit 275a7be3 authored by Than McIntosh's avatar Than McIntosh

cmd/go: remove -w workaround for -buildmode=plugin on Darwin

The problem causing the assert in #21647 are fixed at this point,
along with various other linker issues with plugin + Darwin. With
this in mind, remove the "-ldflags=-w" workaround for plugin mode on
Darwin and re-enable the appropriate tests misc/cgo/testplugin

Fixes #21647.
Fixes #27502.

Change-Id: I5b662987b138b06cfc9e1f9f6d804cf682bd501a
Reviewed-on: https://go-review.googlesource.com/c/go/+/206198Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
parent 795e8c23
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"testing" "testing"
"time" "time"
...@@ -114,11 +113,7 @@ func run(t *testing.T, bin string, args ...string) string { ...@@ -114,11 +113,7 @@ func run(t *testing.T, bin string, args ...string) string {
func TestDWARFSections(t *testing.T) { func TestDWARFSections(t *testing.T) {
// test that DWARF sections are emitted for plugins and programs importing "plugin" // test that DWARF sections are emitted for plugins and programs importing "plugin"
if runtime.GOOS != "darwin" {
// On macOS, for some reason, the linker doesn't add debug sections to .so,
// see issue #27502.
goCmd(t, "run", "./checkdwarf/main.go", "plugin2.so", "plugin2.UnexportedNameReuse") goCmd(t, "run", "./checkdwarf/main.go", "plugin2.so", "plugin2.UnexportedNameReuse")
}
goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main") goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main")
} }
......
...@@ -200,8 +200,6 @@ func buildModeInit() { ...@@ -200,8 +200,6 @@ func buildModeInit() {
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le", case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
"android/amd64", "android/arm", "android/arm64", "android/386": "android/amd64", "android/arm", "android/arm64", "android/386":
case "darwin/amd64": case "darwin/amd64":
// Skip DWARF generation due to #21647
forcedLdflags = append(forcedLdflags, "-w")
case "freebsd/amd64": case "freebsd/amd64":
default: default:
base.Fatalf("-buildmode=plugin not supported on %s\n", platform) base.Fatalf("-buildmode=plugin not supported on %s\n", platform)
......
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