• David Crawshaw's avatar
    cmd/link, etc: store typelinks as offsets · f028b9f9
    David Crawshaw authored
    This is the first in a series of CLs to replace the use of pointers
    in binary read-only data with offsets.
    
    In standard Go binaries these CLs have a small effect, shrinking
    8-byte pointers to 4-bytes. In position-independent code, it also
    saves the dynamic relocation for the pointer. This has a significant
    effect on the binary size when building as PIE, c-archive, or
    c-shared.
    
    darwin/amd64:
    	cmd/go: -12KB (0.1%)
    	jujud:  -82KB (0.1%)
    
    linux/amd64 PIE:
    	cmd/go:  -86KB (0.7%)
    	jujud:  -569KB (0.7%)
    
    For #6853.
    
    Change-Id: Iad5625bbeba58dabfd4d334dbee3fcbfe04b2dcf
    Reviewed-on: https://go-review.googlesource.com/21284Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    f028b9f9
data.go 51.2 KB