On Sun, Oct 2, 2022 at 6:45 PM Eli Lindsey <e...@siliconsprawl.com> wrote: > > I’m on arm64 Darwin and wanted to view the asm output for amd64 Darwin. > > Using a simple hello world example, this worked and output arm asm: > > $ go tool compile -S hello.go > > This worked and built a full x86 binary: > > $ GOARCH=amd64 go build hello.go > > But this failed: > > $ GOARCH=amd64 go tool compile -S hello.go > hello.go:4:5: could not import fmt (file not found) > > To fix it, I downloaded a binary release for amd64 and pointed go tool to its > pkg directory. This now works: > > $ GOARCH=amd64 go tool compile -I /path/to/go/release/pkg/darwin_amd64 -S > hello.go > > My question: is there an easier way that I’ve missed? Presumably go build had > built fmt _somehow_ since it successfully made an x86 binary. I read the docs > for go build and cmd/compile to see if I could get build to output the > packagefiles it produces in a way that cmd/compile can point to or some such, > but I didn’t see an obvious way.
GOARCH=amd64 go build -gcflags=-S hello.go Ian -- 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/CAOyqgcV4Ndk-VRUuA-KiobXVXHoXb8FUwe5%3DHkZJZ9vBGVnBRQ%40mail.gmail.com.