summaryrefslogtreecommitdiff
path: root/src/liblink/pass.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-12-16 12:51:58 -0500
committerRuss Cox <rsc@golang.org>2013-12-16 12:51:58 -0500
commit43cad0aa4d6d397630daa553bf4ed28a078637f0 (patch)
treeecb464b206a70772c61e514e72a3b14d4c776b71 /src/liblink/pass.c
parent737d6de29569572e16839f9cf6d91cc1db75b622 (diff)
downloadgo-43cad0aa4d6d397630daa553bf4ed28a078637f0.tar.gz
cmd/ld: move instruction selection + layout into compilers, assemblers
- new object file reader/writer (liblink/objfile.c) - remove old object file writing routines - add pcdata iterator - remove all trace of "line number stack" and "path fragments" from object files, linker (!!!) - dwarf now writes a single "compilation unit" instead of one per package This CL disables the check for chains of no-split functions that could overflow the stack red zone. A future CL will attack the problem of reenabling that check (issue 6931). This CL is just the liblink and cmd/ld changes. There are minor associated adjustments in CL 37030045. Each depends on the other. R=golang-dev, dave, iant CC=golang-dev https://codereview.appspot.com/39680043
Diffstat (limited to 'src/liblink/pass.c')
-rw-r--r--src/liblink/pass.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/liblink/pass.c b/src/liblink/pass.c
index ed2774991..bc8eb4367 100644
--- a/src/liblink/pass.c
+++ b/src/liblink/pass.c
@@ -70,23 +70,21 @@ linkpatch(Link *ctxt, LSym *sym)
{
int32 c;
Prog *p, *q;
- LSym *s;
ctxt->cursym = sym;
for(p = sym->text; p != nil; p = p->link) {
if(ctxt->arch->progedit)
ctxt->arch->progedit(ctxt, p);
- if(p->as == ctxt->arch->ACALL || (p->as == ctxt->arch->AJMP && p->to.type != ctxt->arch->D_BRANCH) || (p->as == ctxt->arch->ARET && p->to.sym != nil)) {
- s = p->to.sym;
- // The STEXT check avoids rewriting indirect call to addr in memory on x86.
- if(s && s->type == STEXT) {
- p->to.type = ctxt->arch->D_BRANCH;
- continue;
- }
- }
if(p->to.type != ctxt->arch->D_BRANCH)
continue;
+ if(p->to.u.branch != nil) {
+ // TODO: Remove to.u.branch in favor of p->pcond.
+ p->pcond = p->to.u.branch;
+ continue;
+ }
+ if(p->to.sym != nil)
+ continue;
c = p->to.offset;
for(q = sym->text; q != nil;) {
if(c == q->pc)
@@ -101,6 +99,7 @@ linkpatch(Link *ctxt, LSym *sym)
c, p, p->to.sym ? p->to.sym->name : "<nil>");
p->to.type = ctxt->arch->D_NONE;
}
+ p->to.u.branch = q;
p->pcond = q;
}