summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/ld/data.c13
-rw-r--r--src/cmd/ld/lib.c4
2 files changed, 13 insertions, 4 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c
index 9d224d9eb..89226bfe2 100644
--- a/src/cmd/ld/data.c
+++ b/src/cmd/ld/data.c
@@ -625,6 +625,7 @@ addstrdata(char *name, char *value)
sp = linklookup(ctxt, p, 0);
free(p);
addstring(sp, value);
+ sp->type = SRODATA;
s = linklookup(ctxt, name, 0);
s->size = 0;
@@ -816,9 +817,15 @@ proggenaddsym(ProgGen *g, LSym *s)
proggenskip(g, g->pos, s->value - g->pos);
g->pos += s->value - g->pos;
- if(s->gotype == nil && s->size >= PtrSize) {
+ // The test for names beginning with . here is meant
+ // to keep .dynamic and .dynsym from turning up as
+ // conservative symbols. They should be marked SELFSECT
+ // and not SDATA, but sometimes that doesn't happen.
+ // Leave debugging the SDATA issue for the Go rewrite.
+
+ if(s->gotype == nil && s->size >= PtrSize && s->name[0] != '.') {
// conservative scan
- diag("missing Go type information for global symbol: %s", s->name);
+ diag("missing Go type information for global symbol: %s size %d", s->name, (int)s->size);
if((s->size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned conservative symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
@@ -834,7 +841,7 @@ proggenaddsym(ProgGen *g, LSym *s)
proggenarrayend(g);
}
g->pos = s->value + size;
- } else if(s->gotype == nil || decodetype_noptr(s->gotype) || s->size < PtrSize) {
+ } else if(s->gotype == nil || decodetype_noptr(s->gotype) || s->size < PtrSize || s->name[0] == '.') {
// no scan
if(s->size < 32*PtrSize) {
// Emit small symbols as data.
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 36f0f99de..3edf7253d 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -221,8 +221,10 @@ loadlib(void)
// Provided by the code that imports the package.
// Since we are simulating the import, we have to provide this string.
cgostrsym = "go.string.\"runtime/cgo\"";
- if(linkrlookup(ctxt, cgostrsym, 0) == nil)
+ if(linkrlookup(ctxt, cgostrsym, 0) == nil) {
addstrdata(cgostrsym, "runtime/cgo");
+ linklookup(ctxt, cgostrsym, 0)->type = SRODATA;
+ }
}
if(linkmode == LinkAuto) {