• Matt Smiley's avatar
    Add Gnu build-id to workhorse go binaries · 748966bf
    Matt Smiley authored
    By default, go binaries currently include only a
    Go build-id, but it is also useful to include a
    Gnu build-id.
    
    Providing a Gnu build-id in a binary enables more robust
    support for Gnu profiling, tracing, and debugging tools.
    For example, it prevents an ugly scenario where the wrong
    symbols are used when analyzing a profile that was captured
    prior to a recent install of that binary.
    
    Like all build-ids, the Gnu build-id must be unique.
    Ideally it should also be deterministic, as that supports
    repeatable builds, which in turn enable supply chain integrity
    validation, equivalency testing, etc.
    
    The Go build-id has both properties: unique and deterministic.
    Here we generate a Gnu build-id based on the Go build-id,
    inheriting those 2 properties.
    
    We hope to make this an automatic behavior of go build in the
    future, reducing overhead and risk.  But for now, this approach
    approximates the required certainty of uniqueness (including
    differentiating between builds that use the same source code
    but different versions of go or statically linked libraries).
    748966bf
make-gnu-build-id.sh 591 Bytes