-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: output has .exe suffix added by gcc during external linking #11725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please run the go command with -x option and paste the output here. Thanks. |
|
Thanks. Here is what I think is happening: You invoke go build with "-o PATH/run0go". The go command passed that -o option directly to the linker. The linker opened that exact file name as the output file, without appending ".exe". The linker saw this was a cgo build, and decided to invoke the external linker. The Go linker closed the output file (PATH/run0go) but did not remove it. The Go linker passed the same -o option to the external linker. The external linker, being a regular Windows linker, appended ".exe". That created run0go.exe. The empty run0go file was created by the Go linker and never removed. |
I propose to add a default extension '.exe' when building an executable file in Windows, regardless of the file name specified in the option -o. |
We could do that. The change I sent is still reasonable, though. I will leave that decision up to the Windows folks. It would most likely be a 1.6 change. |
CL https://golang.org/cl/12243 mentions this issue. |
A file with zero size removed. |
I think the real problem here is that gcc does not honour value passed via "-o" flag:
I think we should "force" gcc by putting . at the end of the file name (see my example above). Alex |
Environment:
A project with the one file "main.go":
Run a console command:
Got two files in "C:\Users\username\AppData\Local\Temp":
Expect only one file in "C:\Users\username\AppData\Local\Temp":
Like as a result of project without cgo.
The text was updated successfully, but these errors were encountered: