cmd/link: don't generate .exe extension for external Windows link
On Windows, gcc -o foo will generate foo.exe. Prevent that from happening by adding a final '.' if necessary so that GCC thinks that the file already has an extension. Also remove the initial output file when doing an external link, and use mayberemoveoutfile, not os.Remove, when building an archive (otherwise we will do the wrong thing for -buildmode=c-archive -o /dev/null). I didn't add a test, as it requires using cgo and -o on Windows. Fixes #11725. Change-Id: I6ea12437bb6b4b9b8ee5c3b52d83509fa2437b2d Reviewed-on: https://go-review.googlesource.com/12243Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Russ Cox <rsc@golang.org>
Showing
Please
register
or
sign in
to comment