aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorRémy Oudompheng <oudomphe@phare.normalesup.org>2013-04-10 07:15:49 +0200
committerRémy Oudompheng <oudomphe@phare.normalesup.org>2013-04-10 07:15:49 +0200
commit0e76a943c9efe69379bd6dcf83d254fd6abc48f2 (patch)
tree875cf0b5e6972242e0a028be9def251c43032872 /src/cmd/ld
parent357e37dc945885a141b48182c4606f1aac8320db (diff)
downloadgo-0e76a943c9efe69379bd6dcf83d254fd6abc48f2.tar.xz
cmd/ld: fix inconsistency in internal linking of common symbols.
Some variables declared in C could end up as undefined symbols in the final binary and have null address. Fixes #5114. Fixes #5227. R=golang-dev, iant, ajstarks, dave, r CC=golang-dev https://golang.org/cl/8602044
Diffstat (limited to 'src/cmd/ld')
-rw-r--r--src/cmd/ld/lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 84777b1a92..d22c0870f6 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -311,6 +311,9 @@ loadlib(void)
// Switch to internal.
if(linkmode == LinkAuto) {
linkmode = LinkInternal;
+ }
+
+ if(linkmode == LinkInternal) {
// Drop all the cgo_import_static declarations.
// Turns out we won't be needing them.
for(s = allsym; s != S; s = s->allsym)