Skip to content

Commit 275a7be

Browse files
committed
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/+/206198 Reviewed-by: Emmanuel Odeke <[email protected]>
1 parent 795e8c2 commit 275a7be

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

misc/cgo/testplugin/plugin_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"os"
1515
"os/exec"
1616
"path/filepath"
17-
"runtime"
1817
"strings"
1918
"testing"
2019
"time"
@@ -114,11 +113,7 @@ func run(t *testing.T, bin string, args ...string) string {
114113

115114
func TestDWARFSections(t *testing.T) {
116115
// test that DWARF sections are emitted for plugins and programs importing "plugin"
117-
if runtime.GOOS != "darwin" {
118-
// On macOS, for some reason, the linker doesn't add debug sections to .so,
119-
// see issue #27502.
120-
goCmd(t, "run", "./checkdwarf/main.go", "plugin2.so", "plugin2.UnexportedNameReuse")
121-
}
116+
goCmd(t, "run", "./checkdwarf/main.go", "plugin2.so", "plugin2.UnexportedNameReuse")
122117
goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main")
123118
}
124119

src/cmd/go/internal/work/init.go

-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ func buildModeInit() {
200200
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x", "linux/ppc64le",
201201
"android/amd64", "android/arm", "android/arm64", "android/386":
202202
case "darwin/amd64":
203-
// Skip DWARF generation due to #21647
204-
forcedLdflags = append(forcedLdflags, "-w")
205203
case "freebsd/amd64":
206204
default:
207205
base.Fatalf("-buildmode=plugin not supported on %s\n", platform)

0 commit comments

Comments
 (0)