Commit 9333fe8e authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

cmd/ld: better diagnostics on unaligned symbols

Want to see why builders are failing.
Then decide whether to rollback or fix.

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/114510043
parent cd17a717
...@@ -815,7 +815,8 @@ proggenaddsym(ProgGen *g, LSym *s) ...@@ -815,7 +815,8 @@ proggenaddsym(ProgGen *g, LSym *s)
if(s->gotype == nil && s->size >= PtrSize) { if(s->gotype == nil && s->size >= PtrSize) {
// conservative scan // conservative scan
if((s->size%PtrSize) || (g->pos%PtrSize)) if((s->size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned symbol"); diag("proggenaddsym: unaligned conservative symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
size = (s->size+PtrSize-1)/PtrSize*PtrSize; size = (s->size+PtrSize-1)/PtrSize*PtrSize;
if(size < 32*PtrSize) { if(size < 32*PtrSize) {
// Emit small symbols as data. // Emit small symbols as data.
...@@ -840,7 +841,8 @@ proggenaddsym(ProgGen *g, LSym *s) ...@@ -840,7 +841,8 @@ proggenaddsym(ProgGen *g, LSym *s)
} else { } else {
// Emit large symbols as array. // Emit large symbols as array.
if((s->size%PtrSize) || (g->pos%PtrSize)) if((s->size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned symbol"); diag("proggenaddsym: unaligned noscan symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
proggenarray(g, s->size/PtrSize); proggenarray(g, s->size/PtrSize);
proggendata(g, BitsScalar); proggendata(g, BitsScalar);
proggenarrayend(g); proggenarrayend(g);
...@@ -852,7 +854,8 @@ proggenaddsym(ProgGen *g, LSym *s) ...@@ -852,7 +854,8 @@ proggenaddsym(ProgGen *g, LSym *s)
gcprog = decodetype_gcprog(s->gotype); gcprog = decodetype_gcprog(s->gotype);
size = decodetype_size(s->gotype); size = decodetype_size(s->gotype);
if((size%PtrSize) || (g->pos%PtrSize)) if((size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned symbol"); diag("proggenaddsym: unaligned gcprog symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
for(i = 0; i < gcprog->np-1; i++) for(i = 0; i < gcprog->np-1; i++)
proggenemit(g, gcprog->p[i]); proggenemit(g, gcprog->p[i]);
g->pos = s->value + size; g->pos = s->value + size;
...@@ -861,7 +864,8 @@ proggenaddsym(ProgGen *g, LSym *s) ...@@ -861,7 +864,8 @@ proggenaddsym(ProgGen *g, LSym *s)
mask = decodetype_gcmask(s->gotype); mask = decodetype_gcmask(s->gotype);
size = decodetype_size(s->gotype); size = decodetype_size(s->gotype);
if((size%PtrSize) || (g->pos%PtrSize)) if((size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned symbol"); diag("proggenaddsym: unaligned gcmask symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
for(i = 0; i < size; i += PtrSize) for(i = 0; i < size; i += PtrSize)
proggendata(g, (mask[i/PtrSize/2]>>((i/PtrSize%2)*4+2))&BitsMask); proggendata(g, (mask[i/PtrSize/2]>>((i/PtrSize%2)*4+2))&BitsMask);
g->pos = s->value + size; g->pos = s->value + size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment