summaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-09-18 17:27:26 -0700
committerIan Lance Taylor <iant@golang.org>2014-09-18 17:27:26 -0700
commit14f5f7506edb404922490ad15b2e16e87f7d1fb7 (patch)
tree62fe745a1aa691759c3ff6f2b396776800edc8c0 /src/cmd/ld
parent61e83efb7136c87ff2515a16ece5758b040ae1f9 (diff)
downloadgo-14f5f7506edb404922490ad15b2e16e87f7d1fb7.tar.gz
lib9, cmd/ld: fixes for cross-linking on a Windows host
This fixes a couple of problems that occur when the linker removes its temporary directory on Windows. The linker only creates and removes a temporary directory when doing external linking. Windows does not yet support external linking. Therefore, these problems are only seen when using a cross-compiler hosted on Windows. In lib9, FindFirstFileW returns just the file name, not the full path name. Don't assume that we will find a slash. Changed the code to work either way just in case. In ld, Windows requires that files be closed before they are removed, so close the output file before we might try to remove it. Fixes issue 8723. LGTM=alex.brainman R=golang-codereviews, alex.brainman CC=golang-codereviews https://codereview.appspot.com/141690043
Diffstat (limited to 'src/cmd/ld')
-rw-r--r--src/cmd/ld/lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 651705a2e..36f0f99de 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -144,6 +144,10 @@ libinit(void)
void
errorexit(void)
{
+ if(cout >= 0) {
+ // For rmtemp run at atexit time on Windows.
+ close(cout);
+ }
if(nerrors) {
if(cout >= 0)
mayberemoveoutfile();