• David Crawshaw's avatar
    cmd/compile, cmd/link: weak relocation for ptrTo · 6f31abd2
    David Crawshaw authored
    Introduce R_WEAKADDROFF, a "weak" variation of the R_ADDROFF relocation
    that will only reference the type described if it is in some other way
    reachable.
    
    Use this for the ptrToThis field in reflect type information where it
    is safe to do so (that is, types that don't need to be included for
    interface satisfaction, and types that won't cause the compiler to
    recursively generate an endless series of ptr-to-ptr-to-ptr-to...
    types).
    
    Also fix a small bug in reflect, where StructOf was not clearing the
    ptrToThis field of new types.
    
    Fixes #17931
    
    Change-Id: I4d3b53cb9c916c97b3b16e367794eee142247281
    Reviewed-on: https://go-review.googlesource.com/33427
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    6f31abd2
deadcode.go 9.76 KB