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/elf@go1.17#pkg-variables
[2]https://pkg.go.dev/debug/plan9obj@go1.17#pkg-variables
[3]
https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/debug/plan9obj/file.go;l=308


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9e60500df5d35ce2c732466b331b1d2c521a018d.camel%40kortschak.io.

Reply via email to