mirror of
https://github.com/golang/go
synced 2024-11-05 15:26:15 -07:00
cmd/link: remove now-unused ctxt arguments from a few functions
Specifically Addstring, Addbytes and Symgrow. Change-Id: Ia74093bfcf9f360bf223accbc8feef54a7f059c9 Reviewed-on: https://go-review.googlesource.com/29348 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
25d094034b
commit
6383709272
@ -45,7 +45,7 @@ func Addcall(ctxt *ld.Link, s *ld.Symbol, t *ld.Symbol) int64 {
|
||||
s.Attr |= ld.AttrReachable
|
||||
i := s.Size
|
||||
s.Size += 4
|
||||
ld.Symgrow(ctxt, s, s.Size)
|
||||
ld.Symgrow(s, s.Size)
|
||||
r := ld.Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
|
@ -503,7 +503,7 @@ func addpltreloc(ctxt *ld.Link, plt *ld.Symbol, got *ld.Symbol, sym *ld.Symbol,
|
||||
|
||||
plt.Attr |= ld.AttrReachable
|
||||
plt.Size += 4
|
||||
ld.Symgrow(ctxt, plt, plt.Size)
|
||||
ld.Symgrow(plt, plt.Size)
|
||||
|
||||
return r
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
func Symgrow(ctxt *Link, s *Symbol, siz int64) {
|
||||
func Symgrow(s *Symbol, siz int64) {
|
||||
if int64(int(siz)) != siz {
|
||||
log.Fatalf("symgrow size %d too long", siz)
|
||||
}
|
||||
@ -70,7 +70,7 @@ func setuintxx(ctxt *Link, s *Symbol, off int64, v uint64, wid int64) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
if s.Size < off+wid {
|
||||
s.Size = off + wid
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
}
|
||||
|
||||
switch wid {
|
||||
@ -87,7 +87,7 @@ func setuintxx(ctxt *Link, s *Symbol, off int64, v uint64, wid int64) int64 {
|
||||
return off + wid
|
||||
}
|
||||
|
||||
func Addbytes(ctxt *Link, s *Symbol, bytes []byte) int64 {
|
||||
func Addbytes(s *Symbol, bytes []byte) int64 {
|
||||
if s.Type == 0 {
|
||||
s.Type = obj.SDATA
|
||||
}
|
||||
@ -147,7 +147,7 @@ func Addaddrplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
i := s.Size
|
||||
s.Size += int64(ctxt.Arch.PtrSize)
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
r := Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
@ -164,7 +164,7 @@ func Addpcrelplus(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
i := s.Size
|
||||
s.Size += 4
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
r := Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
@ -188,7 +188,7 @@ func setaddrplus(ctxt *Link, s *Symbol, off int64, t *Symbol, add int64) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
if off+int64(ctxt.Arch.PtrSize) > s.Size {
|
||||
s.Size = off + int64(ctxt.Arch.PtrSize)
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
}
|
||||
|
||||
r := Addrel(s)
|
||||
@ -211,7 +211,7 @@ func addsize(ctxt *Link, s *Symbol, t *Symbol) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
i := s.Size
|
||||
s.Size += int64(ctxt.Arch.PtrSize)
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
r := Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
@ -227,7 +227,7 @@ func addaddrplus4(ctxt *Link, s *Symbol, t *Symbol, add int64) int64 {
|
||||
s.Attr |= AttrReachable
|
||||
i := s.Size
|
||||
s.Size += 4
|
||||
Symgrow(ctxt, s, s.Size)
|
||||
Symgrow(s, s.Size)
|
||||
r := Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
@ -989,7 +989,7 @@ func addstrdata(ctxt *Link, name string, value string) {
|
||||
p := fmt.Sprintf("%s.str", name)
|
||||
sp := ctxt.Syms.Lookup(p, 0)
|
||||
|
||||
Addstring(ctxt, sp, value)
|
||||
Addstring(sp, value)
|
||||
sp.Type = obj.SRODATA
|
||||
|
||||
s := ctxt.Syms.Lookup(name, 0)
|
||||
@ -1019,7 +1019,7 @@ func (ctxt *Link) checkstrdata() {
|
||||
}
|
||||
}
|
||||
|
||||
func Addstring(ctxt *Link, s *Symbol, str string) int64 {
|
||||
func Addstring(s *Symbol, str string) int64 {
|
||||
if s.Type == 0 {
|
||||
s.Type = obj.SNOPTRDATA
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ func (c dwctxt) AddInt(s dwarf.Sym, size int, i int64) {
|
||||
}
|
||||
func (c dwctxt) AddBytes(s dwarf.Sym, b []byte) {
|
||||
ls := s.(*Symbol)
|
||||
Addbytes(c.linkctxt, ls, b)
|
||||
Addbytes(ls, b)
|
||||
}
|
||||
func (c dwctxt) AddString(s dwarf.Sym, v string) {
|
||||
Addstring(c.linkctxt, s.(*Symbol), v)
|
||||
Addstring(s.(*Symbol), v)
|
||||
}
|
||||
func (c dwctxt) SymValue(s dwarf.Sym) int64 {
|
||||
return s.(*Symbol).Value
|
||||
@ -85,7 +85,7 @@ func writeabbrev(ctxt *Link, syms []*Symbol) []*Symbol {
|
||||
s := ctxt.Syms.Lookup(".debug_abbrev", 0)
|
||||
s.Type = obj.SDWARFSECT
|
||||
abbrevsym = s
|
||||
Addbytes(ctxt, s, dwarf.GetAbbrev())
|
||||
Addbytes(s, dwarf.GetAbbrev())
|
||||
return append(syms, s)
|
||||
}
|
||||
|
||||
@ -977,7 +977,7 @@ func writelines(ctxt *Link, syms []*Symbol) ([]*Symbol, []*Symbol) {
|
||||
Adduint8(ctxt, ls, 0) // include_directories (empty)
|
||||
|
||||
for _, f := range ctxt.Filesyms {
|
||||
Addstring(ctxt, ls, f.Name)
|
||||
Addstring(ls, f.Name)
|
||||
Adduint8(ctxt, ls, 0)
|
||||
Adduint8(ctxt, ls, 0)
|
||||
Adduint8(ctxt, ls, 0)
|
||||
@ -1147,7 +1147,7 @@ func writeframes(ctxt *Link, syms []*Symbol) []*Symbol {
|
||||
Exitf("dwarf: cieReserve too small by %d bytes.", -pad)
|
||||
}
|
||||
|
||||
Addbytes(ctxt, fs, zeros[:pad])
|
||||
Addbytes(fs, zeros[:pad])
|
||||
|
||||
var deltaBuf []byte
|
||||
var pcsp Pciter
|
||||
@ -1208,7 +1208,7 @@ func writeframes(ctxt *Link, syms []*Symbol) []*Symbol {
|
||||
}
|
||||
Addaddr(ctxt, fs, s)
|
||||
adduintxx(ctxt, fs, uint64(s.Size), SysArch.PtrSize) // address range
|
||||
Addbytes(ctxt, fs, deltaBuf)
|
||||
Addbytes(fs, deltaBuf)
|
||||
}
|
||||
return syms
|
||||
}
|
||||
@ -1314,7 +1314,7 @@ func writepub(ctxt *Link, sname string, ispub func(*dwarf.DWDie) bool, syms []*S
|
||||
fmt.Println("Missing sym for ", name)
|
||||
}
|
||||
adddwarfref(ctxt, s, dtolsym(die.Sym), 4)
|
||||
Addstring(ctxt, s, name)
|
||||
Addstring(s, name)
|
||||
}
|
||||
|
||||
Adduint32(ctxt, s, 0)
|
||||
@ -1378,7 +1378,7 @@ func writegdbscript(ctxt *Link, syms []*Symbol) []*Symbol {
|
||||
s.Type = obj.SDWARFSECT
|
||||
syms = append(syms, s)
|
||||
Adduint8(ctxt, s, 1) // magic 1 byte?
|
||||
Addstring(ctxt, s, gdbscript)
|
||||
Addstring(s, gdbscript)
|
||||
}
|
||||
|
||||
return syms
|
||||
@ -1485,21 +1485,21 @@ func dwarfaddshstrings(ctxt *Link, shstrtab *Symbol) {
|
||||
return
|
||||
}
|
||||
|
||||
Addstring(ctxt, shstrtab, ".debug_abbrev")
|
||||
Addstring(ctxt, shstrtab, ".debug_aranges")
|
||||
Addstring(ctxt, shstrtab, ".debug_frame")
|
||||
Addstring(ctxt, shstrtab, ".debug_info")
|
||||
Addstring(ctxt, shstrtab, ".debug_line")
|
||||
Addstring(ctxt, shstrtab, ".debug_pubnames")
|
||||
Addstring(ctxt, shstrtab, ".debug_pubtypes")
|
||||
Addstring(ctxt, shstrtab, ".debug_gdb_scripts")
|
||||
Addstring(shstrtab, ".debug_abbrev")
|
||||
Addstring(shstrtab, ".debug_aranges")
|
||||
Addstring(shstrtab, ".debug_frame")
|
||||
Addstring(shstrtab, ".debug_info")
|
||||
Addstring(shstrtab, ".debug_line")
|
||||
Addstring(shstrtab, ".debug_pubnames")
|
||||
Addstring(shstrtab, ".debug_pubtypes")
|
||||
Addstring(shstrtab, ".debug_gdb_scripts")
|
||||
if Linkmode == LinkExternal {
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_info")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_aranges")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_line")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_frame")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_pubnames")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".debug_pubtypes")
|
||||
Addstring(shstrtab, elfRelType+".debug_info")
|
||||
Addstring(shstrtab, elfRelType+".debug_aranges")
|
||||
Addstring(shstrtab, elfRelType+".debug_line")
|
||||
Addstring(shstrtab, elfRelType+".debug_frame")
|
||||
Addstring(shstrtab, elfRelType+".debug_pubnames")
|
||||
Addstring(shstrtab, elfRelType+".debug_pubtypes")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1517,9 +1517,9 @@ func elfdynhash(ctxt *Link) {
|
||||
for x = l.aux; x != nil; x = x.next {
|
||||
j++
|
||||
}
|
||||
Adduint16(ctxt, s, uint16(j)) // aux count
|
||||
Adduint32(ctxt, s, uint32(Addstring(ctxt, dynstr, l.file))) // file string offset
|
||||
Adduint32(ctxt, s, 16) // offset from header to first aux
|
||||
Adduint16(ctxt, s, uint16(j)) // aux count
|
||||
Adduint32(ctxt, s, uint32(Addstring(dynstr, l.file))) // file string offset
|
||||
Adduint32(ctxt, s, 16) // offset from header to first aux
|
||||
if l.next != nil {
|
||||
Adduint32(ctxt, s, 16+uint32(j)*16) // offset from this header to next
|
||||
} else {
|
||||
@ -1531,10 +1531,10 @@ func elfdynhash(ctxt *Link) {
|
||||
i++
|
||||
|
||||
// aux struct
|
||||
Adduint32(ctxt, s, elfhash(x.vers)) // hash
|
||||
Adduint16(ctxt, s, 0) // flags
|
||||
Adduint16(ctxt, s, uint16(x.num)) // other - index we refer to this by
|
||||
Adduint32(ctxt, s, uint32(Addstring(ctxt, dynstr, x.vers))) // version string offset
|
||||
Adduint32(ctxt, s, elfhash(x.vers)) // hash
|
||||
Adduint16(ctxt, s, 0) // flags
|
||||
Adduint16(ctxt, s, uint16(x.num)) // other - index we refer to this by
|
||||
Adduint32(ctxt, s, uint32(Addstring(dynstr, x.vers))) // version string offset
|
||||
if x.next != nil {
|
||||
Adduint32(ctxt, s, 16) // offset from this aux to next
|
||||
} else {
|
||||
@ -1840,12 +1840,12 @@ func (ctxt *Link) doelf() {
|
||||
shstrtab.Type = obj.SELFROSECT
|
||||
shstrtab.Attr |= AttrReachable
|
||||
|
||||
Addstring(ctxt, shstrtab, "")
|
||||
Addstring(ctxt, shstrtab, ".text")
|
||||
Addstring(ctxt, shstrtab, ".noptrdata")
|
||||
Addstring(ctxt, shstrtab, ".data")
|
||||
Addstring(ctxt, shstrtab, ".bss")
|
||||
Addstring(ctxt, shstrtab, ".noptrbss")
|
||||
Addstring(shstrtab, "")
|
||||
Addstring(shstrtab, ".text")
|
||||
Addstring(shstrtab, ".noptrdata")
|
||||
Addstring(shstrtab, ".data")
|
||||
Addstring(shstrtab, ".bss")
|
||||
Addstring(shstrtab, ".noptrbss")
|
||||
|
||||
// generate .tbss section (except for OpenBSD where it's not supported)
|
||||
// for dynamic internal linker or external linking, so that various
|
||||
@ -1853,56 +1853,56 @@ func (ctxt *Link) doelf() {
|
||||
// see https://golang.org/issue/5200.
|
||||
if Headtype != obj.Hopenbsd {
|
||||
if !*FlagD || Linkmode == LinkExternal {
|
||||
Addstring(ctxt, shstrtab, ".tbss")
|
||||
Addstring(shstrtab, ".tbss")
|
||||
}
|
||||
}
|
||||
if Headtype == obj.Hnetbsd {
|
||||
Addstring(ctxt, shstrtab, ".note.netbsd.ident")
|
||||
Addstring(shstrtab, ".note.netbsd.ident")
|
||||
}
|
||||
if Headtype == obj.Hopenbsd {
|
||||
Addstring(ctxt, shstrtab, ".note.openbsd.ident")
|
||||
Addstring(shstrtab, ".note.openbsd.ident")
|
||||
}
|
||||
if len(buildinfo) > 0 {
|
||||
Addstring(ctxt, shstrtab, ".note.gnu.build-id")
|
||||
Addstring(shstrtab, ".note.gnu.build-id")
|
||||
}
|
||||
if *flagBuildid != "" {
|
||||
Addstring(ctxt, shstrtab, ".note.go.buildid")
|
||||
Addstring(shstrtab, ".note.go.buildid")
|
||||
}
|
||||
Addstring(ctxt, shstrtab, ".elfdata")
|
||||
Addstring(ctxt, shstrtab, ".rodata")
|
||||
Addstring(shstrtab, ".elfdata")
|
||||
Addstring(shstrtab, ".rodata")
|
||||
// See the comment about data.rel.ro.FOO section names in data.go.
|
||||
relro_prefix := ""
|
||||
if UseRelro() {
|
||||
Addstring(ctxt, shstrtab, ".data.rel.ro")
|
||||
Addstring(shstrtab, ".data.rel.ro")
|
||||
relro_prefix = ".data.rel.ro"
|
||||
}
|
||||
Addstring(ctxt, shstrtab, relro_prefix+".typelink")
|
||||
Addstring(ctxt, shstrtab, relro_prefix+".itablink")
|
||||
Addstring(ctxt, shstrtab, relro_prefix+".gosymtab")
|
||||
Addstring(ctxt, shstrtab, relro_prefix+".gopclntab")
|
||||
Addstring(shstrtab, relro_prefix+".typelink")
|
||||
Addstring(shstrtab, relro_prefix+".itablink")
|
||||
Addstring(shstrtab, relro_prefix+".gosymtab")
|
||||
Addstring(shstrtab, relro_prefix+".gopclntab")
|
||||
|
||||
if Linkmode == LinkExternal {
|
||||
*FlagD = true
|
||||
|
||||
Addstring(ctxt, shstrtab, elfRelType+".text")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".rodata")
|
||||
Addstring(ctxt, shstrtab, elfRelType+relro_prefix+".typelink")
|
||||
Addstring(ctxt, shstrtab, elfRelType+relro_prefix+".itablink")
|
||||
Addstring(ctxt, shstrtab, elfRelType+relro_prefix+".gosymtab")
|
||||
Addstring(ctxt, shstrtab, elfRelType+relro_prefix+".gopclntab")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".noptrdata")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".data")
|
||||
Addstring(shstrtab, elfRelType+".text")
|
||||
Addstring(shstrtab, elfRelType+".rodata")
|
||||
Addstring(shstrtab, elfRelType+relro_prefix+".typelink")
|
||||
Addstring(shstrtab, elfRelType+relro_prefix+".itablink")
|
||||
Addstring(shstrtab, elfRelType+relro_prefix+".gosymtab")
|
||||
Addstring(shstrtab, elfRelType+relro_prefix+".gopclntab")
|
||||
Addstring(shstrtab, elfRelType+".noptrdata")
|
||||
Addstring(shstrtab, elfRelType+".data")
|
||||
if UseRelro() {
|
||||
Addstring(ctxt, shstrtab, elfRelType+".data.rel.ro")
|
||||
Addstring(shstrtab, elfRelType+".data.rel.ro")
|
||||
}
|
||||
|
||||
// add a .note.GNU-stack section to mark the stack as non-executable
|
||||
Addstring(ctxt, shstrtab, ".note.GNU-stack")
|
||||
Addstring(shstrtab, ".note.GNU-stack")
|
||||
|
||||
if Buildmode == BuildmodeShared {
|
||||
Addstring(ctxt, shstrtab, ".note.go.abihash")
|
||||
Addstring(ctxt, shstrtab, ".note.go.pkg-list")
|
||||
Addstring(ctxt, shstrtab, ".note.go.deps")
|
||||
Addstring(shstrtab, ".note.go.abihash")
|
||||
Addstring(shstrtab, ".note.go.pkg-list")
|
||||
Addstring(shstrtab, ".note.go.deps")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1915,35 +1915,35 @@ func (ctxt *Link) doelf() {
|
||||
}
|
||||
|
||||
if hasinitarr {
|
||||
Addstring(ctxt, shstrtab, ".init_array")
|
||||
Addstring(ctxt, shstrtab, elfRelType+".init_array")
|
||||
Addstring(shstrtab, ".init_array")
|
||||
Addstring(shstrtab, elfRelType+".init_array")
|
||||
}
|
||||
|
||||
if !*FlagS {
|
||||
Addstring(ctxt, shstrtab, ".symtab")
|
||||
Addstring(ctxt, shstrtab, ".strtab")
|
||||
Addstring(shstrtab, ".symtab")
|
||||
Addstring(shstrtab, ".strtab")
|
||||
dwarfaddshstrings(ctxt, shstrtab)
|
||||
}
|
||||
|
||||
Addstring(ctxt, shstrtab, ".shstrtab")
|
||||
Addstring(shstrtab, ".shstrtab")
|
||||
|
||||
if !*FlagD { /* -d suppresses dynamic loader format */
|
||||
Addstring(ctxt, shstrtab, ".interp")
|
||||
Addstring(ctxt, shstrtab, ".hash")
|
||||
Addstring(ctxt, shstrtab, ".got")
|
||||
Addstring(shstrtab, ".interp")
|
||||
Addstring(shstrtab, ".hash")
|
||||
Addstring(shstrtab, ".got")
|
||||
if SysArch.Family == sys.PPC64 {
|
||||
Addstring(ctxt, shstrtab, ".glink")
|
||||
Addstring(shstrtab, ".glink")
|
||||
}
|
||||
Addstring(ctxt, shstrtab, ".got.plt")
|
||||
Addstring(ctxt, shstrtab, ".dynamic")
|
||||
Addstring(ctxt, shstrtab, ".dynsym")
|
||||
Addstring(ctxt, shstrtab, ".dynstr")
|
||||
Addstring(ctxt, shstrtab, elfRelType)
|
||||
Addstring(ctxt, shstrtab, elfRelType+".plt")
|
||||
Addstring(shstrtab, ".got.plt")
|
||||
Addstring(shstrtab, ".dynamic")
|
||||
Addstring(shstrtab, ".dynsym")
|
||||
Addstring(shstrtab, ".dynstr")
|
||||
Addstring(shstrtab, elfRelType)
|
||||
Addstring(shstrtab, elfRelType+".plt")
|
||||
|
||||
Addstring(ctxt, shstrtab, ".plt")
|
||||
Addstring(ctxt, shstrtab, ".gnu.version")
|
||||
Addstring(ctxt, shstrtab, ".gnu.version_r")
|
||||
Addstring(shstrtab, ".plt")
|
||||
Addstring(shstrtab, ".gnu.version")
|
||||
Addstring(shstrtab, ".gnu.version_r")
|
||||
|
||||
/* dynamic symbol table - first entry all zeros */
|
||||
s := ctxt.Syms.Lookup(".dynsym", 0)
|
||||
@ -1962,7 +1962,7 @@ func (ctxt *Link) doelf() {
|
||||
s.Type = obj.SELFROSECT
|
||||
s.Attr |= AttrReachable
|
||||
if s.Size == 0 {
|
||||
Addstring(ctxt, s, "")
|
||||
Addstring(s, "")
|
||||
}
|
||||
dynstr := s
|
||||
|
||||
@ -2049,7 +2049,7 @@ func (ctxt *Link) doelf() {
|
||||
}
|
||||
|
||||
if rpath.val != "" {
|
||||
Elfwritedynent(ctxt, s, DT_RUNPATH, uint64(Addstring(ctxt, dynstr, rpath.val)))
|
||||
Elfwritedynent(ctxt, s, DT_RUNPATH, uint64(Addstring(dynstr, rpath.val)))
|
||||
}
|
||||
|
||||
if SysArch.Family == sys.PPC64 {
|
||||
@ -2642,7 +2642,7 @@ func Elfadddynsym(ctxt *Link, s *Symbol) {
|
||||
d := ctxt.Syms.Lookup(".dynsym", 0)
|
||||
|
||||
name := s.Extname
|
||||
Adduint32(ctxt, d, uint32(Addstring(ctxt, ctxt.Syms.Lookup(".dynstr", 0), name)))
|
||||
Adduint32(ctxt, d, uint32(Addstring(ctxt.Syms.Lookup(".dynstr", 0), name)))
|
||||
|
||||
/* type */
|
||||
t := STB_GLOBAL << 4
|
||||
@ -2675,7 +2675,7 @@ func Elfadddynsym(ctxt *Link, s *Symbol) {
|
||||
Adduint64(ctxt, d, uint64(s.Size))
|
||||
|
||||
if SysArch.Family == sys.AMD64 && !s.Attr.CgoExportDynamic() && s.Dynimplib != "" && !seenlib[s.Dynimplib] {
|
||||
Elfwritedynent(ctxt, ctxt.Syms.Lookup(".dynamic", 0), DT_NEEDED, uint64(Addstring(ctxt, ctxt.Syms.Lookup(".dynstr", 0), s.Dynimplib)))
|
||||
Elfwritedynent(ctxt, ctxt.Syms.Lookup(".dynamic", 0), DT_NEEDED, uint64(Addstring(ctxt.Syms.Lookup(".dynstr", 0), s.Dynimplib)))
|
||||
}
|
||||
} else {
|
||||
s.Dynid = int32(Nelfsym)
|
||||
@ -2686,7 +2686,7 @@ func Elfadddynsym(ctxt *Link, s *Symbol) {
|
||||
/* name */
|
||||
name := s.Extname
|
||||
|
||||
Adduint32(ctxt, d, uint32(Addstring(ctxt, ctxt.Syms.Lookup(".dynstr", 0), name)))
|
||||
Adduint32(ctxt, d, uint32(Addstring(ctxt.Syms.Lookup(".dynstr", 0), name)))
|
||||
|
||||
/* value */
|
||||
if s.Type == obj.SDYNIMPORT {
|
||||
|
@ -307,9 +307,9 @@ func adddynlib(ctxt *Link, lib string) {
|
||||
if Iself {
|
||||
s := ctxt.Syms.Lookup(".dynstr", 0)
|
||||
if s.Size == 0 {
|
||||
Addstring(ctxt, s, "")
|
||||
Addstring(s, "")
|
||||
}
|
||||
Elfwritedynent(ctxt, ctxt.Syms.Lookup(".dynamic", 0), DT_NEEDED, uint64(Addstring(ctxt, s, lib)))
|
||||
Elfwritedynent(ctxt, ctxt.Syms.Lookup(".dynamic", 0), DT_NEEDED, uint64(Addstring(s, lib)))
|
||||
} else {
|
||||
Errorf(nil, "adddynlib: unsupported binary format")
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ func machosymtab(ctxt *Link) {
|
||||
}
|
||||
|
||||
// replace "·" as ".", because DTrace cannot handle it.
|
||||
Addstring(ctxt, symstr, strings.Replace(s.Extname, "·", ".", -1))
|
||||
Addstring(symstr, strings.Replace(s.Extname, "·", ".", -1))
|
||||
|
||||
if s.Type == obj.SDYNIMPORT || s.Type == obj.SHOSTOBJ {
|
||||
Adduint8(ctxt, symtab, 0x01) // type N_EXT, external symbol
|
||||
|
@ -126,7 +126,7 @@ func addpctab(ctxt *Link, ftab *Symbol, off int32, d *Pcdata) int32 {
|
||||
var start int32
|
||||
if len(d.P) > 0 {
|
||||
start = int32(len(ftab.P))
|
||||
Addbytes(ctxt, ftab, d.P)
|
||||
Addbytes(ftab, d.P)
|
||||
}
|
||||
return int32(setuint32(ctxt, ftab, int64(off), uint32(start)))
|
||||
}
|
||||
@ -134,7 +134,7 @@ func addpctab(ctxt *Link, ftab *Symbol, off int32, d *Pcdata) int32 {
|
||||
func ftabaddstring(ctxt *Link, ftab *Symbol, s string) int32 {
|
||||
n := int32(len(s)) + 1
|
||||
start := int32(len(ftab.P))
|
||||
Symgrow(ctxt, ftab, int64(start)+int64(n)+1)
|
||||
Symgrow(ftab, int64(start)+int64(n)+1)
|
||||
copy(ftab.P[start:], s)
|
||||
return start
|
||||
}
|
||||
@ -234,7 +234,7 @@ func (ctxt *Link) pclntab() {
|
||||
}
|
||||
|
||||
pclntabNfunc = nfunc
|
||||
Symgrow(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize)+4)
|
||||
Symgrow(ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize)+4)
|
||||
setuint32(ctxt, ftab, 0, 0xfffffffb)
|
||||
setuint8(ctxt, ftab, 6, uint8(SysArch.MinLC))
|
||||
setuint8(ctxt, ftab, 7, uint8(SysArch.PtrSize))
|
||||
@ -270,7 +270,7 @@ func (ctxt *Link) pclntab() {
|
||||
if len(pcln.Funcdata) > 0 && (end&int32(SysArch.PtrSize-1) != 0) {
|
||||
end += 4
|
||||
}
|
||||
Symgrow(ctxt, ftab, int64(end))
|
||||
Symgrow(ftab, int64(end))
|
||||
|
||||
// entry uintptr
|
||||
off = int32(setaddr(ctxt, ftab, int64(off), s))
|
||||
@ -357,7 +357,7 @@ func (ctxt *Link) pclntab() {
|
||||
pclntabFiletabOffset = start
|
||||
setuint32(ctxt, ftab, 8+int64(SysArch.PtrSize)+int64(nfunc)*2*int64(SysArch.PtrSize)+int64(SysArch.PtrSize), uint32(start))
|
||||
|
||||
Symgrow(ctxt, ftab, int64(start)+(int64(len(ctxt.Filesyms))+1)*4)
|
||||
Symgrow(ftab, int64(start)+(int64(len(ctxt.Filesyms))+1)*4)
|
||||
setuint32(ctxt, ftab, int64(start), uint32(len(ctxt.Filesyms)+1))
|
||||
for i := len(ctxt.Filesyms) - 1; i >= 0; i-- {
|
||||
s := ctxt.Filesyms[i]
|
||||
@ -451,7 +451,7 @@ func (ctxt *Link) findfunctab() {
|
||||
// allocate table
|
||||
nbuckets := int32((max - min + BUCKETSIZE - 1) / BUCKETSIZE)
|
||||
|
||||
Symgrow(ctxt, t, 4*int64(nbuckets)+int64(n))
|
||||
Symgrow(t, 4*int64(nbuckets)+int64(n))
|
||||
|
||||
// fill in table
|
||||
for i := int32(0); i < nbuckets; i++ {
|
||||
|
@ -521,7 +521,7 @@ func initdynimport(ctxt *Link) *Dll {
|
||||
for d := dr; d != nil; d = d.next {
|
||||
for m = d.ms; m != nil; m = m.next {
|
||||
m.s.Type = obj.SDATA
|
||||
Symgrow(ctxt, m.s, int64(SysArch.PtrSize))
|
||||
Symgrow(m.s, int64(SysArch.PtrSize))
|
||||
dynName := m.s.Extname
|
||||
// only windows/386 requires stdcall decoration
|
||||
if SysArch.Family == sys.I386 && m.argsize >= 0 {
|
||||
|
@ -594,7 +594,7 @@ func (ctxt *Link) symtab() {
|
||||
// compiler-provided size, so read it from the type data.
|
||||
moduledatatype := ctxt.Syms.ROLookup("type.runtime.moduledata", 0)
|
||||
moduledata.Size = decodetypeSize(ctxt.Arch, moduledatatype)
|
||||
Symgrow(ctxt, moduledata, moduledata.Size)
|
||||
Symgrow(moduledata, moduledata.Size)
|
||||
|
||||
lastmoduledatap := ctxt.Syms.Lookup("runtime.lastmoduledatap", 0)
|
||||
if lastmoduledatap.Type != obj.SDYNIMPORT {
|
||||
|
@ -41,7 +41,7 @@ func addcall(ctxt *ld.Link, s *ld.Symbol, t *ld.Symbol) {
|
||||
s.Attr |= ld.AttrReachable
|
||||
i := s.Size
|
||||
s.Size += 4
|
||||
ld.Symgrow(ctxt, s, s.Size)
|
||||
ld.Symgrow(s, s.Size)
|
||||
r := ld.Addrel(s)
|
||||
r.Sym = t
|
||||
r.Off = int32(i)
|
||||
@ -136,7 +136,7 @@ func gentext(ctxt *ld.Link) {
|
||||
o(0x8d, 0x99)
|
||||
i := initfunc.Size
|
||||
initfunc.Size += 4
|
||||
ld.Symgrow(ctxt, initfunc, initfunc.Size)
|
||||
ld.Symgrow(initfunc, initfunc.Size)
|
||||
r := ld.Addrel(initfunc)
|
||||
r.Sym = ctxt.Syms.Lookup("_GLOBAL_OFFSET_TABLE_", 0)
|
||||
r.Off = int32(i)
|
||||
|
Loading…
Reference in New Issue
Block a user