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

runtime: deeply nested struct initialized with non-zero values [1.15 backport] #46656

gopherbot opened this issue Jun 9, 2021 · 3 comments
CherryPickApproved FrozenDueToAge


Copy link

@gopherbot gopherbot commented Jun 9, 2021

@thanm requested issue #46653 to be considered for backport to the next 1.15 minor release.

@gopherbot please consider this for backport to 1.15 and 1.16

@gopherbot gopherbot added the CherryPickCandidate label Jun 9, 2021
@gopherbot gopherbot added this to the Go1.15.14 milestone Jun 9, 2021
Copy link

@gopherbot gopherbot commented Jun 9, 2021

Change mentions this issue: [release-branch.go1.15] cmd/link: fix handling of dupok mapzero syms

@heschi heschi added CherryPickApproved and removed CherryPickCandidate labels Jun 10, 2021
Copy link

@heschi heschi commented Jun 10, 2021


gopherbot pushed a commit that referenced this issue Jun 29, 2021
The compiler machinery that generates "" symbols marks them as
RODATA and DUPOK, which is problematic when a given application has
multiple map zero symbols (from different packages) with varying
sizes: the dupok path in the loader assumes that if two symbols have
the same name, it is safe to pick any of the versions. In the case of, the link needs to select the largest symbol, not an
arbitrary sym.

This patch changes the linker's dupok symbol loading path to detect
this problem, and in situations where we're loading a dupok symbol
whose name is the same as an existing symbol but whose size is large,
select the new dup over the old. Note: this fix differs from the one
used in 1.16/1.17, which uses content-addressable symbols instead.

Fixes #46656.

Change-Id: Iabd2feef01d448670ba795c7eaddc48c191ea276
Trust: Than McIntosh <>
Run-TryBot: Than McIntosh <>
TryBot-Result: Go Bot <>
Reviewed-by: Cherry Mui <>
(cherry picked from commit aa5540c)
Copy link

@gopherbot gopherbot commented Jun 29, 2021

Closed by merging b51bf4f to release-branch.go1.15.

@golang golang locked and limited conversation to collaborators Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
CherryPickApproved FrozenDueToAge
None yet

No branches or pull requests

2 participants