aboutsummaryrefslogtreecommitdiff
path: root/src/liblink/objfile.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-01-29 20:19:07 -0500
committerRuss Cox <rsc@golang.org>2015-02-03 18:23:05 +0000
commit2e5b065ac24912be82e7082eeb136afd18d9734b (patch)
tree9658f6b04dda8a9dd921bad95b2ca5adceb90f9b /src/liblink/objfile.c
parent3ac37c72ae56a229bdc75986a4071b29bd7298c8 (diff)
downloadgo-2e5b065ac24912be82e7082eeb136afd18d9734b.tar.xz
liblink: define fixed A-numbers for common instructions
This makes names like ANOP, ATEXT, AGLOBL, ACALL, AJMP, ARET available for use by architecture-independent processing passes. On arm and ppc64, the alternate names are now aliases for the official ones (ABL for ACALL, AB or ABR for AJMP, ARETURN for ARET). Change-Id: Id027771243795af2b3745199c645b6e1bedd7d18 Reviewed-on: https://go-review.googlesource.com/3577 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink/objfile.c')
-rw-r--r--src/liblink/objfile.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c
index 79a88db0bf..c01160af7e 100644
--- a/src/liblink/objfile.c
+++ b/src/liblink/objfile.c
@@ -147,10 +147,10 @@ writeobj(Link *ctxt, Biobuf *b)
plink = p->link;
p->link = nil;
- if(p->as == ctxt->arch->AEND)
+ if(p->as == AEND)
continue;
- if(p->as == ctxt->arch->ATYPE) {
+ if(p->as == ATYPE) {
// Assume each TYPE instruction describes
// a different local variable or parameter,
// so no dedup.
@@ -174,7 +174,7 @@ writeobj(Link *ctxt, Biobuf *b)
continue;
}
- if(p->as == ctxt->arch->AGLOBL) {
+ if(p->as == AGLOBL) {
s = p->from.sym;
if(s->seenglobl++)
print("duplicate %P\n", p);
@@ -200,12 +200,12 @@ writeobj(Link *ctxt, Biobuf *b)
continue;
}
- if(p->as == ctxt->arch->ADATA) {
+ if(p->as == ADATA) {
savedata(ctxt, p->from.sym, p, "<input>");
continue;
}
- if(p->as == ctxt->arch->ATEXT) {
+ if(p->as == ATEXT) {
s = p->from.sym;
if(s == nil) {
// func _() { }
@@ -235,7 +235,7 @@ writeobj(Link *ctxt, Biobuf *b)
continue;
}
- if(p->as == ctxt->arch->AFUNCDATA) {
+ if(p->as == AFUNCDATA) {
// Rewrite reference to go_args_stackmap(SB) to the Go-provided declaration information.
if(curtext == nil) // func _() {}
continue;
@@ -260,14 +260,14 @@ writeobj(Link *ctxt, Biobuf *b)
continue;
found = 0;
for(p = s->text; p != nil; p = p->link) {
- if(p->as == ctxt->arch->AFUNCDATA && p->from.type == TYPE_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) {
+ if(p->as == AFUNCDATA && p->from.type == TYPE_CONST && p->from.offset == FUNCDATA_ArgsPointerMaps) {
found = 1;
break;
}
}
if(!found) {
p = appendp(ctxt, s->text);
- p->as = ctxt->arch->AFUNCDATA;
+ p->as = AFUNCDATA;
p->from.type = TYPE_CONST;
p->from.offset = FUNCDATA_ArgsPointerMaps;
p->to.type = TYPE_MEM;