diff options
| author | Ian Lance Taylor <iant@golang.org> | 2024-10-24 21:50:29 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-10-25 22:15:10 +0000 |
| commit | 6dc99aa7eb26e7cf9af0d2cab74c5027fec8cde2 (patch) | |
| tree | f11aaa49501e79f1e31f8f10956c1a78e412e4c5 /src/cmd/link | |
| parent | 46b576be724b6e64359fd872b9bd5109aba93cc0 (diff) | |
| download | go-6dc99aa7eb26e7cf9af0d2cab74c5027fec8cde2.tar.xz | |
cmd/link: for asan align coverage counter section to 8 bytes
Fixes #66966
Change-Id: I92777a7d7d8afaa82ffcd605aa3e607289b645f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/622477
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/link')
| -rw-r--r-- | src/cmd/link/internal/ld/data.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index cf4b88f895..421293e1f9 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2981,6 +2981,12 @@ func (ctxt *Link) address() []*sym.Segment { ctxt.xdefine("runtime.end", sym.SBSS, int64(Segdata.Vaddr+Segdata.Length)) if fuzzCounters != nil { + if *flagAsan { + // ASAN requires that the symbol marking the end + // of the section be aligned on an 8 byte boundary. + // See issue #66966. + fuzzCounters.Length = uint64(Rnd(int64(fuzzCounters.Length), 8)) + } ctxt.xdefine("runtime.__start___sancov_cntrs", sym.SLIBFUZZER_8BIT_COUNTER, int64(fuzzCounters.Vaddr)) ctxt.xdefine("runtime.__stop___sancov_cntrs", sym.SLIBFUZZER_8BIT_COUNTER, int64(fuzzCounters.Vaddr+fuzzCounters.Length)) ctxt.xdefine("internal/fuzz._counters", sym.SLIBFUZZER_8BIT_COUNTER, int64(fuzzCounters.Vaddr)) |
