summaryrefslogtreecommitdiff
path: root/src/cmd/8l
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-06-11 09:41:49 -0400
committerRuss Cox <rsc@golang.org>2013-06-11 09:41:49 -0400
commitf5b01ef9598c8eb81a7267a97d473be8c4d9e61b (patch)
treef8fe22397042916131cd15e23f4d096700b488a3 /src/cmd/8l
parentd4c8832743aabd70892240e95dc6c3493fc03cbb (diff)
downloadgo-f5b01ef9598c8eb81a7267a97d473be8c4d9e61b.tar.gz
cmd/gc: move genembedtramp into portable code
Requires adding new linker instruction RET f(SB) meaning return but then immediately call f. This is what you'd use to implement a tail call after fiddling with the arguments, but the compiler only uses it in genwrapper. This CL eliminates the copy-and-paste genembedtramp functions from 5g/8g/6g and makes the code run on ARM for the first time. It removes a small special case for function generation, which should help Carl a bit, but at the same time it does not bother to implement general tail call optimization, which we do not want anyway. Fixes issue 5627. R=ken2 CC=golang-dev https://codereview.appspot.com/10057044
Diffstat (limited to 'src/cmd/8l')
-rw-r--r--src/cmd/8l/pass.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/8l/pass.c b/src/cmd/8l/pass.c
index 4871761ff..f668ca8cf 100644
--- a/src/cmd/8l/pass.c
+++ b/src/cmd/8l/pass.c
@@ -329,7 +329,7 @@ patch(void)
p->from.offset = 0;
}
}
- if((p->as == ACALL && p->to.type != D_BRANCH) || (p->as == AJMP && p->to.type != D_BRANCH)) {
+ if((p->as == ACALL && p->to.type != D_BRANCH) || (p->as == AJMP && p->to.type != D_BRANCH) || (p->as == ARET && p->to.sym != nil)) {
s = p->to.sym;
if(p->to.type == D_INDIR+D_ADDR) {
/* skip check if this is an indirect call (CALL *symbol(SB)) */
@@ -692,6 +692,8 @@ dostkoff(void)
// the cleanup.
p->spadj = +autoffset;
}
+ if(p->to.sym) // retjmp
+ p->as = AJMP;
}
}
}