golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.85k stars 17.65k forks source link

cmd/objdump: does not understand ARMv8 SHA-3 instructions #52098

Open ericlagergren opened 2 years ago

ericlagergren commented 2 years ago

What version of Go are you using (go version)?

$ go version
go version go1.18 darwin/arm64

Does this issue reproduce with the latest release?

This is the latest release.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN="/Users/eric/gopath/bin"
GOCACHE="/Users/eric/Library/Caches/go-build"
GOENV="/Users/eric/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/eric/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/eric/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/eric/git/arch/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2f/2_yz21b92h94_pvr2m00gzh80000gn/T/go-build4092429902=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Ran go tool objdump on a binary using SHA-3 instructions like XAR (VAXR) and EOR3 (VEOR3).

What did you expect to see?

It output valid Go (and GNU) assembly

What did you see instead?

?

ericlagergren commented 2 years ago

I would send a CL but it looks like the tables were generated with a non-public tool, which is unfortunate.

mengzhuo commented 2 years ago

cc @zhangfannie

zhangfannie commented 2 years ago

I would send a CL but it looks like the tables were generated with a non-public tool, which is unfortunate.

The current go disassembler is not complete, and does not even support all ArmV8.0 instructions, including SHA-3 instructions of cource. And yes, this table is generated by a internal tool.

Can you use GNU objdump instead? Because we currently have no plans to perfect it. Thank you.

ericlagergren commented 2 years ago

GNU objdump can't replace cmd/objdump because it does not output Go assembly.

Could ARM open source the tool? Otherwise, I am not sure how anybody could reasonably be expected to contribute to cmd/objdump.

zhangfannie commented 2 years ago

Ok, I see. For your requirement, I I need to have a discussion within our group. Thank you.

ericlagergren commented 2 years ago

@zhangfannie thank you.

zhangfannie commented 2 years ago

@ericlagergren This tables.go is generated by one of our internal tools to parse internal architecture documents, but this tool can only parse internal armV8.0 documents, we currently do not have other good tools (public or internal) to parse non-armV8. 0 documentation to generate tables.go.

If you only add support for one or two instructions, we recommend that you follow the existing format and add it manually, and put it in a new file, such as tables_manual.go.

But if there are a lot of new instructions to support later, and at that time, we will consider rewriting a tool that can be exposed.

Thank you.

ericlagergren commented 2 years ago

@zhangfannie thanks, that helps.