]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/ld: change elf64 from int to bool
authorIan Lance Taylor <iant@golang.org>
Wed, 8 Apr 2015 15:44:08 +0000 (08:44 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 8 Apr 2015 16:54:18 +0000 (16:54 +0000)
Change-Id: Iaf2dba7d699a8d52f91ce10222ab0d1a0f1f21fc
Reviewed-on: https://go-review.googlesource.com/8625
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/ld/elf.go
src/cmd/internal/ld/symtab.go

index f932164b47d4de391b3bdbd4e9d6874f80bf3d1d..c588d93933e57899369ec739f48e09933f76fa10 100644 (file)
@@ -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
index 4e1bfc685df077bc74d546a642e779b8b0e72b01..af818ce3aa9a3b076c6db024d2546689ef218ad0 100644 (file)
@@ -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)