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.11 backport] #32696

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

debug/dwarf: cgo produces malformed DWARF data [1.11 backport] #32696

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.11 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.11.12 milestone Jun 19, 2019
@mistydemeo
Copy link
Contributor

cc @thanm - I can backport the commit myself if you like, but it looks like you'll have a simpler way to do it in Gerritt?

@gopherbot
Copy link
Author

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

@gopherbot
Copy link
Author

Change https://golang.org/cl/183399 mentions this issue: [release-branch.go1.11] 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 2, 2019
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jul 2, 2019
@gopherbot
Copy link
Author

Closed by merging 2782ffc to release-branch.go1.11.

@gopherbot
Copy link
Author

Closed by merging b3336ef to release-branch.go1.11.

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 #32696

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/+/183399
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 #32696.

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/+/183400
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