Skip to content
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: Xcode 8.3 dsymutil rejects our binaries #19772

Closed
rsc opened this issue Mar 29, 2017 · 14 comments

Comments

Projects
None yet
6 participants
@rsc
Copy link
Contributor

commented Mar 29, 2017

In src/runtime/testdata/testprogcgo, running the final parts of a link by hand:

$ ls -l testprogcgo
-rwxr-xr-x  1 rsc  eng  2008504 Mar 29 14:35 testprogcgo
$ dsymutil -f testprogcgo -o testprogcgo.dw
warning: (x86_64) /tmp/go.o unable to open object file: Invalid data was encountered while parsing the file
$ echo $?
0
$

The resulting binary is malformed.

This is the root cause of #19734, but we'll treat that issue as fixed by the workaround of not trusting dsymutil's exit status when it prints "warnings" (for backport to Go 1.8).

This issue is to fix our object files to be compatible with dsymutil, for Go 1.9.

@rsc rsc added this to the Go1.9 milestone Mar 29, 2017

@rsc rsc changed the title cmd/link: Xcode 8.2 dsymutil rejects our binaries cmd/link: Xcode 8.3 dsymutil rejects our binaries Mar 29, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Mar 29, 2017

CL https://golang.org/cl/38747 mentions this issue.

@gregory-m

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2017

I bisected https://github.com/llvm-mirror/llvm
(I definitely don't miss c++ compile times)

The problem with go compiler starts at llvm-mirror/llvm@9a41e59

@gregory-m

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2017

Also please notice apple's and llvm's dsymutil is different binaries.

Apple dsymutil default output is:

error: No input files.

llvml dsymutil default output is:

dsymutil: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: ./bin/dsymutil - help

I don't know how Apple use llvm in Xcode. But I can compile go binaries with cgo on mac os 10.12.3 using llvm's dsymutil before 9a41e59, and can't compile with llvm's dsymutil after this change.

@rsc

This comment has been minimized.

Copy link
Contributor Author

commented Mar 30, 2017

@gregory-m, thanks for tracking that down. I've got a fix pending and it is definitely related to the alignment of the DWARF segment having changed.

@rsc rsc modified the milestones: Go1.8.1, Go1.9 Mar 30, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Mar 30, 2017

CL https://golang.org/cl/38855 mentions this issue.

@tamird

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2017

@rsc could this be backported for 1.8.1?

@dmitshur

This comment has been minimized.

Copy link
Member

commented Mar 30, 2017

@tamird The current milestone for this issue is Go1.8.1, so I believe that's the plan already.

@tamird

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2017

Heh, yet the issue is closed.

@tamird

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2017

Ah, there's #19734.

@rsc

This comment has been minimized.

Copy link
Contributor Author

commented Mar 30, 2017

Be the bot you want to see in the world.

@rsc rsc reopened this Mar 30, 2017

@mcandre

This comment has been minimized.

Copy link

commented Apr 4, 2017

ETA on go 1.8.1 release, so Mac developers can stop worrying about Xcode versions?

@rsc

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2017

We hope this week.

@gopherbot

This comment has been minimized.

Copy link

commented Apr 5, 2017

CL https://golang.org/cl/39605 mentions this issue.

@rsc

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2017

Cherry-picked.

@rsc rsc closed this Apr 5, 2017

gopherbot pushed a commit that referenced this issue Apr 5, 2017

[release-branch.go1.8] cmd/link: emit a mach-o dwarf segment that dsy…
…mutil will accept

Right now, at least with Xcode 8.3, we invoke dsymutil and dutifully
copy what it produces back into the binary, but it has actually dropped
all the DWARF information that we wanted, because it didn't like
the look of go.o.

Make it like the look of go.o.

DWARF is tested in other ways, but typically indirectly and not for cgo programs.
Add a direct test, and one that exercises cgo.
This detects missing dwarf information in cgo-using binaries on macOS,
at least with Xcode 8.3, and possibly earlier versions as well.

Fixes #19772.

The backport to Go 1.8 disables TestDWARF on Windows because Windows
DWARF support is new in Go 1.9.

Change-Id: I0082e52c0bc8fc4e289770ec3dc02f39fd61e743
Reviewed-on: https://go-review.googlesource.com/39605
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>

lparth added a commit to lparth/go that referenced this issue Apr 13, 2017

cmd/link: emit a mach-o dwarf segment that dsymutil will accept
Right now, at least with Xcode 8.3, we invoke dsymutil and dutifully
copy what it produces back into the binary, but it has actually dropped
all the DWARF information that we wanted, because it didn't like
the look of go.o.

Make it like the look of go.o.

DWARF is tested in other ways, but typically indirectly and not for cgo programs.
Add a direct test, and one that exercises cgo.
This detects missing dwarf information in cgo-using binaries on macOS,
at least with Xcode 8.3, and possibly earlier versions as well.

Fixes golang#19772.

Change-Id: I0082e52c0bc8fc4e289770ec3dc02f39fd61e743
Reviewed-on: https://go-review.googlesource.com/38855
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>

@sigma sigma referenced this issue May 6, 2017

Merged

go: 1.8 -> 1.8.1 #25568

5 of 7 tasks complete

@golang golang locked and limited conversation to collaborators Apr 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.