diff options
| author | Keith Randall <khr@golang.org> | 2026-01-02 13:42:00 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2026-02-06 15:22:38 -0800 |
| commit | 4fe1203111eeda8a38af4f2a4208e4d4de720c0d (patch) | |
| tree | 427f5d03924febf5ce2a68a6a60360644c533ea4 /src/cmd/link | |
| parent | cbb37e310e2edd7148c8501567e190746e6d98d2 (diff) | |
| download | go-4fe1203111eeda8a38af4f2a4208e4d4de720c0d.tar.xz | |
cmd/link: align covctrs symbol
If we start the covctrs blob at an odd alignment, then covctrs will
not be correctly aligned. Each individual entry is aligned properly,
but the start marker may be before any padding inserted to enforce
that alignment.
Fixes #58936
Change-Id: I802fbe40eacfa5a3c8c4864e078b0e078da956d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/733740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd/link')
| -rw-r--r-- | src/cmd/link/internal/ld/data.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 683df3bb67..a045ff5eea 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2022,6 +2022,13 @@ func (state *dodataState) allocateDataSections(ctxt *Link) { ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.covctrs", 0), sect) ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.ecovctrs", 0), sect) + // If we started this blob at an odd alignment, then covctrs will + // not be correctly aligned. Each individual entry is aligned properly, + // but the start marker may be before any padding inserted to enforce + // that alignment. Fix that here. See issue 58936. + covCounterDataStartOff += covCounterDataLen % 4 + covCounterDataLen -= covCounterDataLen % 4 + // Coverage instrumentation counters for libfuzzer. if len(state.data[sym.SLIBFUZZER_8BIT_COUNTER]) > 0 { sect := state.allocateNamedSectionAndAssignSyms(&Segdata, ".go.fuzzcntrs", sym.SLIBFUZZER_8BIT_COUNTER, sym.Sxxx, 06) |
