]> Cypherpunks repositories - gostls13.git/commit
cmd/compile, cmd/link: add coverage instrumentation for libfuzzer
authorMatthew Dempsky <mdempsky@google.com>
Sat, 19 Oct 2019 00:39:39 +0000 (17:39 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 5 Nov 2019 00:00:36 +0000 (00:00 +0000)
commite341e93c519ef22ed4759fd0b4643a30321b9222
tree5f03c6f2d2604f11299b8d1016d2dc3353a2266a
parent383b447e0da5bd1fcdc2439230b5a1d3e3402117
cmd/compile, cmd/link: add coverage instrumentation for libfuzzer

This CL adds experimental coverage instrumentation similar to what
github.com/dvyukov/go-fuzz produces in its -libfuzzer mode. The
coverage can be enabled by compiling with -d=libfuzzer. It's intended
to be used in conjunction with -buildmode=c-archive to produce an ELF
archive (.a) file that can be linked with libFuzzer. See #14565 for
example usage.

The coverage generates a unique 8-bit counter for each basic block in
the original source code, and emits an increment operation. These
counters are then collected into the __libfuzzer_extra_counters ELF
section for use by libFuzzer.

Updates #14565.

Change-Id: I239758cc0ceb9ca1220f2d9d3d23b9e761db9bf1
Reviewed-on: https://go-review.googlesource.com/c/go/+/202117
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/order.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/internal/objabi/symkind.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/sym/symkind.go
src/cmd/link/internal/sym/symkind_string.go