]> Cypherpunks repositories - gostls13.git/commit
cmd/link: don't generate .exe extension for external Windows link
authorIan Lance Taylor <iant@golang.org>
Wed, 15 Jul 2015 16:05:33 +0000 (09:05 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 23 Jul 2015 17:49:44 +0000 (17:49 +0000)
commitad84f84cb4bad9b5a666a2c00d5c48a48537f03a
tree506d628cb6cf10bb5cf526af43434b77096cc13b
parent37a097519facb21c29af821cbdfffbf9d48c045b
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/12243
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/link/internal/ld/lib.go