var Nelfsym int = 1
-var elf64 int
+var elf64 bool
var ehdr ElfEhdr
fallthrough
case '6', '7':
- elf64 = 1
+ elf64 = true
ehdr.phoff = ELF64HDRSIZE /* Must be be ELF64HDRSIZE: first PHdr must follow ELF header */
ehdr.shoff = ELF64HDRSIZE /* Will move as we add PHeaders */
}
func elfwriteshdrs() uint32 {
- if elf64 != 0 {
+ if elf64 {
for i := 0; i < int(ehdr.shnum); i++ {
elf64shdr(shdr[i])
}
}
func elfwritephdrs() uint32 {
- if elf64 != 0 {
+ if elf64 {
for i := 0; i < int(ehdr.phnum); i++ {
elf64phdr(phdr[i])
}
phdr[ehdr.phnum] = e
ehdr.phnum++
}
- if elf64 != 0 {
+ if elf64 {
ehdr.shoff += ELF64PHDRSIZE
} else {
ehdr.shoff += ELF32PHDRSIZE
}
func elfwritehdr() uint32 {
- if elf64 != 0 {
+ if elf64 {
return elf64writehdr()
}
return elf32writehdr()
}
func Elfwritedynent(s *LSym, tag int, val uint64) {
- if elf64 != 0 {
+ if elf64 {
Adduint64(Ctxt, s, uint64(tag))
Adduint64(Ctxt, s, val)
} else {
}
func Elfwritedynentsymplus(s *LSym, tag int, t *LSym, add int64) {
- if elf64 != 0 {
+ if elf64 {
Adduint64(Ctxt, s, uint64(tag))
} else {
Adduint32(Ctxt, s, uint32(tag))
}
func elfwritedynentsymsize(s *LSym, tag int, t *LSym) {
- if elf64 != 0 {
+ if elf64 {
Adduint64(Ctxt, s, uint64(tag))
} else {
Adduint32(Ctxt, s, uint32(tag))
sh := elfshname(".dynsym")
sh.type_ = SHT_DYNSYM
sh.flags = SHF_ALLOC
- if elf64 != 0 {
+ if elf64 {
sh.entsize = ELF64SYMSIZE
} else {
sh.entsize = ELF32SYMSIZE
} else if HEADTYPE == Hdragonfly {
eh.ident[EI_OSABI] = ELFOSABI_NONE
}
- if elf64 != 0 {
+ if elf64 {
eh.ident[EI_CLASS] = ELFCLASS64
} else {
eh.ident[EI_CLASS] = ELFCLASS32