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

debug/dwarf: cgo produces malformed DWARF data [1.12 backport] #32697

Closed
gopherbot opened this issue Jun 19, 2019 · 5 comments
Closed

debug/dwarf: cgo produces malformed DWARF data [1.12 backport] #32697

gopherbot opened this issue Jun 19, 2019 · 5 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@mistydemeo requested issue #32673 to be considered for backport to the next 1.12 minor release.

@gopherbot please consider this for backport, it's a regression

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jun 19, 2019
@gopherbot gopherbot added this to the Go1.12.7 milestone Jun 19, 2019
@mistydemeo
Copy link
Contributor

cc @thanm

@gopherbot
Copy link
Author

Change https://golang.org/cl/183398 mentions this issue: [release-branch.go1.12] cmd/link: revise previous __DWARF segment protection fix

@gopherbot
Copy link
Author

Change https://golang.org/cl/183397 mentions this issue: [release-branch.go1.12] cmd/link: macos: set initial protection of 0 for __DWARF segment

@bcmills bcmills added the CherryPickApproved Used during the release process for point releases label Jul 3, 2019
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jul 3, 2019
@gopherbot
Copy link
Author

Closed by merging e050fac to release-branch.go1.12.

gopherbot pushed a commit that referenced this issue Jul 8, 2019
…for __DWARF segment

For later versions of MacOS, the dynamic loader is more picky about
enforcing restrictions on __DWARF MachO load commands/segments,
triggering aborts of the form

  dyld: malformed mach-o image: segment __DWARF has vmsize < filesize

for Go programs that use cgo on Darwin. The error is being triggered
because the Go linker is setting "vmsize" in the DWARF segment entry
to zero as a way to signal that the DWARF doesn't need to be mapped
into memory at runtime (which we need to continue to do).

This patch changes the initial protection on the __DWARF segment to
zero, which dyld seems to be happy with (this is used for other similar
non-loadable sections such as __LLVM).

Updates #32697

Change-Id: I9a73449c6d26c172f3d70361719943af381f37e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/182958
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/183397
@gopherbot
Copy link
Author

Closed by merging c955c54 to release-branch.go1.12.

gopherbot pushed a commit that referenced this issue Jul 8, 2019
…tection fix

Tweak the previous fix for issue 32673 (in CL 182958) to work around
problems with c-shared build mode that crop up on some of the builders
(10.11, 10.12).  We now consistently set vmaddr and vmsize to zero
for the DWARF segment regardless of build mode.

Fixes #32697

Change-Id: Id1fc213590ad00c28352925e2d754d760e022b5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/183237
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/183398
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Jul 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants