Commit 4aca8b00 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle

cmd/internal/objabi: shrink SymType down to a uint8

Now that it only takes small values.

Change-Id: I08086d392529d8775b470d65afc2475f8d0e7f4a
Reviewed-on: https://go-review.googlesource.com/42030
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent d2a95451
......@@ -283,7 +283,7 @@ func (w *objWriter) writeSym(s *LSym) {
}
w.wr.WriteByte(symPrefix)
w.writeInt(int64(s.Type))
w.wr.WriteByte(byte(s.Type))
w.writeRefIndex(s)
flags := int64(0)
if s.DuplicateOK() {
......
......@@ -31,7 +31,7 @@
package objabi
// A SymKind describes the kind of memory represented by a symbol.
type SymKind int16
type SymKind uint8
// Defined SymKind values.
//
......
......@@ -9,7 +9,7 @@ const _SymKind_name = "SxxxSTEXTSRODATASNOPTRDATASDATASBSSSNOPTRBSSSTLSBSSSDWARF
var _SymKind_index = [...]uint8{0, 4, 9, 16, 26, 31, 35, 44, 51, 61}
func (i SymKind) String() string {
if i < 0 || i >= SymKind(len(_SymKind_index)-1) {
if i >= SymKind(len(_SymKind_index)-1) {
return fmt.Sprintf("SymKind(%d)", i)
}
return _SymKind_name[_SymKind_index[i]:_SymKind_index[i+1]]
......
......@@ -155,10 +155,15 @@ func (r *objReader) readSlices() {
const symPrefix = 0xfe
func (r *objReader) readSym() {
if c, err := r.rd.ReadByte(); c != symPrefix || err != nil {
var c byte
var err error
if c, err = r.rd.ReadByte(); c != symPrefix || err != nil {
log.Fatalln("readSym out of sync")
}
t := abiSymKindToSymKind[r.readInt()]
if c, err = r.rd.ReadByte(); err != nil {
log.Fatalln("error reading input: ", err)
}
t := abiSymKindToSymKind[c]
s := r.readSymIndex()
flags := r.readInt()
dupok := flags&1 != 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment