• Matthew Dempsky's avatar
    cmd/compile, cmd/link: add coverage instrumentation for libfuzzer · e341e93c
    Matthew Dempsky authored
    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: default avatarKeith Randall <khr@golang.org>
    e341e93c
gsubr.go 9.08 KB