mirror of
https://github.com/golang/go
synced 2024-11-18 11:55:01 -07:00
[dev.link] cmd/link: remove Unit field from sym.Symbol
Remove sym.Symbol 'Unit' field, replacing accesses to the field with calls into the loader instead. Change-Id: Ia1abd4c3d93036705dd624a49cb3d9cbe6a5188b Reviewed-on: https://go-review.googlesource.com/c/go/+/230307 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
12b11f3af9
commit
3f408fc7fd
@ -324,7 +324,8 @@ func relocsym2(target *Target, ldr *loader.Loader, err *ErrorReporter, syms *Arc
|
||||
case objabi.R_ADDRCUOFF:
|
||||
// debug_range and debug_loc elements use this relocation type to get an
|
||||
// offset from the start of the compile unit.
|
||||
o = Symaddr(r.Sym) + r.Add - Symaddr(ldr.Syms[r.Sym.Unit.Textp2[0]])
|
||||
u := ldr.SymUnit(loader.Sym(r.Sym.SymIdx))
|
||||
o = Symaddr(r.Sym) + r.Add - Symaddr(ldr.Syms[u.Textp2[0]])
|
||||
|
||||
// r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call.
|
||||
case objabi.R_GOTPCREL:
|
||||
@ -482,4 +483,3 @@ func relocsym2(target *Target, ldr *loader.Loader, err *ErrorReporter, syms *Arc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2307,7 +2307,6 @@ func (l *Loader) addNewSym(i Sym, name string, ver int, unit *sym.CompilationUni
|
||||
t = s.Type
|
||||
}
|
||||
s.Type = t
|
||||
s.Unit = unit
|
||||
l.growSyms(int(i))
|
||||
l.installSym(i, s)
|
||||
return s
|
||||
|
@ -21,7 +21,7 @@ func TestSizeof(t *testing.T) {
|
||||
_32bit uintptr // size on 32bit platforms
|
||||
_64bit uintptr // size on 64bit platforms
|
||||
}{
|
||||
{Symbol{}, 96, 152},
|
||||
{Symbol{}, 92, 144},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
@ -30,7 +30,6 @@ type Symbol struct {
|
||||
SymIdx LoaderSym
|
||||
auxinfo *AuxSymbol
|
||||
Sect *Section
|
||||
Unit *CompilationUnit
|
||||
// P contains the raw symbol data.
|
||||
P []byte
|
||||
R []Reloc
|
||||
|
Loading…
Reference in New Issue
Block a user