• Cherry Zhang's avatar
    [dev.link] cmd/link: implement symbol overwrite logic · dab05a04
    Cherry Zhang authored
    If two defined symbols have the same name, one contentless and
    one with content, the one with content "wins". This is mainly for
    go:linkname on data symbols. Support this logic in newobj mode.
    
    Introduce an "overwrite" mechanism, letting one symbol overwrite
    another. This machanism could later be used for the linker
    overwriting symbol contents (e.g. -X flag).
    
    Change-Id: I32ee7d4b82df275f11b38c3abefc99b878ff12d7
    Reviewed-on: https://go-review.googlesource.com/c/go/+/200097
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarThan McIntosh <thanm@google.com>
    dab05a04
objfile2.go 19.9 KB