diff options
| author | Ian Lance Taylor <iant@golang.org> | 2014-09-28 08:27:05 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2014-09-28 08:27:05 -0700 |
| commit | f6fc14094a476d2e23722f124cfcd8204c2659b0 (patch) | |
| tree | 875f21415f04acde2038d270833b43b5574725e3 /src/cmd/ld/lib.c | |
| parent | 56c4d0a5c63a81de4a0d935337b226d229a44c07 (diff) | |
| download | go-f6fc14094a476d2e23722f124cfcd8204c2659b0.tar.xz | |
cmd/ld: don't automatically mark symbols created by -X as reachable
This fixes the bug in which the linker reports "missing Go
type information" when a -X option refers to a symbol that is
not used.
Fixes #8821.
LGTM=rsc
R=rsc, r
CC=golang-codereviews
https://golang.org/cl/151000043
Diffstat (limited to 'src/cmd/ld/lib.c')
| -rw-r--r-- | src/cmd/ld/lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 3edf7253d4..f889aba8a9 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -222,8 +222,10 @@ loadlib(void) // Since we are simulating the import, we have to provide this string. cgostrsym = "go.string.\"runtime/cgo\""; if(linkrlookup(ctxt, cgostrsym, 0) == nil) { + s = linklookup(ctxt, cgostrsym, 0); + s->type = SRODATA; + s->reachable = 1; addstrdata(cgostrsym, "runtime/cgo"); - linklookup(ctxt, cgostrsym, 0)->type = SRODATA; } } |
