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: build error with cgo in Windows, redefinition of go.map.zero [1.16 backport] #47289

Closed
gopherbot opened this issue Jul 19, 2021 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@cherrymui requested issue #47185 to be considered for backport to the next 1.16 minor release.

@gopherbot please open a backport for this to Go 1.16 release. This fixes a bug introduced in the previous point release.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jul 19, 2021
@gopherbot gopherbot added this to the Go1.16.7 milestone Jul 19, 2021
@gopherbot
Copy link
Author

Change https://golang.org/cl/335629 mentions this issue: [release-branch.go1.16] cmd/{compile,link}: fix bug in map.zero handling

@thanm thanm self-assigned this Jul 19, 2021
@toothrot toothrot added the CherryPickApproved Used during the release process for point releases label Jul 22, 2021
@toothrot
Copy link
Contributor

Approved. This is a serious issue with no workaround.

@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jul 22, 2021
@gopherbot
Copy link
Author

Closed by merging 3d5afa9 to release-branch.go1.16.

gopherbot pushed a commit that referenced this issue Aug 2, 2021
In CL 326211 a change was made to switch "go.map.zero" symbols from
non-pkg DUPOK symbols to hashed symbols. The intent of this change was
ensure that in cases where there are multiple competing go.map.zero
symbols feeding into a link, the largest map.zero symbol is selected.
The change was buggy, however, and resulted in duplicate symbols in
the final binary (see bug cited below for details). This duplication
was relatively benign for linux/ELF, but causes duplicate definition
errors on Windows.

This patch switches "go.map.zero" symbols back from hashed symbols to
non-pkg DUPOK symbols, and updates the relevant code in the loader to
ensure that we do the right thing when there are multiple competing
DUPOK symbols with different sizes.

Fixes #47289.

Change-Id: I8aeb910c65827f5380144d07646006ba553c9251
Reviewed-on: https://go-review.googlesource.com/c/go/+/334930
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 49402be)
Reviewed-on: https://go-review.googlesource.com/c/go/+/335629
@rsc rsc unassigned thanm Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
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