no plan9obj.ErrNoSymbols

37 views
Skip to first unread message

Dan Kortschak

unread,
Aug 26, 2021, 3:56:30 AM8/26/21
to golang-nuts
The elf package provide a sentinel error, ErrNoSymbols for the case
that Symbols or DynamicSymbols cannot return a symbol list because the
section is empty[1]. The same situation is handled in plan9obj by
returning a new error for this case[2-3]. For PE/Mach-O there is no
issue since access to the symbols is via direct access to a slice
field.

Because of this, it's either necessary to do an error string comparison
or re-call f.Section("syms") to check whether is was nil.

Would a PR to add a package var error reflecting the elf package
approach be acceptable?

thanks
Dan

[1]https://pkg.go.dev/debug/e...@go1.17#pkg-variables
[2]https://pkg.go.dev/debug/plan...@go1.17#pkg-variables
[3]
https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/debug/plan9obj/file.go;l=308


Reply all
Reply to author
Forward
0 new messages