From df7df2ff25ef63b7c2bec241b26f655d369ad4c7 Mon Sep 17 00:00:00 2001 From: superp00t Date: Mon, 30 Sep 2024 17:18:02 -0400 Subject: [PATCH] feat(go): go tool will error now when there are multiple symbols associated with an address --- go/symfile/memory_table.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go/symfile/memory_table.go b/go/symfile/memory_table.go index 265b0b0..e56856d 100644 --- a/go/symfile/memory_table.go +++ b/go/symfile/memory_table.go @@ -1,6 +1,7 @@ package symfile import ( + "fmt" "slices" "sort" ) @@ -16,6 +17,10 @@ func (t *InMemoryTable) Insert(entry *Entry) (err error) { }) 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) } else { t.Entries = append(t.Entries, *entry)