summaryrefslogtreecommitdiff
path: root/src/cmd/internal/objfile/plan9obj.go
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2014-08-28 16:01:31 -0700
committerAnthony Martin <ality@pbrane.org>2014-08-28 16:01:31 -0700
commit13c69f037986ba4a4cb1890822bfd15702a2971e (patch)
tree3e0808bcd519dd7b89c2b87f4916b0ad83426c53 /src/cmd/internal/objfile/plan9obj.go
parentdc11be8ddadba6897ab6ec5b0578c5f6c3fb8868 (diff)
downloadgo-git-13c69f037986ba4a4cb1890822bfd15702a2971e.tar.gz
cmd/internal/objfile: fix dissassembly of Plan 9 object files
This is a reapplication of CL 93520045 (changeset 5012df7fac58) since that was lost during the move to an internal package. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/134020043
Diffstat (limited to 'src/cmd/internal/objfile/plan9obj.go')
-rw-r--r--src/cmd/internal/objfile/plan9obj.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cmd/internal/objfile/plan9obj.go b/src/cmd/internal/objfile/plan9obj.go
index d2c3d3f3fe..80744f82a8 100644
--- a/src/cmd/internal/objfile/plan9obj.go
+++ b/src/cmd/internal/objfile/plan9obj.go
@@ -13,6 +13,15 @@ import (
"sort"
)
+var validSymType = map[rune]bool{
+ 'T': true,
+ 't': true,
+ 'D': true,
+ 'd': true,
+ 'B': true,
+ 'b': true,
+}
+
type plan9File struct {
plan9 *plan9obj.File
}
@@ -35,6 +44,9 @@ func (f *plan9File) symbols() ([]Sym, error) {
// We infer the size of a symbol by looking at where the next symbol begins.
var addrs []uint64
for _, s := range plan9Syms {
+ if !validSymType[s.Type] {
+ continue
+ }
addrs = append(addrs, s.Value)
}
sort.Sort(uint64s(addrs))
@@ -42,6 +54,9 @@ func (f *plan9File) symbols() ([]Sym, error) {
var syms []Sym
for _, s := range plan9Syms {
+ if !validSymType[s.Type] {
+ continue
+ }
sym := Sym{Addr: s.Value, Name: s.Name, Code: rune(s.Type)}
i := sort.Search(len(addrs), func(x int) bool { return addrs[x] > s.Value })
if i < len(addrs) {