mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: replace interface{} fields with concrete types
The LSym.Section and Section.Elfsect fields were defined as interface{} but
always had the same concrete type (*Section and *ElfShdr respectively) so just
define them with that type. Reduces size of LSym from 328 to 320 bytes and
reduces best-of-10 maxresident size from 246028k to 238036k when linking
libstd.so.
Change-Id: Ie7112c53e4c2c7ce5fe233b81372aa5633f572e8
Reviewed-on: https://go-review.googlesource.com/10410
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
bc89ad598e
commit
cf2736c4c5
10 changed files with 18 additions and 18 deletions
|
|
@ -522,7 +522,7 @@ func relocsym(s *LSym) {
|
|||
} else if HEADTYPE == obj.Hdarwin {
|
||||
if r.Type == obj.R_CALL {
|
||||
if rs.Type != obj.SHOSTOBJ {
|
||||
o += int64(uint64(Symaddr(rs)) - (rs.Sect.(*Section)).Vaddr)
|
||||
o += int64(uint64(Symaddr(rs)) - rs.Sect.Vaddr)
|
||||
}
|
||||
o -= int64(r.Off) // relative to section offset, not symbol
|
||||
} else {
|
||||
|
|
@ -534,7 +534,7 @@ func relocsym(s *LSym) {
|
|||
o += int64(r.Siz)
|
||||
// GNU ld always add VirtualAddress of the .text section to the
|
||||
// relocated address, compensate that.
|
||||
o -= int64(s.Sect.(*Section).Vaddr - PEBASE)
|
||||
o -= int64(s.Sect.Vaddr - PEBASE)
|
||||
} else {
|
||||
Diag("unhandled pcrel relocation for %s", headstring)
|
||||
}
|
||||
|
|
@ -1681,7 +1681,7 @@ func address() {
|
|||
for sym := datap; sym != nil; sym = sym.Next {
|
||||
Ctxt.Cursym = sym
|
||||
if sym.Sect != nil {
|
||||
sym.Value += int64((sym.Sect.(*Section)).Vaddr)
|
||||
sym.Value += int64(sym.Sect.Vaddr)
|
||||
}
|
||||
for sub = sym.Sub; sub != nil; sub = sub.Sub {
|
||||
sub.Value += sym.Value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue