diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2020-06-28 16:28:52 +1000 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2020-08-22 00:56:53 +0000 |
| commit | ea51acbabc687a2270438b05bf765ada2968b69a (patch) | |
| tree | 3f3525ab5a650901fb5346699d7a17d6c5e6b958 /src/cmd/objdump/testdata | |
| parent | e5da468c51ad13a08730dc7890311915eefd2199 (diff) | |
| download | go-ea51acbabc687a2270438b05bf765ada2968b69a.tar.xz | |
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>
Diffstat (limited to 'src/cmd/objdump/testdata')
| -rw-r--r-- | src/cmd/objdump/testdata/fmthellocgo.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cmd/objdump/testdata/fmthellocgo.go b/src/cmd/objdump/testdata/fmthellocgo.go new file mode 100644 index 0000000000..6555c3bacf --- /dev/null +++ b/src/cmd/objdump/testdata/fmthellocgo.go @@ -0,0 +1,21 @@ +package main + +import "fmt" +import "C" + +func main() { + Println("hello, world") + if flag { +//line fmthello.go:999999 + Println("bad line") + for { + } + } +} + +//go:noinline +func Println(s string) { + fmt.Println(s) +} + +var flag bool |
