mirror of
https://github.com/golang/go
synced 2024-11-22 20:24:47 -07:00
cmd/link: remove elfwritedynentsym
elfwritedynentsym and elfWriteDynEntSym are identical. Change-Id: I893a9a65fdc496f98ba6e66c2bf1ed8dd52f52fd Reviewed-on: https://go-review.googlesource.com/c/go/+/342709 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
4012fea822
commit
3001b0abf0
@ -480,10 +480,6 @@ func Elfwritedynent(arch *sys.Arch, s *loader.SymbolBuilder, tag elf.DynTag, val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func elfwritedynentsym(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym) {
|
|
||||||
Elfwritedynentsymplus(ctxt, s, tag, t, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Elfwritedynentsymplus(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym, add int64) {
|
func Elfwritedynentsymplus(ctxt *Link, s *loader.SymbolBuilder, tag elf.DynTag, t loader.Sym, add int64) {
|
||||||
if elf64 {
|
if elf64 {
|
||||||
s.AddUint64(ctxt.Arch, uint64(tag))
|
s.AddUint64(ctxt.Arch, uint64(tag))
|
||||||
@ -1472,24 +1468,24 @@ func (ctxt *Link) doelf() {
|
|||||||
/*
|
/*
|
||||||
* .dynamic table
|
* .dynamic table
|
||||||
*/
|
*/
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_HASH, hash.Sym())
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_HASH, hash.Sym())
|
||||||
|
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_SYMTAB, dynsym.Sym())
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_SYMTAB, dynsym.Sym())
|
||||||
if elf64 {
|
if elf64 {
|
||||||
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_SYMENT, ELF64SYMSIZE)
|
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_SYMENT, ELF64SYMSIZE)
|
||||||
} else {
|
} else {
|
||||||
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_SYMENT, ELF32SYMSIZE)
|
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_SYMENT, ELF32SYMSIZE)
|
||||||
}
|
}
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_STRTAB, dynstr.Sym())
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_STRTAB, dynstr.Sym())
|
||||||
elfwritedynentsymsize(ctxt, dynamic, elf.DT_STRSZ, dynstr.Sym())
|
elfwritedynentsymsize(ctxt, dynamic, elf.DT_STRSZ, dynstr.Sym())
|
||||||
if elfRelType == ".rela" {
|
if elfRelType == ".rela" {
|
||||||
rela := ldr.LookupOrCreateSym(".rela", 0)
|
rela := ldr.LookupOrCreateSym(".rela", 0)
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_RELA, rela)
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_RELA, rela)
|
||||||
elfwritedynentsymsize(ctxt, dynamic, elf.DT_RELASZ, rela)
|
elfwritedynentsymsize(ctxt, dynamic, elf.DT_RELASZ, rela)
|
||||||
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_RELAENT, ELF64RELASIZE)
|
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_RELAENT, ELF64RELASIZE)
|
||||||
} else {
|
} else {
|
||||||
rel := ldr.LookupOrCreateSym(".rel", 0)
|
rel := ldr.LookupOrCreateSym(".rel", 0)
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_REL, rel)
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_REL, rel)
|
||||||
elfwritedynentsymsize(ctxt, dynamic, elf.DT_RELSZ, rel)
|
elfwritedynentsymsize(ctxt, dynamic, elf.DT_RELSZ, rel)
|
||||||
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_RELENT, ELF32RELSIZE)
|
Elfwritedynent(ctxt.Arch, dynamic, elf.DT_RELENT, ELF32RELSIZE)
|
||||||
}
|
}
|
||||||
@ -1499,9 +1495,9 @@ func (ctxt *Link) doelf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctxt.IsPPC64() {
|
if ctxt.IsPPC64() {
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_PLTGOT, plt.Sym())
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_PLTGOT, plt.Sym())
|
||||||
} else {
|
} else {
|
||||||
elfwritedynentsym(ctxt, dynamic, elf.DT_PLTGOT, gotplt.Sym())
|
elfWriteDynEntSym(ctxt, dynamic, elf.DT_PLTGOT, gotplt.Sym())
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctxt.IsPPC64() {
|
if ctxt.IsPPC64() {
|
||||||
|
Loading…
Reference in New Issue
Block a user