cmd/internal/ld: replace Diag;Errorexit with Exitf

I have left the Diag calls in place where I believe Ctxt.Cursym != nil
which means this CL is not the improvement I had hoped for. However
it is now safe to call Exitf whereever you are in the linker, which
makes it easier to reason about some code.

Change-Id: I8261e761ca9719f7d216e2747314adfe464e3337
Reviewed-on: https://go-review.googlesource.com/8668
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
David Crawshaw 2015-04-09 07:37:17 -04:00
parent c5befcf0a7
commit 7816a096d9
19 changed files with 98 additions and 196 deletions

View file

@ -482,7 +482,7 @@ func relocsym(s *LSym) {
// 64-bit architectures so as to be future-proof.
if int32(o) < 0 && Thearch.Ptrsize > 4 && siz == 4 {
Diag("non-pc-relative relocation address is too big: %#x (%#x + %#x)", uint64(o), Symaddr(r.Sym), r.Add)
Errorexit()
errorexit()
}
// r->sym can be null when CALL $(constant) is transformed from absolute PC to relative PC call.
@ -713,7 +713,7 @@ func blk(start *LSym, addr int64, size int64) {
Ctxt.Cursym = sym
if sym.Value < addr {
Diag("phase error: addr=%#x but sym=%#x type=%d", int64(addr), int64(sym.Value), sym.Type)
Errorexit()
errorexit()
}
for ; addr < sym.Value; addr++ {
@ -731,7 +731,7 @@ func blk(start *LSym, addr int64, size int64) {
}
if addr != sym.Value+sym.Size {
Diag("phase error: addr=%#x value+size=%#x", int64(addr), int64(sym.Value)+sym.Size)
Errorexit()
errorexit()
}
if sym.Value+sym.Size >= eaddr {