]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.power64] liblink: fix printing of branch targets
authorAustin Clements <austin@google.com>
Mon, 3 Nov 2014 22:24:13 +0000 (17:24 -0500)
committerAustin Clements <austin@google.com>
Mon, 3 Nov 2014 22:24:13 +0000 (17:24 -0500)
Print PC stored in target Prog* of branch instructions when
available instead of the offset stored in the branch
instruction.  The offset tends to be wrong after code
transformations, so previously this led to confusing listings.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/168980043

src/liblink/list9.c

index 041c6884f11fc5754f5e78af8ba52e131e82e9c8..c9190d894020568a950a55305dfe28e41882bff7 100644 (file)
@@ -259,11 +259,12 @@ Dconv(Fmt *fp)
                                sprint(str, "%s+%.5lux(BRANCH)", a->sym->name, v);
                        else
                                sprint(str, "%.5lux(BRANCH)", v);
-               } else
-                       if(a->sym != nil)
-                               sprint(str, "%s+%lld(APC)", a->sym->name, a->offset);
-                       else
-                               sprint(str, "%lld(APC)", a->offset);
+               } else if(a->u.branch != nil)
+                       sprint(str, "%lld", a->u.branch->pc);
+               else if(a->sym != nil)
+                       sprint(str, "%s+%lld(APC)", a->sym->name, a->offset);
+               else
+                       sprint(str, "%lld(APC)", a->offset);
                break;
 
        case D_FCONST: