CL 22720 hid all recently added functionality for go1.7.
Make everything exported again, so we could use it now.
Updates #15345
Change-Id: Id8ccba7199422b554407ec14c343d2c28fbb8f72
Reviewed-on: https://go-review.googlesource.com/27212
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
        OptionalHeader interface{} // of type *OptionalHeader32 or *OptionalHeader64
        Sections       []*Section
        Symbols        []*Symbol    // COFF symbols with auxiliary symbol records removed
-       _COFFSymbols   []COFFSymbol // all COFF symbols (including auxiliary symbol records)
-       _StringTable   _StringTable
+       COFFSymbols    []COFFSymbol // all COFF symbols (including auxiliary symbol records)
+       StringTable    StringTable
 
        closer io.Closer
 }
        var err error
 
        // Read string table.
-       f._StringTable, err = readStringTable(&f.FileHeader, sr)
+       f.StringTable, err = readStringTable(&f.FileHeader, sr)
        if err != nil {
                return nil, err
        }
 
        // Read symbol table.
-       f._COFFSymbols, err = readCOFFSymbols(&f.FileHeader, sr)
+       f.COFFSymbols, err = readCOFFSymbols(&f.FileHeader, sr)
        if err != nil {
                return nil, err
        }
-       f.Symbols, err = removeAuxSymbols(f._COFFSymbols, f._StringTable)
+       f.Symbols, err = removeAuxSymbols(f.COFFSymbols, f.StringTable)
        if err != nil {
                return nil, err
        }
                if err := binary.Read(sr, binary.LittleEndian, sh); err != nil {
                        return nil, err
                }
-               name, err := sh.fullName(f._StringTable)
+               name, err := sh.fullName(f.StringTable)
                if err != nil {
                        return nil, err
                }
        }
        for i := range f.Sections {
                var err error
-               f.Sections[i]._Relocs, err = readRelocs(&f.Sections[i].SectionHeader, sr)
+               f.Sections[i].Relocs, err = readRelocs(&f.Sections[i].SectionHeader, sr)
                if err != nil {
                        return nil, err
                }
 
 // fullName finds real name of section sh. Normally name is stored
 // in sh.Name, but if it is longer then 8 characters, it is stored
 // in COFF string table st instead.
-func (sh *SectionHeader32) fullName(st _StringTable) (string, error) {
+func (sh *SectionHeader32) fullName(st StringTable) (string, error) {
        if sh.Name[0] != '/' {
                return cstring(sh.Name[:]), nil
        }
 
 // TODO(brainman): copy all IMAGE_REL_* consts from ldpe.go here
 
-// _Reloc represents a PE COFF relocation.
+// Reloc represents a PE COFF relocation.
 // Each section contains its own relocation list.
-type _Reloc struct {
+type Reloc struct {
        VirtualAddress   uint32
        SymbolTableIndex uint32
        Type             uint16
 }
 
-func readRelocs(sh *SectionHeader, r io.ReadSeeker) ([]_Reloc, error) {
+func readRelocs(sh *SectionHeader, r io.ReadSeeker) ([]Reloc, error) {
        if sh.NumberOfRelocations <= 0 {
                return nil, nil
        }
        if err != nil {
                return nil, fmt.Errorf("fail to seek to %q section relocations: %v", sh.Name, err)
        }
-       relocs := make([]_Reloc, sh.NumberOfRelocations)
+       relocs := make([]Reloc, sh.NumberOfRelocations)
        err = binary.Read(r, binary.LittleEndian, relocs)
        if err != nil {
                return nil, fmt.Errorf("fail to read section relocations: %v", err)
 // Section provides access to PE COFF section.
 type Section struct {
        SectionHeader
-       _Relocs []_Reloc
+       Relocs []Reloc
 
        // Embed ReaderAt for ReadAt method.
        // Do not embed SectionReader directly
 
        return string(b[:i])
 }
 
-// _StringTable is a COFF string table.
-type _StringTable []byte
+// StringTable is a COFF string table.
+type StringTable []byte
 
-func readStringTable(fh *FileHeader, r io.ReadSeeker) (_StringTable, error) {
+func readStringTable(fh *FileHeader, r io.ReadSeeker) (StringTable, error) {
        // COFF string table is located right after COFF symbol table.
        if fh.PointerToSymbolTable <= 0 {
                return nil, nil
        if err != nil {
                return nil, fmt.Errorf("fail to read string table: %v", err)
        }
-       return _StringTable(buf), nil
+       return StringTable(buf), nil
 }
 
 // TODO(brainman): decide if start parameter should be int instead of uint32
 
 // String extracts string from COFF string table st at offset start.
-func (st _StringTable) String(start uint32) (string, error) {
+func (st StringTable) String(start uint32) (string, error) {
        // start includes 4 bytes of string table length
        if start < 4 {
                return "", fmt.Errorf("offset %d is before the start of string table", start)
 
        return false, 0
 }
 
-// _FullName finds real name of symbol sym. Normally name is stored
+// FullName finds real name of symbol sym. Normally name is stored
 // in sym.Name, but if it is longer then 8 characters, it is stored
 // in COFF string table st instead.
-func (sym *COFFSymbol) _FullName(st _StringTable) (string, error) {
+func (sym *COFFSymbol) FullName(st StringTable) (string, error) {
        if ok, offset := isSymNameOffset(sym.Name); ok {
                return st.String(offset)
        }
        return cstring(sym.Name[:]), nil
 }
 
-func removeAuxSymbols(allsyms []COFFSymbol, st _StringTable) ([]*Symbol, error) {
+func removeAuxSymbols(allsyms []COFFSymbol, st StringTable) ([]*Symbol, error) {
        if len(allsyms) == 0 {
                return nil, nil
        }
                        aux--
                        continue
                }
-               name, err := sym._FullName(st)
+               name, err := sym.FullName(st)
                if err != nil {
                        return nil, err
                }