feat(go): go tool will error now when there are multiple symbols associated with an address

This commit is contained in:
phaneron 2024-09-30 17:18:02 -04:00
parent da8d47619c
commit df7df2ff25

View file

@ -1,6 +1,7 @@
package symfile package symfile
import ( import (
"fmt"
"slices" "slices"
"sort" "sort"
) )
@ -16,6 +17,10 @@ func (t *InMemoryTable) Insert(entry *Entry) (err error) {
}) })
if i < len(t.Entries) { if i < len(t.Entries) {
if t.Entries[i].StartAddress == entry.StartAddress {
err = fmt.Errorf("symfile: (*InMemoryTable).Insert() failed: duplicate entry: %s", entry.Name)
return
}
t.Entries = slices.Insert(t.Entries, i, *entry) t.Entries = slices.Insert(t.Entries, i, *entry)
} else { } else {
t.Entries = append(t.Entries, *entry) t.Entries = append(t.Entries, *entry)