]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/objfile: use pe.FileHeader.Machine to reliably determine GOARCH
authorAlex Brainman <alex.brainman@gmail.com>
Sun, 28 Jun 2020 06:28:52 +0000 (16:28 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Sat, 22 Aug 2020 00:56:53 +0000 (00:56 +0000)
commitea51acbabc687a2270438b05bf765ada2968b69a
tree3f3525ab5a650901fb5346699d7a17d6c5e6b958
parente5da468c51ad13a08730dc7890311915eefd2199
cmd/internal/objfile: use pe.FileHeader.Machine to reliably determine GOARCH

Current peFile.goarch looks for symbols like "_rt0_386_windows" to
determine GOARCH. But "_rt0_386_windows" is not present in executables
built with cgo.

Use pe.FileHeader.Machine instead. This should work with any Windows
executable, not just with Go built executable.

Fixes #39682

Change-Id: Ie0ffce664f4b8b8fed69b2ecc482425b042a38d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/240957
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
src/cmd/internal/objfile/pe.go
src/cmd/objdump/objdump_test.go
src/cmd/objdump/testdata/fmthellocgo.go [new file with mode: 0644]