mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: change shdr and phdr from arrays to slices
Removes an arbitrary and unnecessary limit. Change-Id: Iba04568ed5e6b1a8f8f23369f51f068e830f1059 Reviewed-on: https://go-review.googlesource.com/c/go/+/718600 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
parent
d3aeba1670
commit
6525f46707
1 changed files with 6 additions and 19 deletions
|
|
@ -101,10 +101,6 @@ var elfstrdat, elfshstrdat []byte
|
|||
// On FreeBSD, cannot be larger than a page.
|
||||
const ELFRESERVE = 4096
|
||||
|
||||
const (
|
||||
NSECT = 400
|
||||
)
|
||||
|
||||
var (
|
||||
Nelfsym = 1
|
||||
|
||||
|
|
@ -114,8 +110,8 @@ var (
|
|||
elfRelType string
|
||||
|
||||
ehdr ElfEhdr
|
||||
phdr [NSECT]*ElfPhdr
|
||||
shdr [NSECT]*ElfShdr
|
||||
phdr = make([]*ElfPhdr, 0, 8)
|
||||
shdr = make([]*ElfShdr, 0, 64)
|
||||
|
||||
interp string
|
||||
)
|
||||
|
|
@ -334,12 +330,8 @@ func elfwritephdrs(out *OutBuf) uint32 {
|
|||
|
||||
func newElfPhdr() *ElfPhdr {
|
||||
e := new(ElfPhdr)
|
||||
if ehdr.Phnum >= NSECT {
|
||||
Errorf("too many phdrs")
|
||||
} else {
|
||||
phdr[ehdr.Phnum] = e
|
||||
phdr = append(phdr, e)
|
||||
ehdr.Phnum++
|
||||
}
|
||||
if elf64 {
|
||||
ehdr.Shoff += ELF64PHDRSIZE
|
||||
} else {
|
||||
|
|
@ -352,13 +344,8 @@ func newElfShdr(name int64) *ElfShdr {
|
|||
e := new(ElfShdr)
|
||||
e.Name = uint32(name)
|
||||
e.shnum = elf.SectionIndex(ehdr.Shnum)
|
||||
if ehdr.Shnum >= NSECT {
|
||||
Errorf("too many shdrs")
|
||||
} else {
|
||||
shdr[ehdr.Shnum] = e
|
||||
shdr = append(shdr, e)
|
||||
ehdr.Shnum++
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue