Commit a14e143c authored by Russ Cox's avatar Russ Cox

cmd/ld: fix line numbers when using fieldtrack

USEFIELD is a special kind of NOP, so treat it like a NOP
when generating the pc-ln table.

There are more invasive fixes that could be applied here.
I am going for minimum number of lines changed.

The smallest test case we know of is five distinct Go files
in four packages, and the bug only happens with
GOEXPERIMENT=fieldtrack enabled, which we don't
normally build with, so the test would never run
meaningfully anyway.

Fixes #5762.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10495044
parent 75aab137
...@@ -1355,7 +1355,7 @@ pclntab(void) ...@@ -1355,7 +1355,7 @@ pclntab(void)
oldlc = 0; oldlc = 0;
for(cursym = textp; cursym != nil; cursym = cursym->next) { for(cursym = textp; cursym != nil; cursym = cursym->next) {
for(p = cursym->text; p != P; p = p->link) { for(p = cursym->text; p != P; p = p->link) {
if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) { if(p->line == oldlc || p->as == ATEXT || p->as == ANOP || p->as == AUSEFIELD) {
if(debug['O']) if(debug['O'])
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
(vlong)p->pc, p); (vlong)p->pc, p);
......
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