• Cherry Zhang's avatar
    [dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode · cab29ebd
    Cherry Zhang authored
    With the new object files, now we can run the deadcode pass on
    indices instead of Symbol structs, so we can delay creating
    Symbols after the deadcode pass. Then we only need to create
    reachable symbols.
    
    Not create Symbols in LoadNew and LoadRefs, and recombine
    LoadReloc into LoadFull.
    
    Split loadcgo into two parts: the first finds root symbols, the
    second create Symbols and sets attributes. The first runs before
    the deadcode pass, while the second runs after.
    
    TODO: currently there are still symbols that are not marked
    reachable but still used. This includes DWARF symbols, file
    symbols, and type symbols that are referenced by DWARF symbols.
    We still need to create them (conservatively).
    
    Change-Id: I695779c9312be9d49ab1683957ac3e72e1f65a1e
    Reviewed-on: https://go-review.googlesource.com/c/go/+/199643
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarThan McIntosh <thanm@google.com>
    cab29ebd
deadcode2.go 11.3 KB