From: Ian Lance Taylor Date: Wed, 8 Apr 2015 15:44:08 +0000 (-0700) Subject: cmd/internal/ld: change elf64 from int to bool X-Git-Tag: go1.5beta1~1242 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ac67b55680eee8f16c477301726007bc15fcd5f;p=gostls13.git cmd/internal/ld: change elf64 from int to bool Change-Id: Iaf2dba7d699a8d52f91ce10222ab0d1a0f1f21fc Reviewed-on: https://go-review.googlesource.com/8625 Reviewed-by: Josh Bleecher Snyder Reviewed-by: Minux Ma Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/internal/ld/elf.go b/src/cmd/internal/ld/elf.go index f932164b47..c588d93933 100644 --- a/src/cmd/internal/ld/elf.go +++ b/src/cmd/internal/ld/elf.go @@ -725,7 +725,7 @@ var Iself bool var Nelfsym int = 1 -var elf64 int +var elf64 bool var ehdr ElfEhdr @@ -764,7 +764,7 @@ func Elfinit() { 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 */ @@ -854,7 +854,7 @@ func elf32shdr(e *ElfShdr) { } func elfwriteshdrs() uint32 { - if elf64 != 0 { + if elf64 { for i := 0; i < int(ehdr.shnum); i++ { elf64shdr(shdr[i]) } @@ -879,7 +879,7 @@ func elfsetstring(s string, off int) { } func elfwritephdrs() uint32 { - if elf64 != 0 { + if elf64 { for i := 0; i < int(ehdr.phnum); i++ { elf64phdr(phdr[i]) } @@ -900,7 +900,7 @@ func newElfPhdr() *ElfPhdr { phdr[ehdr.phnum] = e ehdr.phnum++ } - if elf64 != 0 { + if elf64 { ehdr.shoff += ELF64PHDRSIZE } else { ehdr.shoff += ELF32PHDRSIZE @@ -967,7 +967,7 @@ func elf32writehdr() uint32 { } func elfwritehdr() uint32 { - if elf64 != 0 { + if elf64 { return elf64writehdr() } return elf32writehdr() @@ -991,7 +991,7 @@ func elfhash(name []byte) uint32 { } func Elfwritedynent(s *LSym, tag int, val uint64) { - if elf64 != 0 { + if elf64 { Adduint64(Ctxt, s, uint64(tag)) Adduint64(Ctxt, s, val) } else { @@ -1005,7 +1005,7 @@ func elfwritedynentsym(s *LSym, tag int, t *LSym) { } 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)) @@ -1014,7 +1014,7 @@ func Elfwritedynentsymplus(s *LSym, tag int, t *LSym, add int64) { } func elfwritedynentsymsize(s *LSym, tag int, t *LSym) { - if elf64 != 0 { + if elf64 { Adduint64(Ctxt, s, uint64(tag)) } else { Adduint32(Ctxt, s, uint32(tag)) @@ -2015,7 +2015,7 @@ func Asmbelf(symo int64) { sh := elfshname(".dynsym") sh.type_ = SHT_DYNSYM sh.flags = SHF_ALLOC - if elf64 != 0 { + if elf64 { sh.entsize = ELF64SYMSIZE } else { sh.entsize = ELF32SYMSIZE @@ -2266,7 +2266,7 @@ elfobj: } 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 diff --git a/src/cmd/internal/ld/symtab.go b/src/cmd/internal/ld/symtab.go index 4e1bfc685d..af818ce3aa 100644 --- a/src/cmd/internal/ld/symtab.go +++ b/src/cmd/internal/ld/symtab.go @@ -167,7 +167,7 @@ func putelfsectionsym(s *LSym, shndx int) { func putelfsymshndx(sympos int64, shndx int) { here := Cpos() - if elf64 != 0 { + if elf64 { Cseek(sympos + 6) } else { Cseek(sympos + 14)