diff options
| author | Russ Cox <rsc@golang.org> | 2013-07-18 11:40:59 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-07-18 11:40:59 -0400 |
| commit | ff52cadc01756d097e5f3e3fe5ff2634d8825ffb (patch) | |
| tree | 33df929da887a745966f7dc106f1a77fb0595a28 /src/cmd/ld/lib.c | |
| parent | 72bd1a7e36cad230ecc8b07fdfaea86158d9ec60 (diff) | |
| download | go-ff52cadc01756d097e5f3e3fe5ff2634d8825ffb.tar.xz | |
cmd/ld: refine test for history stack pop (fix Windows build)
This should fix the Windows build, or at least
what's breaking it at the moment.
Fixes #5904.
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/11519044
Diffstat (limited to 'src/cmd/ld/lib.c')
| -rw-r--r-- | src/cmd/ld/lib.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index d7f4698101..1594526a86 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -2112,10 +2112,20 @@ savehist(int32 line, int32 off) Sym *file; Hist *h; - tmp[0] = '\0'; - copyhistfrog(tmp, sizeof tmp); - - if(tmp[0]) { + // NOTE(rsc): We used to do the copyhistfrog first and this + // condition was if(tmp[0] != '\0') to check for an empty string, + // implying that histfrogp == 0, implying that this is a history pop. + // However, on Windows in the misc/cgo test, the linker is + // presented with an ANAME corresponding to an empty string, + // that ANAME ends up being the only histfrog, and thus we have + // a situation where histfrogp > 0 (not a pop) but the path we find + // is the empty string. Really that shouldn't happen, but it doesn't + // seem to be bothering anyone yet, and it's easier to fix the condition + // to test histfrogp than to track down where that empty string is + // coming from. Probably it is coming from go tool pack's P command. + if(histfrogp > 0) { + tmp[0] = '\0'; + copyhistfrog(tmp, sizeof tmp); file = lookup(tmp, HistVersion); if(file->type != SFILEPATH) { file->value = ++nhistfile; |
