]> Cypherpunks repositories - gostls13.git/commitdiff
debug/elf: adjust version API per issue discussion
authorIan Lance Taylor <iant@golang.org>
Tue, 17 Dec 2024 19:31:17 +0000 (11:31 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 17 Dec 2024 21:28:29 +0000 (13:28 -0800)
This updates the new version API for the discussion on #63952.

Note that the current tests do not have symbols with hidden versions.
Leaving that for later.

For #63952

Change-Id: I1ad4b1e485429a216ba8e5b68f7f4299d120628f
Reviewed-on: https://go-review.googlesource.com/c/go/+/637235
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>

api/go1.24.txt
src/debug/elf/file.go
src/debug/elf/file_test.go
src/debug/elf/symbols_test.go

index 795a70e354769574a6a2a08c98bab1d257a49ef8..05e2006e0747bbf439ffa4941c18cc7ead5abb06 100644 (file)
@@ -106,16 +106,6 @@ pkg debug/elf, const VER_FLG_INFO = 4 #63952
 pkg debug/elf, const VER_FLG_INFO DynamicVersionFlag #63952
 pkg debug/elf, const VER_FLG_WEAK = 2 #63952
 pkg debug/elf, const VER_FLG_WEAK DynamicVersionFlag #63952
-pkg debug/elf, const VersionScopeGlobal = 2 #63952
-pkg debug/elf, const VersionScopeGlobal SymbolVersionScope #63952
-pkg debug/elf, const VersionScopeHidden = 4 #63952
-pkg debug/elf, const VersionScopeHidden SymbolVersionScope #63952
-pkg debug/elf, const VersionScopeLocal = 1 #63952
-pkg debug/elf, const VersionScopeLocal SymbolVersionScope #63952
-pkg debug/elf, const VersionScopeNone = 0 #63952
-pkg debug/elf, const VersionScopeNone SymbolVersionScope #63952
-pkg debug/elf, const VersionScopeSpecific = 3 #63952
-pkg debug/elf, const VersionScopeSpecific SymbolVersionScope #63952
 pkg debug/elf, method (*File) DynamicVersionNeeds() ([]DynamicVersionNeed, error) #63952
 pkg debug/elf, method (*File) DynamicVersions() ([]DynamicVersion, error) #63952
 pkg debug/elf, type DynamicVersion struct #63952
@@ -131,9 +121,11 @@ pkg debug/elf, type DynamicVersionFlag uint16 #63952
 pkg debug/elf, type DynamicVersionNeed struct #63952
 pkg debug/elf, type DynamicVersionNeed struct, Name string #63952
 pkg debug/elf, type DynamicVersionNeed struct, Needs []DynamicVersionDep #63952
-pkg debug/elf, type Symbol struct, VersionScope SymbolVersionScope #63952
-pkg debug/elf, type Symbol struct, VersionIndex int16 #63952
-pkg debug/elf, type SymbolVersionScope uint8 #63952
+pkg debug/elf, type Symbol struct, HasVersion bool #63952
+pkg debug/elf, type Symbol struct, VersionIndex VersionIndex #63952
+pkg debug/elf, method (VersionIndex) Index() uint16 #63952
+pkg debug/elf, method (VersionIndex) IsHidden() bool #63952
+pkg debug/elf, type VersionIndex uint16 #63952
 pkg encoding, type BinaryAppender interface { AppendBinary } #62384
 pkg encoding, type BinaryAppender interface, AppendBinary([]uint8) ([]uint8, error) #62384
 pkg encoding, type TextAppender interface { AppendText } #62384
index 958ed9971d070bc4ecd276cb329a96657c516afc..89bd70b5b2a87c0f492a336ab218f9858697eeb4 100644 (file)
@@ -209,22 +209,13 @@ type Symbol struct {
        Name        string
        Info, Other byte
 
-       // VersionScope describes the version in which the symbol is defined.
-       // This is only set for the dynamic symbol table.
-       // When no symbol versioning information is available,
-       // this is VersionScopeNone.
-       VersionScope SymbolVersionScope
-       // VersionIndex is the version index.
-       // This is only set if VersionScope is VersionScopeSpecific or
-       // VersionScopeHidden. This is only set for the dynamic symbol table.
-       // This index will match either [DynamicVersion.Index]
-       // in the slice returned by [File.DynamicVersions],
-       // or [DynamicVersiondep.Index] in the Needs field
-       // of the elements of the slice returned by [File.DynamicVersionNeeds].
-       // In general, a defined symbol will have an index referring
-       // to DynamicVersions, and an undefined symbol will have an index
-       // referring to some version in DynamicVersionNeeds.
-       VersionIndex int16
+       // HasVersion reports whether the symbol has any version information.
+       // This will only be true for the dynamic symbol table.
+       HasVersion bool
+       // VersionIndex is the symbol's version index.
+       // Use the methods of the [VersionIndex] type to access it.
+       // This field is only meaningful if HasVersion is true.
+       VersionIndex VersionIndex
 
        Section     SectionIndex
        Value, Size uint64
@@ -678,7 +669,6 @@ func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) {
                symbols[i].Name = str
                symbols[i].Info = sym.Info
                symbols[i].Other = sym.Other
-               symbols[i].VersionIndex = -1
                symbols[i].Section = SectionIndex(sym.Shndx)
                symbols[i].Value = uint64(sym.Value)
                symbols[i].Size = uint64(sym.Size)
@@ -726,7 +716,6 @@ func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) {
                symbols[i].Name = str
                symbols[i].Info = sym.Info
                symbols[i].Other = sym.Other
-               symbols[i].VersionIndex = -1
                symbols[i].Section = SectionIndex(sym.Shndx)
                symbols[i].Value = sym.Value
                symbols[i].Size = sym.Size
@@ -1473,7 +1462,7 @@ func (f *File) DynamicSymbols() ([]Symbol, error) {
        }
        if hasVersions {
                for i := range sym {
-                       sym[i].VersionIndex, sym[i].Version, sym[i].Library, sym[i].VersionScope = f.gnuVersion(i)
+                       sym[i].HasVersion, sym[i].VersionIndex, sym[i].Version, sym[i].Library = f.gnuVersion(i)
                }
        }
        return sym, nil
@@ -1502,23 +1491,37 @@ func (f *File) ImportedSymbols() ([]ImportedSymbol, error) {
                if ST_BIND(s.Info) == STB_GLOBAL && s.Section == SHN_UNDEF {
                        all = append(all, ImportedSymbol{Name: s.Name})
                        sym := &all[len(all)-1]
-                       _, sym.Version, sym.Library, _ = f.gnuVersion(i)
+                       _, _, sym.Version, sym.Library = f.gnuVersion(i)
                }
        }
        return all, nil
 }
 
-// SymbolVersionScope describes the version in which a [Symbol] is defined.
-// This is only used for the dynamic symbol table.
-type SymbolVersionScope byte
+// VersionIndex is the type of a [Symbol] version index.
+type VersionIndex uint16
 
-const (
-       VersionScopeNone     SymbolVersionScope = iota // no symbol version available
-       VersionScopeLocal                              // symbol has local scope
-       VersionScopeGlobal                             // symbol has global scope and is in the base version
-       VersionScopeSpecific                           // symbol has global scope and is in the version given by VersionIndex
-       VersionScopeHidden                             // symbol is in the version given by VersionIndex, and is hidden
-)
+// IsHidden reports whether the symbol is hidden within the version.
+// This means that the symbol can only be seen by specifying the exact version.
+func (vi VersionIndex) IsHidden() bool {
+       return vi&0x8000 != 0
+}
+
+// Index returns the version index.
+// If this is the value 0, it means that the symbol is local,
+// and is not visible externally.
+// If this is the value 1, it means that the symbol is in the base version,
+// and has no specific version; it may or may not match a
+// [DynamicVersion.Index] in the slice returned by [File.DynamicVersions].
+// Other values will match either [DynamicVersion.Index]
+// in the slice returned by [File.DynamicVersions],
+// or [DynamicVersionDep.Index] in the Needs field
+// of the elements of the slice returned by [File.DynamicVersionNeeds].
+// In general, a defined symbol will have an index referring
+// to DynamicVersions, and an undefined symbol will have an index
+// referring to some version in DynamicVersionNeeds.
+func (vi VersionIndex) Index() uint16 {
+       return uint16(vi & 0x7fff)
+}
 
 // DynamicVersion is a version defined by a dynamic object.
 // This describes entries in the ELF SHT_GNU_verdef section.
@@ -1752,45 +1755,38 @@ func (f *File) gnuVersionInit(str []byte) (bool, error) {
 
 // gnuVersion adds Library and Version information to sym,
 // which came from offset i of the symbol table.
-func (f *File) gnuVersion(i int) (versionIndex int16, version string, library string, versionFlags SymbolVersionScope) {
+func (f *File) gnuVersion(i int) (hasVersion bool, versionIndex VersionIndex, version string, library string) {
        // Each entry is two bytes; skip undef entry at beginning.
        i = (i + 1) * 2
        if i >= len(f.gnuVersym) {
-               return -1, "", "", VersionScopeNone
+               return false, 0, "", ""
        }
        s := f.gnuVersym[i:]
        if len(s) < 2 {
-               return -1, "", "", VersionScopeNone
-       }
-       j := int32(f.ByteOrder.Uint16(s))
-       ndx := int16(j & 0x7fff)
-
-       if j == 0 {
-               return ndx, "", "", VersionScopeLocal
-       } else if j == 1 {
-               return ndx, "", "", VersionScopeGlobal
+               return false, 0, "", ""
        }
+       vi := VersionIndex(f.ByteOrder.Uint16(s))
+       ndx := vi.Index()
 
-       scope := VersionScopeSpecific
-       if j&0x8000 != 0 {
-               scope = VersionScopeHidden
+       if ndx == 0 || ndx == 1 {
+               return true, vi, "", ""
        }
 
        for _, v := range f.dynVerNeeds {
                for _, n := range v.Needs {
-                       if uint16(ndx) == n.Index {
-                               return ndx, n.Dep, v.Name, scope
+                       if ndx == n.Index {
+                               return true, vi, n.Dep, v.Name
                        }
                }
        }
 
        for _, v := range f.dynVers {
-               if uint16(ndx) == v.Index {
-                       return ndx, v.Name, "", scope
+               if ndx == v.Index {
+                       return true, vi, v.Name, ""
                }
        }
 
-       return -1, "", "", VersionScopeNone
+       return false, 0, "", ""
 }
 
 // ImportedLibraries returns the names of all libraries
index 72e45588682b5590dac6ee46edcdd2cdaaea7c41..1fdbbad04df44fb6ed99a005e41daa621faecf79 100644 (file)
@@ -78,80 +78,80 @@ var fileTests = []fileTest{
                },
                []string{"libc.so.6"},
                []Symbol{
-                       {"", 3, 0, VersionScopeNone, -1, 1, 134512852, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 2, 134512876, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 3, 134513020, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 4, 134513292, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 5, 134513480, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 6, 134513512, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 7, 134513532, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 8, 134513612, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 9, 134513996, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 10, 134514008, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 11, 134518268, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 12, 134518280, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 13, 134518284, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 14, 134518436, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 15, 134518444, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 16, 134518452, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 17, 134518456, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 18, 134518484, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 19, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 20, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 21, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 22, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 23, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 24, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 25, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 26, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 27, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 28, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 29, 0, 0, "", ""},
-                       {"crt1.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"<command line>", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"<built-in>", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"crtstuff.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"__CTOR_LIST__", 1, 0, VersionScopeNone, -1, 14, 134518436, 0, "", ""},
-                       {"__DTOR_LIST__", 1, 0, VersionScopeNone, -1, 15, 134518444, 0, "", ""},
-                       {"__EH_FRAME_BEGIN__", 1, 0, VersionScopeNone, -1, 12, 134518280, 0, "", ""},
-                       {"__JCR_LIST__", 1, 0, VersionScopeNone, -1, 16, 134518452, 0, "", ""},
-                       {"p.0", 1, 0, VersionScopeNone, -1, 11, 134518276, 0, "", ""},
-                       {"completed.1", 1, 0, VersionScopeNone, -1, 18, 134518484, 1, "", ""},
-                       {"__do_global_dtors_aux", 2, 0, VersionScopeNone, -1, 8, 134513760, 0, "", ""},
-                       {"object.2", 1, 0, VersionScopeNone, -1, 18, 134518488, 24, "", ""},
-                       {"frame_dummy", 2, 0, VersionScopeNone, -1, 8, 134513836, 0, "", ""},
-                       {"crtstuff.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"__CTOR_END__", 1, 0, VersionScopeNone, -1, 14, 134518440, 0, "", ""},
-                       {"__DTOR_END__", 1, 0, VersionScopeNone, -1, 15, 134518448, 0, "", ""},
-                       {"__FRAME_END__", 1, 0, VersionScopeNone, -1, 12, 134518280, 0, "", ""},
-                       {"__JCR_END__", 1, 0, VersionScopeNone, -1, 16, 134518452, 0, "", ""},
-                       {"__do_global_ctors_aux", 2, 0, VersionScopeNone, -1, 8, 134513960, 0, "", ""},
-                       {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"<command line>", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"<built-in>", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"hello.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"printf", 18, 0, VersionScopeNone, -1, 0, 0, 44, "", ""},
-                       {"_DYNAMIC", 17, 0, VersionScopeNone, -1, 65521, 134518284, 0, "", ""},
-                       {"__dso_handle", 17, 2, VersionScopeNone, -1, 11, 134518272, 0, "", ""},
-                       {"_init", 18, 0, VersionScopeNone, -1, 6, 134513512, 0, "", ""},
-                       {"environ", 17, 0, VersionScopeNone, -1, 18, 134518512, 4, "", ""},
-                       {"__deregister_frame_info", 32, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
-                       {"__progname", 17, 0, VersionScopeNone, -1, 11, 134518268, 4, "", ""},
-                       {"_start", 18, 0, VersionScopeNone, -1, 8, 134513612, 145, "", ""},
-                       {"__bss_start", 16, 0, VersionScopeNone, -1, 65521, 134518484, 0, "", ""},
-                       {"main", 18, 0, VersionScopeNone, -1, 8, 134513912, 46, "", ""},
-                       {"_init_tls", 18, 0, VersionScopeNone, -1, 0, 0, 5, "", ""},
-                       {"_fini", 18, 0, VersionScopeNone, -1, 9, 134513996, 0, "", ""},
-                       {"atexit", 18, 0, VersionScopeNone, -1, 0, 0, 43, "", ""},
-                       {"_edata", 16, 0, VersionScopeNone, -1, 65521, 134518484, 0, "", ""},
-                       {"_GLOBAL_OFFSET_TABLE_", 17, 0, VersionScopeNone, -1, 65521, 134518456, 0, "", ""},
-                       {"_end", 16, 0, VersionScopeNone, -1, 65521, 134518516, 0, "", ""},
-                       {"exit", 18, 0, VersionScopeNone, -1, 0, 0, 68, "", ""},
-                       {"_Jv_RegisterClasses", 32, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
-                       {"__register_frame_info", 32, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 1, 134512852, 0, "", ""},
+                       {"", 3, 0, false, 0, 2, 134512876, 0, "", ""},
+                       {"", 3, 0, false, 0, 3, 134513020, 0, "", ""},
+                       {"", 3, 0, false, 0, 4, 134513292, 0, "", ""},
+                       {"", 3, 0, false, 0, 5, 134513480, 0, "", ""},
+                       {"", 3, 0, false, 0, 6, 134513512, 0, "", ""},
+                       {"", 3, 0, false, 0, 7, 134513532, 0, "", ""},
+                       {"", 3, 0, false, 0, 8, 134513612, 0, "", ""},
+                       {"", 3, 0, false, 0, 9, 134513996, 0, "", ""},
+                       {"", 3, 0, false, 0, 10, 134514008, 0, "", ""},
+                       {"", 3, 0, false, 0, 11, 134518268, 0, "", ""},
+                       {"", 3, 0, false, 0, 12, 134518280, 0, "", ""},
+                       {"", 3, 0, false, 0, 13, 134518284, 0, "", ""},
+                       {"", 3, 0, false, 0, 14, 134518436, 0, "", ""},
+                       {"", 3, 0, false, 0, 15, 134518444, 0, "", ""},
+                       {"", 3, 0, false, 0, 16, 134518452, 0, "", ""},
+                       {"", 3, 0, false, 0, 17, 134518456, 0, "", ""},
+                       {"", 3, 0, false, 0, 18, 134518484, 0, "", ""},
+                       {"", 3, 0, false, 0, 19, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 20, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 21, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 22, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 23, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 24, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 25, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 26, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 27, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 28, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 29, 0, 0, "", ""},
+                       {"crt1.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"<command line>", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"<built-in>", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"/usr/src/lib/csu/i386-elf/crti.S", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"__CTOR_LIST__", 1, 0, false, 0, 14, 134518436, 0, "", ""},
+                       {"__DTOR_LIST__", 1, 0, false, 0, 15, 134518444, 0, "", ""},
+                       {"__EH_FRAME_BEGIN__", 1, 0, false, 0, 12, 134518280, 0, "", ""},
+                       {"__JCR_LIST__", 1, 0, false, 0, 16, 134518452, 0, "", ""},
+                       {"p.0", 1, 0, false, 0, 11, 134518276, 0, "", ""},
+                       {"completed.1", 1, 0, false, 0, 18, 134518484, 1, "", ""},
+                       {"__do_global_dtors_aux", 2, 0, false, 0, 8, 134513760, 0, "", ""},
+                       {"object.2", 1, 0, false, 0, 18, 134518488, 24, "", ""},
+                       {"frame_dummy", 2, 0, false, 0, 8, 134513836, 0, "", ""},
+                       {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"__CTOR_END__", 1, 0, false, 0, 14, 134518440, 0, "", ""},
+                       {"__DTOR_END__", 1, 0, false, 0, 15, 134518448, 0, "", ""},
+                       {"__FRAME_END__", 1, 0, false, 0, 12, 134518280, 0, "", ""},
+                       {"__JCR_END__", 1, 0, false, 0, 16, 134518452, 0, "", ""},
+                       {"__do_global_ctors_aux", 2, 0, false, 0, 8, 134513960, 0, "", ""},
+                       {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"<command line>", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"<built-in>", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"/usr/src/lib/csu/i386-elf/crtn.S", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"printf", 18, 0, false, 0, 0, 0, 44, "", ""},
+                       {"_DYNAMIC", 17, 0, false, 0, 65521, 134518284, 0, "", ""},
+                       {"__dso_handle", 17, 2, false, 0, 11, 134518272, 0, "", ""},
+                       {"_init", 18, 0, false, 0, 6, 134513512, 0, "", ""},
+                       {"environ", 17, 0, false, 0, 18, 134518512, 4, "", ""},
+                       {"__deregister_frame_info", 32, 0, false, 0, 0, 0, 0, "", ""},
+                       {"__progname", 17, 0, false, 0, 11, 134518268, 4, "", ""},
+                       {"_start", 18, 0, false, 0, 8, 134513612, 145, "", ""},
+                       {"__bss_start", 16, 0, false, 0, 65521, 134518484, 0, "", ""},
+                       {"main", 18, 0, false, 0, 8, 134513912, 46, "", ""},
+                       {"_init_tls", 18, 0, false, 0, 0, 0, 5, "", ""},
+                       {"_fini", 18, 0, false, 0, 9, 134513996, 0, "", ""},
+                       {"atexit", 18, 0, false, 0, 0, 0, 43, "", ""},
+                       {"_edata", 16, 0, false, 0, 65521, 134518484, 0, "", ""},
+                       {"_GLOBAL_OFFSET_TABLE_", 17, 0, false, 0, 65521, 134518456, 0, "", ""},
+                       {"_end", 16, 0, false, 0, 65521, 134518516, 0, "", ""},
+                       {"exit", 18, 0, false, 0, 0, 0, 68, "", ""},
+                       {"_Jv_RegisterClasses", 32, 0, false, 0, 0, 0, 0, "", ""},
+                       {"__register_frame_info", 32, 0, false, 0, 0, 0, 0, "", ""},
                },
        },
        {
@@ -208,79 +208,79 @@ var fileTests = []fileTest{
                },
                []string{"libc.so.6"},
                []Symbol{
-                       {"", 3, 0, VersionScopeNone, -1, 1, 4194816, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 2, 4194844, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 3, 4194880, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 4, 4194920, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 5, 4194952, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 6, 4195048, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 7, 4195110, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 8, 4195120, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 9, 4195152, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 10, 4195176, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 11, 4195224, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 12, 4195248, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 13, 4195296, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 14, 4195732, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 15, 4195748, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 16, 4195768, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 17, 4195808, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 18, 6293128, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 19, 6293144, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 20, 6293160, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 21, 6293168, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 22, 6293584, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 23, 6293592, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 24, 6293632, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 25, 6293656, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 26, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 27, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 28, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 29, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 30, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 31, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 32, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 33, 0, 0, "", ""},
-                       {"init.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"initfini.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"call_gmon_start", 2, 0, VersionScopeNone, -1, 13, 4195340, 0, "", ""},
-                       {"crtstuff.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"__CTOR_LIST__", 1, 0, VersionScopeNone, -1, 18, 6293128, 0, "", ""},
-                       {"__DTOR_LIST__", 1, 0, VersionScopeNone, -1, 19, 6293144, 0, "", ""},
-                       {"__JCR_LIST__", 1, 0, VersionScopeNone, -1, 20, 6293160, 0, "", ""},
-                       {"__do_global_dtors_aux", 2, 0, VersionScopeNone, -1, 13, 4195376, 0, "", ""},
-                       {"completed.6183", 1, 0, VersionScopeNone, -1, 25, 6293656, 1, "", ""},
-                       {"p.6181", 1, 0, VersionScopeNone, -1, 24, 6293648, 0, "", ""},
-                       {"frame_dummy", 2, 0, VersionScopeNone, -1, 13, 4195440, 0, "", ""},
-                       {"crtstuff.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"__CTOR_END__", 1, 0, VersionScopeNone, -1, 18, 6293136, 0, "", ""},
-                       {"__DTOR_END__", 1, 0, VersionScopeNone, -1, 19, 6293152, 0, "", ""},
-                       {"__FRAME_END__", 1, 0, VersionScopeNone, -1, 17, 4195968, 0, "", ""},
-                       {"__JCR_END__", 1, 0, VersionScopeNone, -1, 20, 6293160, 0, "", ""},
-                       {"__do_global_ctors_aux", 2, 0, VersionScopeNone, -1, 13, 4195680, 0, "", ""},
-                       {"initfini.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"hello.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"_GLOBAL_OFFSET_TABLE_", 1, 2, VersionScopeNone, -1, 23, 6293592, 0, "", ""},
-                       {"__init_array_end", 0, 2, VersionScopeNone, -1, 18, 6293124, 0, "", ""},
-                       {"__init_array_start", 0, 2, VersionScopeNone, -1, 18, 6293124, 0, "", ""},
-                       {"_DYNAMIC", 1, 2, VersionScopeNone, -1, 21, 6293168, 0, "", ""},
-                       {"data_start", 32, 0, VersionScopeNone, -1, 24, 6293632, 0, "", ""},
-                       {"__libc_csu_fini", 18, 0, VersionScopeNone, -1, 13, 4195520, 2, "", ""},
-                       {"_start", 18, 0, VersionScopeNone, -1, 13, 4195296, 0, "", ""},
-                       {"__gmon_start__", 32, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
-                       {"_Jv_RegisterClasses", 32, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
-                       {"puts@@GLIBC_2.2.5", 18, 0, VersionScopeNone, -1, 0, 0, 396, "", ""},
-                       {"_fini", 18, 0, VersionScopeNone, -1, 14, 4195732, 0, "", ""},
-                       {"__libc_start_main@@GLIBC_2.2.5", 18, 0, VersionScopeNone, -1, 0, 0, 450, "", ""},
-                       {"_IO_stdin_used", 17, 0, VersionScopeNone, -1, 15, 4195748, 4, "", ""},
-                       {"__data_start", 16, 0, VersionScopeNone, -1, 24, 6293632, 0, "", ""},
-                       {"__dso_handle", 17, 2, VersionScopeNone, -1, 24, 6293640, 0, "", ""},
-                       {"__libc_csu_init", 18, 0, VersionScopeNone, -1, 13, 4195536, 137, "", ""},
-                       {"__bss_start", 16, 0, VersionScopeNone, -1, 65521, 6293656, 0, "", ""},
-                       {"_end", 16, 0, VersionScopeNone, -1, 65521, 6293664, 0, "", ""},
-                       {"_edata", 16, 0, VersionScopeNone, -1, 65521, 6293656, 0, "", ""},
-                       {"main", 18, 0, VersionScopeNone, -1, 13, 4195480, 27, "", ""},
-                       {"_init", 18, 0, VersionScopeNone, -1, 11, 4195224, 0, "", ""},
+                       {"", 3, 0, false, 0, 1, 4194816, 0, "", ""},
+                       {"", 3, 0, false, 0, 2, 4194844, 0, "", ""},
+                       {"", 3, 0, false, 0, 3, 4194880, 0, "", ""},
+                       {"", 3, 0, false, 0, 4, 4194920, 0, "", ""},
+                       {"", 3, 0, false, 0, 5, 4194952, 0, "", ""},
+                       {"", 3, 0, false, 0, 6, 4195048, 0, "", ""},
+                       {"", 3, 0, false, 0, 7, 4195110, 0, "", ""},
+                       {"", 3, 0, false, 0, 8, 4195120, 0, "", ""},
+                       {"", 3, 0, false, 0, 9, 4195152, 0, "", ""},
+                       {"", 3, 0, false, 0, 10, 4195176, 0, "", ""},
+                       {"", 3, 0, false, 0, 11, 4195224, 0, "", ""},
+                       {"", 3, 0, false, 0, 12, 4195248, 0, "", ""},
+                       {"", 3, 0, false, 0, 13, 4195296, 0, "", ""},
+                       {"", 3, 0, false, 0, 14, 4195732, 0, "", ""},
+                       {"", 3, 0, false, 0, 15, 4195748, 0, "", ""},
+                       {"", 3, 0, false, 0, 16, 4195768, 0, "", ""},
+                       {"", 3, 0, false, 0, 17, 4195808, 0, "", ""},
+                       {"", 3, 0, false, 0, 18, 6293128, 0, "", ""},
+                       {"", 3, 0, false, 0, 19, 6293144, 0, "", ""},
+                       {"", 3, 0, false, 0, 20, 6293160, 0, "", ""},
+                       {"", 3, 0, false, 0, 21, 6293168, 0, "", ""},
+                       {"", 3, 0, false, 0, 22, 6293584, 0, "", ""},
+                       {"", 3, 0, false, 0, 23, 6293592, 0, "", ""},
+                       {"", 3, 0, false, 0, 24, 6293632, 0, "", ""},
+                       {"", 3, 0, false, 0, 25, 6293656, 0, "", ""},
+                       {"", 3, 0, false, 0, 26, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 27, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 28, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 29, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 30, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 31, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 32, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 33, 0, 0, "", ""},
+                       {"init.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"initfini.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"call_gmon_start", 2, 0, false, 0, 13, 4195340, 0, "", ""},
+                       {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"__CTOR_LIST__", 1, 0, false, 0, 18, 6293128, 0, "", ""},
+                       {"__DTOR_LIST__", 1, 0, false, 0, 19, 6293144, 0, "", ""},
+                       {"__JCR_LIST__", 1, 0, false, 0, 20, 6293160, 0, "", ""},
+                       {"__do_global_dtors_aux", 2, 0, false, 0, 13, 4195376, 0, "", ""},
+                       {"completed.6183", 1, 0, false, 0, 25, 6293656, 1, "", ""},
+                       {"p.6181", 1, 0, false, 0, 24, 6293648, 0, "", ""},
+                       {"frame_dummy", 2, 0, false, 0, 13, 4195440, 0, "", ""},
+                       {"crtstuff.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"__CTOR_END__", 1, 0, false, 0, 18, 6293136, 0, "", ""},
+                       {"__DTOR_END__", 1, 0, false, 0, 19, 6293152, 0, "", ""},
+                       {"__FRAME_END__", 1, 0, false, 0, 17, 4195968, 0, "", ""},
+                       {"__JCR_END__", 1, 0, false, 0, 20, 6293160, 0, "", ""},
+                       {"__do_global_ctors_aux", 2, 0, false, 0, 13, 4195680, 0, "", ""},
+                       {"initfini.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"_GLOBAL_OFFSET_TABLE_", 1, 2, false, 0, 23, 6293592, 0, "", ""},
+                       {"__init_array_end", 0, 2, false, 0, 18, 6293124, 0, "", ""},
+                       {"__init_array_start", 0, 2, false, 0, 18, 6293124, 0, "", ""},
+                       {"_DYNAMIC", 1, 2, false, 0, 21, 6293168, 0, "", ""},
+                       {"data_start", 32, 0, false, 0, 24, 6293632, 0, "", ""},
+                       {"__libc_csu_fini", 18, 0, false, 0, 13, 4195520, 2, "", ""},
+                       {"_start", 18, 0, false, 0, 13, 4195296, 0, "", ""},
+                       {"__gmon_start__", 32, 0, false, 0, 0, 0, 0, "", ""},
+                       {"_Jv_RegisterClasses", 32, 0, false, 0, 0, 0, 0, "", ""},
+                       {"puts@@GLIBC_2.2.5", 18, 0, false, 0, 0, 0, 396, "", ""},
+                       {"_fini", 18, 0, false, 0, 14, 4195732, 0, "", ""},
+                       {"__libc_start_main@@GLIBC_2.2.5", 18, 0, false, 0, 0, 0, 450, "", ""},
+                       {"_IO_stdin_used", 17, 0, false, 0, 15, 4195748, 4, "", ""},
+                       {"__data_start", 16, 0, false, 0, 24, 6293632, 0, "", ""},
+                       {"__dso_handle", 17, 2, false, 0, 24, 6293640, 0, "", ""},
+                       {"__libc_csu_init", 18, 0, false, 0, 13, 4195536, 137, "", ""},
+                       {"__bss_start", 16, 0, false, 0, 65521, 6293656, 0, "", ""},
+                       {"_end", 16, 0, false, 0, 65521, 6293664, 0, "", ""},
+                       {"_edata", 16, 0, false, 0, 65521, 6293656, 0, "", ""},
+                       {"main", 18, 0, false, 0, 13, 4195480, 27, "", ""},
+                       {"_init", 18, 0, false, 0, 11, 4195224, 0, "", ""},
                },
        },
        {
@@ -338,21 +338,21 @@ var fileTests = []fileTest{
                []ProgHeader{},
                nil,
                []Symbol{
-                       {"hello.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 1, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 3, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 4, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 5, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 6, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 8, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 9, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 11, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 13, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 15, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 16, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 14, 0, 0, "", ""},
-                       {"main", 18, 0, VersionScopeNone, -1, 1, 0, 23, "", ""},
-                       {"puts", 16, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
+                       {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 1, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 3, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 4, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 5, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 6, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 8, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 9, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 11, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 13, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 15, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 16, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 14, 0, 0, "", ""},
+                       {"main", 18, 0, false, 0, 1, 0, 23, "", ""},
+                       {"puts", 16, 0, false, 0, 0, 0, 0, "", ""},
                },
        },
        {
@@ -384,21 +384,21 @@ var fileTests = []fileTest{
                []ProgHeader{},
                nil,
                []Symbol{
-                       {"hello.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 1, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 3, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 4, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 5, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 6, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 8, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 9, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 11, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 13, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 15, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 16, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 14, 0, 0, "", ""},
-                       {"main", 18, 0, VersionScopeNone, -1, 1, 0, 27, "", ""},
-                       {"puts", 16, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
+                       {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 1, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 3, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 4, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 5, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 6, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 8, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 9, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 11, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 13, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 15, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 16, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 14, 0, 0, "", ""},
+                       {"main", 18, 0, false, 0, 1, 0, 27, "", ""},
+                       {"puts", 16, 0, false, 0, 0, 0, 0, "", ""},
                },
        },
        {
@@ -430,21 +430,21 @@ var fileTests = []fileTest{
                []ProgHeader{},
                nil,
                []Symbol{
-                       {"hello.c", 4, 0, VersionScopeNone, -1, 65521, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 1, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 3, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 4, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 5, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 6, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 8, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 9, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 11, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 13, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 15, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 16, 0, 0, "", ""},
-                       {"", 3, 0, VersionScopeNone, -1, 14, 0, 0, "", ""},
-                       {"main", 18, 0, VersionScopeNone, -1, 1, 0, 44, "", ""},
-                       {"puts", 16, 0, VersionScopeNone, -1, 0, 0, 0, "", ""},
+                       {"hello.c", 4, 0, false, 0, 65521, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 1, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 3, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 4, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 5, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 6, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 8, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 9, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 11, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 13, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 15, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 16, 0, 0, "", ""},
+                       {"", 3, 0, false, 0, 14, 0, 0, "", ""},
+                       {"main", 18, 0, false, 0, 1, 0, 44, "", ""},
+                       {"puts", 16, 0, false, 0, 0, 0, 0, "", ""},
                },
        },
 }
index 8b6dac019b63a13c7df205d21700bc40e7edcb92..6053d99acc1a0be268647096a8884921cf7ad3d6 100644 (file)
@@ -39,6 +39,19 @@ func TestSymbols(t *testing.T) {
                if !reflect.DeepEqual(ts, fs) {
                        t.Errorf("%s: Symbols = %v, want %v", file, fs, ts)
                }
+
+               for i, s := range fs {
+                       if s.HasVersion {
+                               // No hidden versions here.
+                               if s.VersionIndex.IsHidden() {
+                                       t.Errorf("%s: symbol %d: unexpected hidden version", file, i)
+                               }
+                               if got, want := s.VersionIndex.Index(), uint16(s.VersionIndex); got != want {
+                                       t.Errorf("%s: symbol %d: VersionIndex.Index() == %d, want %d", file, i, got, want)
+                               }
+                       }
+               }
+
        }
        for file, ts := range symbolsGolden {
                do(file, ts, (*File).Symbols)
@@ -56,8 +69,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1,
                        Value:        0x400200,
                        Size:         0x0,
@@ -66,8 +79,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x2,
                        Value:        0x40021C,
                        Size:         0x0,
@@ -76,8 +89,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x3,
                        Value:        0x400240,
                        Size:         0x0,
@@ -86,8 +99,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x4,
                        Value:        0x400268,
                        Size:         0x0,
@@ -96,8 +109,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x5,
                        Value:        0x400288,
                        Size:         0x0,
@@ -106,8 +119,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x6,
                        Value:        0x4002E8,
                        Size:         0x0,
@@ -116,8 +129,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x7,
                        Value:        0x400326,
                        Size:         0x0,
@@ -126,8 +139,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x8,
                        Value:        0x400330,
                        Size:         0x0,
@@ -136,8 +149,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x9,
                        Value:        0x400350,
                        Size:         0x0,
@@ -146,8 +159,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xA,
                        Value:        0x400368,
                        Size:         0x0,
@@ -156,8 +169,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xB,
                        Value:        0x400398,
                        Size:         0x0,
@@ -166,8 +179,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x4003B0,
                        Size:         0x0,
@@ -176,8 +189,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x4003E0,
                        Size:         0x0,
@@ -186,8 +199,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xE,
                        Value:        0x400594,
                        Size:         0x0,
@@ -196,8 +209,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xF,
                        Value:        0x4005A4,
                        Size:         0x0,
@@ -206,8 +219,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x10,
                        Value:        0x4005B8,
                        Size:         0x0,
@@ -216,8 +229,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x11,
                        Value:        0x4005E0,
                        Size:         0x0,
@@ -226,8 +239,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x12,
                        Value:        0x600688,
                        Size:         0x0,
@@ -236,8 +249,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x13,
                        Value:        0x600698,
                        Size:         0x0,
@@ -246,8 +259,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x14,
                        Value:        0x6006A8,
                        Size:         0x0,
@@ -256,8 +269,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x15,
                        Value:        0x6006B0,
                        Size:         0x0,
@@ -266,8 +279,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x16,
                        Value:        0x600850,
                        Size:         0x0,
@@ -276,8 +289,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x17,
                        Value:        0x600858,
                        Size:         0x0,
@@ -286,8 +299,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x18,
                        Value:        0x600880,
                        Size:         0x0,
@@ -296,8 +309,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x19,
                        Value:        0x600898,
                        Size:         0x0,
@@ -306,8 +319,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1A,
                        Value:        0x0,
                        Size:         0x0,
@@ -316,8 +329,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1B,
                        Value:        0x0,
                        Size:         0x0,
@@ -326,8 +339,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1C,
                        Value:        0x0,
                        Size:         0x0,
@@ -336,8 +349,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1D,
                        Value:        0x0,
                        Size:         0x0,
@@ -346,8 +359,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1E,
                        Value:        0x0,
                        Size:         0x0,
@@ -356,8 +369,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1F,
                        Value:        0x0,
                        Size:         0x0,
@@ -366,8 +379,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x20,
                        Value:        0x0,
                        Size:         0x0,
@@ -376,8 +389,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x21,
                        Value:        0x0,
                        Size:         0x0,
@@ -386,8 +399,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "init.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -396,8 +409,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "initfini.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -406,8 +419,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "call_gmon_start",
                        Info:         0x2,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x40040C,
                        Size:         0x0,
@@ -416,8 +429,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "crtstuff.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -426,8 +439,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__CTOR_LIST__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x12,
                        Value:        0x600688,
                        Size:         0x0,
@@ -436,8 +449,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__DTOR_LIST__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x13,
                        Value:        0x600698,
                        Size:         0x0,
@@ -446,8 +459,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__JCR_LIST__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x14,
                        Value:        0x6006A8,
                        Size:         0x0,
@@ -456,8 +469,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__do_global_dtors_aux",
                        Info:         0x2,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x400430,
                        Size:         0x0,
@@ -466,8 +479,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "completed.6183",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x19,
                        Value:        0x600898,
                        Size:         0x1,
@@ -476,8 +489,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "p.6181",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x18,
                        Value:        0x600890,
                        Size:         0x0,
@@ -486,8 +499,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "frame_dummy",
                        Info:         0x2,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x400470,
                        Size:         0x0,
@@ -496,8 +509,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "crtstuff.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -506,8 +519,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__CTOR_END__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x12,
                        Value:        0x600690,
                        Size:         0x0,
@@ -516,8 +529,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__DTOR_END__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x13,
                        Value:        0x6006A0,
                        Size:         0x0,
@@ -526,8 +539,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__FRAME_END__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x11,
                        Value:        0x400680,
                        Size:         0x0,
@@ -536,8 +549,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__JCR_END__",
                        Info:         0x1,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x14,
                        Value:        0x6006A8,
                        Size:         0x0,
@@ -546,8 +559,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__do_global_ctors_aux",
                        Info:         0x2,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x400560,
                        Size:         0x0,
@@ -556,8 +569,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "initfini.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -566,8 +579,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "hello.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -576,8 +589,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_GLOBAL_OFFSET_TABLE_",
                        Info:         0x1,
                        Other:        0x2,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x17,
                        Value:        0x600858,
                        Size:         0x0,
@@ -586,8 +599,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__init_array_end",
                        Info:         0x0,
                        Other:        0x2,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x12,
                        Value:        0x600684,
                        Size:         0x0,
@@ -596,8 +609,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__init_array_start",
                        Info:         0x0,
                        Other:        0x2,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x12,
                        Value:        0x600684,
                        Size:         0x0,
@@ -606,8 +619,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_DYNAMIC",
                        Info:         0x1,
                        Other:        0x2,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x15,
                        Value:        0x6006B0,
                        Size:         0x0,
@@ -616,8 +629,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "data_start",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x18,
                        Value:        0x600880,
                        Size:         0x0,
@@ -626,8 +639,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__libc_csu_fini",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x4004C0,
                        Size:         0x2,
@@ -636,8 +649,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_start",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x4003E0,
                        Size:         0x0,
@@ -646,8 +659,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__gmon_start__",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x0,
                        Value:        0x0,
                        Size:         0x0,
@@ -656,8 +669,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_Jv_RegisterClasses",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x0,
                        Value:        0x0,
                        Size:         0x0,
@@ -666,8 +679,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "puts@@GLIBC_2.2.5",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x0,
                        Value:        0x0,
                        Size:         0x18C,
@@ -676,8 +689,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_fini",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xE,
                        Value:        0x400594,
                        Size:         0x0,
@@ -686,8 +699,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__libc_start_main@@GLIBC_2.2.5",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x0,
                        Value:        0x0,
                        Size:         0x1C2,
@@ -696,8 +709,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_IO_stdin_used",
                        Info:         0x11,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xF,
                        Value:        0x4005A4,
                        Size:         0x4,
@@ -706,8 +719,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__data_start",
                        Info:         0x10,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x18,
                        Value:        0x600880,
                        Size:         0x0,
@@ -716,8 +729,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__dso_handle",
                        Info:         0x11,
                        Other:        0x2,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x18,
                        Value:        0x600888,
                        Size:         0x0,
@@ -726,8 +739,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__libc_csu_init",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x4004D0,
                        Size:         0x89,
@@ -736,8 +749,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "__bss_start",
                        Info:         0x10,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x600898,
                        Size:         0x0,
@@ -746,8 +759,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_end",
                        Info:         0x10,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x6008A0,
                        Size:         0x0,
@@ -756,8 +769,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_edata",
                        Info:         0x10,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x600898,
                        Size:         0x0,
@@ -766,8 +779,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "main",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x400498,
                        Size:         0x1B,
@@ -776,8 +789,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "_init",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xB,
                        Value:        0x400398,
                        Size:         0x0,
@@ -788,8 +801,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "go-relocation-test-clang.c",
                        Info:         0x4,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF1,
                        Value:        0x0,
                        Size:         0x0,
@@ -798,8 +811,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         ".Linfo_string0",
                        Info:         0x0,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x0,
                        Size:         0x0,
@@ -808,8 +821,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         ".Linfo_string1",
                        Info:         0x0,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x2C,
                        Size:         0x0,
@@ -818,8 +831,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         ".Linfo_string2",
                        Info:         0x0,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x47,
                        Size:         0x0,
@@ -828,8 +841,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         ".Linfo_string3",
                        Info:         0x0,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x4C,
                        Size:         0x0,
@@ -838,8 +851,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         ".Linfo_string4",
                        Info:         0x0,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x4E,
                        Size:         0x0,
@@ -848,8 +861,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x1,
                        Value:        0x0,
                        Size:         0x0,
@@ -858,8 +871,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x2,
                        Value:        0x0,
                        Size:         0x0,
@@ -868,8 +881,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x3,
                        Value:        0x0,
                        Size:         0x0,
@@ -878,8 +891,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x4,
                        Value:        0x0,
                        Size:         0x0,
@@ -888,8 +901,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x6,
                        Value:        0x0,
                        Size:         0x0,
@@ -898,8 +911,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x7,
                        Value:        0x0,
                        Size:         0x0,
@@ -908,8 +921,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x8,
                        Value:        0x0,
                        Size:         0x0,
@@ -918,8 +931,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xA,
                        Value:        0x0,
                        Size:         0x0,
@@ -928,8 +941,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xC,
                        Value:        0x0,
                        Size:         0x0,
@@ -938,8 +951,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xD,
                        Value:        0x0,
                        Size:         0x0,
@@ -948,8 +961,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xE,
                        Value:        0x0,
                        Size:         0x0,
@@ -958,8 +971,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xF,
                        Value:        0x0,
                        Size:         0x0,
@@ -968,8 +981,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "",
                        Info:         0x3,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0x10,
                        Value:        0x0,
                        Size:         0x0,
@@ -978,8 +991,8 @@ var symbolsGolden = map[string][]Symbol{
                        Name:         "v",
                        Info:         0x11,
                        Other:        0x0,
-                       VersionScope: VersionScopeNone,
-                       VersionIndex: -1,
+                       HasVersion:   false,
+                       VersionIndex: 0,
                        Section:      0xFFF2,
                        Value:        0x4,
                        Size:         0x4,
@@ -994,7 +1007,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "__gmon_start__",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeLocal,
+                       HasVersion:   true,
                        VersionIndex: 0x0,
                        Section:      0x0,
                        Value:        0x0,
@@ -1004,7 +1017,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "puts",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x2,
                        Section:      0x0,
                        Value:        0x0,
@@ -1016,7 +1029,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "__libc_start_main",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x2,
                        Section:      0x0,
                        Value:        0x0,
@@ -1032,7 +1045,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSo3putEc",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1044,7 +1057,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "strchr",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x4,
                        Section:      0x0,
                        Value:        0x0,
@@ -1056,7 +1069,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "__cxa_finalize",
                        Info:         0x22,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x4,
                        Section:      0x0,
                        Value:        0x0,
@@ -1068,7 +1081,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSo5tellpEv",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1080,7 +1093,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSo5seekpElSt12_Ios_Seekdir",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1092,7 +1105,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_Znwm",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1104,7 +1117,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZdlPvm",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x5,
                        Section:      0x0,
                        Value:        0x0,
@@ -1116,7 +1129,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "__stack_chk_fail",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x6,
                        Section:      0x0,
                        Value:        0x0,
@@ -1128,7 +1141,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x7,
                        Section:      0x0,
                        Value:        0x0,
@@ -1140,7 +1153,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSo5seekpESt4fposI11__mbstate_tE",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1152,7 +1165,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSi4readEPcl",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1164,7 +1177,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSi5seekgESt4fposI11__mbstate_tE",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1176,7 +1189,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSo5writeEPKcl",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1188,7 +1201,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSi5seekgElSt12_Ios_Seekdir",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1200,7 +1213,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZSt21ios_base_library_initv",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x8,
                        Section:      0x0,
                        Value:        0x0,
@@ -1212,7 +1225,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "TIFFClientOpen",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x9,
                        Section:      0x0,
                        Value:        0x0,
@@ -1224,7 +1237,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1236,7 +1249,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ZNSi5tellgEv",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x3,
                        Section:      0x0,
                        Value:        0x0,
@@ -1248,7 +1261,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ITM_deregisterTMCloneTable",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeGlobal,
+                       HasVersion:   true,
                        VersionIndex: 0x1,
                        Section:      0x0,
                        Value:        0x0,
@@ -1258,7 +1271,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "__gmon_start__",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeGlobal,
+                       HasVersion:   true,
                        VersionIndex: 0x1,
                        Section:      0x0,
                        Value:        0x0,
@@ -1268,7 +1281,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_ITM_registerTMCloneTable",
                        Info:         0x20,
                        Other:        0x0,
-                       VersionScope: VersionScopeGlobal,
+                       HasVersion:   true,
                        VersionIndex: 0x1,
                        Section:      0x0,
                        Value:        0x0,
@@ -1278,7 +1291,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "LIBTIFFXX_4.0",
                        Info:         0x11,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x2,
                        Section:      0xFFF1,
                        Value:        0x0,
@@ -1290,7 +1303,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_Z14TIFFStreamOpenPKcPSo",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x2,
                        Section:      0xF,
                        Value:        0x1860,
@@ -1302,7 +1315,7 @@ var dynamicSymbolsGolden = map[string][]Symbol{
                        Name:         "_Z14TIFFStreamOpenPKcPSi",
                        Info:         0x12,
                        Other:        0x0,
-                       VersionScope: VersionScopeSpecific,
+                       HasVersion:   true,
                        VersionIndex: 0x2,
                        Section:      0xF,
                        Value:        0x1920,