-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Description
Go version
go version go1.25.0 windows/amd64
Output of go env in your module/workspace:
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=on
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\cj\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\cj\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\cj\AppData\Local\Temp\go-build3808498674=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\cj\go\pkg\mod
set GOOS=windows
set GOPATH=C:\Users\cj\go
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Program Files/Go
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\cj\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.25.0
set GOWORK=
set PKG_CONFIG=pkg-configWhat did you do?
As of Go 1.25, a simple app which uses CGO will fail to run on Windows with the error failed to run: The specified executable is not a valid application for this OS
Example code: https://go.dev/play/p/YKuBXwCGWAd
This same code will run successfully when built with GOEXPERIMENT=nodwarf5 OR stripping debug info -ldflags="-s -w"
dumpbin.exe output shows sections being placed at virtual addresses outside of the normal Windows PE address space.
With DWARF5 enabled:
SECTION HEADER #1
/4 name (.debug_rnglists)
1B7D1 virtual size
C0000000 virtual address (0000000200000000 to 000000020001B7D0)
1B800 size of raw data
548 file pointer to raw data (00000548 to 0001BD47)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42100040 flags
Initialized Data
RESERVED - UNKNOWN
Discardable
Read Only
With GOEXPERIMENT=nodwarf5:
SECTION HEADER #1
.text name
B0720 virtual size
1000 virtual address (0000000140001000 to 00000001400B171F)
B0800 size of raw data
600 file pointer to raw data (00000600 to 000B0DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60600060 flags
Code
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Execute Read
What did you see happen?
Program 'main.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
What did you expect to see?
Message: Hello from C!
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Todo