mirror of
https://github.com/golang/go
synced 2024-11-18 11:44:45 -07:00
[dev.link] cmd/link: simplify field tracking support
Currently, for the special field tracking symbol go.track.XXX, when they are reachable, we set its type to SCONST. There is no need to do that. Just leave it unset (as Sxxx). The symbol is done after this point. Change-Id: I966d80775008f7fb5d30fbc6b9e4a30ae8316b6c Reviewed-on: https://go-review.googlesource.com/c/go/+/233998 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
ce36e7f79e
commit
9963add628
@ -191,6 +191,9 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
|
||||
st.err.Errorf(s, "invalid relocation %s: %d+%d not in [%d,%d)", rname, off, siz, 0, len(P))
|
||||
continue
|
||||
}
|
||||
if siz == 0 { // informational relocation - no work to do
|
||||
continue
|
||||
}
|
||||
|
||||
var rst sym.SymKind
|
||||
if rs != 0 {
|
||||
@ -218,9 +221,6 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
|
||||
if rt >= objabi.ElfRelocOffset {
|
||||
continue
|
||||
}
|
||||
if siz == 0 { // informational relocation - no work to do
|
||||
continue
|
||||
}
|
||||
|
||||
// We need to be able to reference dynimport symbols when linking against
|
||||
// shared libraries, and Solaris, Darwin and AIX need it always
|
||||
|
@ -351,19 +351,15 @@ func fieldtrack(arch *sys.Arch, l *loader.Loader) {
|
||||
var buf bytes.Buffer
|
||||
for i := loader.Sym(1); i < loader.Sym(l.NSym()); i++ {
|
||||
if name := l.SymName(i); strings.HasPrefix(name, "go.track.") {
|
||||
bld := l.MakeSymbolUpdater(i)
|
||||
bld.SetSpecial(true)
|
||||
bld.SetNotInSymbolTable(true)
|
||||
if bld.Reachable() {
|
||||
if l.AttrReachable(i) {
|
||||
l.SetAttrSpecial(i, true)
|
||||
l.SetAttrNotInSymbolTable(i, true)
|
||||
buf.WriteString(name[9:])
|
||||
for p := l.Reachparent[i]; p != 0; p = l.Reachparent[p] {
|
||||
buf.WriteString("\t")
|
||||
buf.WriteString(l.SymName(p))
|
||||
}
|
||||
buf.WriteString("\n")
|
||||
|
||||
bld.SetType(sym.SCONST)
|
||||
bld.SetValue(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user