New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: vmsize of __DWARF should not be zero on darwin #21647

Open
hirochachacha opened this Issue Aug 27, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@hirochachacha
Contributor

hirochachacha commented Aug 27, 2017

Please answer these questions before submitting your issue. Thanks!

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Re-enable plugin mode for darwin/amd64.

diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index 9a1204866e..705509de27 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -358,6 +358,8 @@ func BuildModeInit() {
 			switch platform {
 			case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x",
 				"android/amd64", "android/arm", "android/arm64", "android/386":
+			case "darwin/amd64":
+				// cfg.BuildLdflags = append(cfg.BuildLdflags, "-w")
 			default:
 				base.Fatalf("-buildmode=plugin not supported on %s\n", platform)
 			}

Then try the trivial example in https://golang.org/pkg/plugin/

What did you expect to see?

success.

What did you see instead?

panic: plugin.Open: dlopen(/Users/hiro/plugin.so, 10): no suitable image found.  Did find:
	/Users/hiro/plugin.so: malformed mach-o image: segment __DWARF has vmsize < filesize
	/Users/hiro/plugin.so: malformed mach-o image: segment __DWARF has vmsize < filesize

goroutine 1 [running]:
main.main()
	/Users/hiro/p.go:8 +0x3a9

Does this issue reproduce with the latest release (go1.9)?

System details

go version devel +b046878018 Sat Aug 26 15:55:04 2017 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hiro/.go"
GORACE=""
GOROOT="/Users/hiro/go"
GOTOOLDIR="/Users/hiro/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wq/dwn8hs0x7njbzty9f68y61700000gn/T/go-build397205854=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version devel +b046878018 Sat Aug 26 15:55:04 2017 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +b046878018 Sat Aug 26 15:55:04 2017 +0000
uname -v: Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29
lldb --version: lldb-370.0.42
  Swift-3.1
gdb --version: GNU gdb (GDB) 8.0

I'm going to skip DWARF generation now.

@gopherbot

This comment has been minimized.

gopherbot commented Aug 27, 2017

Change https://golang.org/cl/59372 mentions this issue: cmd/go: re-enable buildmode=plugin on darwin/amd64

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment