summaryrefslogtreecommitdiff
path: root/src/cmd/ld/lib.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2013-05-01 14:30:19 -0700
committerIan Lance Taylor <iant@golang.org>2013-05-01 14:30:19 -0700
commit4e3458caf6194e5a7448ce1d0c71854972a5598c (patch)
tree6282609fc3f40fce838e53b4388accceb56f6ad6 /src/cmd/ld/lib.c
parent7e2c451e66ce1ce3a25f81d8b02795731e89d9e7 (diff)
downloadgo-4e3458caf6194e5a7448ce1d0c71854972a5598c.tar.gz
cmd/ld: fix syms that are both cgo_import_static & cgo_import_dynamic
This is needed for SWIG when linking in internal mode. In internal mode if a symbol was cgo_import_static we used to forget that it was also cgo_import_dynamic. R=rsc, r CC=golang-dev https://codereview.appspot.com/9080043
Diffstat (limited to 'src/cmd/ld/lib.c')
-rw-r--r--src/cmd/ld/lib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 6b95ae2ae..47a52b553 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -331,8 +331,16 @@ loadlib(void)
// Drop all the cgo_import_static declarations.
// Turns out we won't be needing them.
for(s = allsym; s != S; s = s->allsym)
- if(s->type == SHOSTOBJ)
- s->type = 0;
+ if(s->type == SHOSTOBJ) {
+ // If a symbol was marked both
+ // cgo_import_static and cgo_import_dynamic,
+ // then we want to make it cgo_import_dynamic
+ // now.
+ if(s->extname != nil && s->cgoexport == 0) {
+ s->type = SDYNIMPORT;
+ } else
+ s->type = 0;
+ }
}
// Now that we know the link mode, trim the dynexp list.