return
case 256 + ld.R_ARM_THM_PC22: // R_ARM_THM_CALL
- ld.Diag("R_ARM_THM_CALL, are you using -marm?")
-
- ld.Errorexit()
+ ld.Exitf("R_ARM_THM_CALL, are you using -marm?")
return
case 256 + ld.R_ARM_GOT32: // R_ARM_GOT_BREL
switch ld.HEADTYPE {
default:
- ld.Diag("unknown -H option")
- ld.Errorexit()
- fallthrough
+ ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case ld.Hplan9: /* plan 9 */
ld.HEADR = 32
switch ld.HEADTYPE {
default:
- ld.Diag("unknown -H option")
- ld.Errorexit()
- fallthrough
+ ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case ld.Hplan9: /* plan 9 */
ld.HEADR = 32 + 8
switch ld.HEADTYPE {
default:
- ld.Diag("unknown -H option")
- ld.Errorexit()
- fallthrough
+ ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case ld.Hplan9: /* plan 9 */
ld.HEADR = 32
switch ld.HEADTYPE {
default:
- ld.Diag("unknown -H option")
- ld.Errorexit()
- fallthrough
+ ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case ld.Hplan9: /* plan 9 */
ld.HEADR = 32
switch ld.HEADTYPE {
default:
- ld.Diag("unknown -H option")
- ld.Errorexit()
- fallthrough
+ ld.Exitf("unknown -H option: %v", ld.HEADTYPE)
case ld.Hplan9: /* plan 9 */
ld.HEADR = 32
// 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.
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++ {
}
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 {
return uint64(Ctxt.Arch.ByteOrder.Uint32(p))
case 8:
return Ctxt.Arch.ByteOrder.Uint64(p)
+ default:
+ Exitf("dwarf: decode inuxi %d", sz)
+ panic("unreachable")
}
- Diag("dwarf: decode inuxi %d", sz)
- Errorexit()
- return 0
}
func commonsize() int {
return nil
}
-func find_or_diag(die *DWDie, name string) *DWDie {
+func mustFind(die *DWDie, name string) *DWDie {
r := find(die, name)
if r == nil {
- Diag("dwarf find: %s %p has no %s", getattr(die, DW_AT_name).data, die, name)
- Errorexit()
+ Exitf("dwarf find: %s %p has no %s", getattr(die, DW_AT_name).data, die, name)
}
-
return r
}
DW_FORM_indirect: // (see Section 7.5.3)
fallthrough
default:
- Diag("dwarf: unsupported attribute form %d / class %d", form, cls)
-
- Errorexit()
+ Exitf("dwarf: unsupported attribute form %d / class %d", form, cls)
}
}
func lookup_or_diag(n string) *LSym {
s := Linkrlookup(Ctxt, n, 0)
if s == nil || s.Size == 0 {
- Diag("dwarf: missing type: %s", n)
- Errorexit()
+ Exitf("dwarf: missing type: %s", n)
}
return s
// Define gotype, for composite ones recurse into constituents.
func defgotype(gotype *LSym) *DWDie {
if gotype == nil {
- return find_or_diag(&dwtypes, "<unspecified>")
+ return mustFind(&dwtypes, "<unspecified>")
}
if !strings.HasPrefix(gotype.Name, "type.") {
Diag("dwarf: type name doesn't start with \".type\": %s", gotype.Name)
- return find_or_diag(&dwtypes, "<unspecified>")
+ return mustFind(&dwtypes, "<unspecified>")
}
name := gotype.Name[5:] // could also decode from Type.string
// use actual length not upper bound; correct for 0-length arrays.
newattr(fld, DW_AT_count, DW_CLS_CONSTANT, decodetype_arraylen(gotype), 0)
- newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"))
+ newrefattr(fld, DW_AT_type, mustFind(&dwtypes, "uintptr"))
case obj.KindChan:
die = newdie(&dwtypes, DW_ABRV_CHANTYPE, name)
case obj.KindFunc:
die = newdie(&dwtypes, DW_ABRV_FUNCTYPE, name)
dotypedef(&dwtypes, name, die)
- newrefattr(die, DW_AT_type, find_or_diag(&dwtypes, "void"))
+ newrefattr(die, DW_AT_type, mustFind(&dwtypes, "void"))
nfields := decodetype_funcincount(gotype)
var fld *DWDie
var s *LSym
default:
Diag("dwarf: definition of unknown kind %d: %s", kind, gotype.Name)
die = newdie(&dwtypes, DW_ABRV_TYPEDECL, name)
- newrefattr(die, DW_AT_type, find_or_diag(&dwtypes, "<unspecified>"))
+ newrefattr(die, DW_AT_type, mustFind(&dwtypes, "<unspecified>"))
}
newattr(die, DW_AT_go_kind, DW_CLS_CONSTANT, int64(kind), 0)
// Search children (assumed to have DW_TAG_member) for the one named
// field and set its DW_AT_type to dwtype
func substitutetype(structdie *DWDie, field string, dwtype *DWDie) {
- child := find_or_diag(structdie, field)
+ child := mustFind(structdie, field)
if child == nil {
return
}
newrefattr(dwhk, DW_AT_type, t)
fld = newdie(dwhk, DW_ABRV_ARRAYRANGE, "size")
newattr(fld, DW_AT_count, DW_CLS_CONSTANT, BucketSize, 0)
- newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"))
+ newrefattr(fld, DW_AT_type, mustFind(&dwtypes, "uintptr"))
// Construct type to represent an array of BucketSize values
dwhv = newdie(&dwtypes, DW_ABRV_ARRAYTYPE, mkinternaltypename("[]val", getattr(valtype, DW_AT_name).data.(string), ""))
newrefattr(dwhv, DW_AT_type, t)
fld = newdie(dwhv, DW_ABRV_ARRAYRANGE, "size")
newattr(fld, DW_AT_count, DW_CLS_CONSTANT, BucketSize, 0)
- newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"))
+ newrefattr(fld, DW_AT_type, mustFind(&dwtypes, "uintptr"))
// Construct bucket<K,V>
dwhb = newdie(&dwtypes, DW_ABRV_STRUCTTYPE, mkinternaltypename("bucket", getattr(keytype, DW_AT_name).data.(string), getattr(valtype, DW_AT_name).data.(string)))
newmemberoffsetattr(fld, BucketSize+BucketSize*(int32(keysize)+int32(valsize)))
if Thearch.Regsize > Thearch.Ptrsize {
fld = newdie(dwhb, DW_ABRV_STRUCTFIELD, "pad")
- newrefattr(fld, DW_AT_type, find_or_diag(&dwtypes, "uintptr"))
+ newrefattr(fld, DW_AT_type, mustFind(&dwtypes, "uintptr"))
newmemberoffsetattr(fld, BucketSize+BucketSize*(int32(keysize)+int32(valsize))+int32(Thearch.Ptrsize))
}
pad := CIERESERVE + frameo + 4 - Cpos()
if pad < 0 {
- Diag("dwarf: CIERESERVE too small by %d bytes.", -pad)
- Errorexit()
+ Exitf("dwarf: CIERESERVE too small by %d bytes.", -pad)
}
strnput("", int(pad))
Cseek(infoo)
writeinfo()
if fwdcount > 0 {
- Diag("dwarf: unresolved references after first dwarf info pass")
- Errorexit()
+ Exitf("dwarf: unresolved references after first dwarf info pass")
}
if infoe != Cpos() {
- Diag("dwarf: inconsistent second dwarf info pass")
- Errorexit()
+ Exitf("dwarf: inconsistent second dwarf info pass")
}
}
import (
"encoding/binary"
"fmt"
- "os"
)
/*
func elfsetstring(s string, off int) {
if nelfstr >= len(elfstr) {
Diag("too many elf strings")
- Errorexit()
+ errorexit()
}
elfstr[nelfstr].s = s
var j int
if val[0] != '0' || val[1] != 'x' {
- fmt.Fprintf(os.Stderr, "%s: -B argument must start with 0x: %s\n", os.Args[0], val)
- Exit(2)
+ Exitf("-B argument must start with 0x: %s", val)
}
ov := val
var b int
for val != "" {
if len(val) == 1 {
- fmt.Fprintf(os.Stderr, "%s: -B argument must have even number of digits: %s\n", os.Args[0], ov)
- Exit(2)
+ Exitf("-B argument must have even number of digits: %s", ov)
}
b = 0
} else if val[0] >= 'A' && val[0] <= 'F' {
b += int(val[0]) - 'A' + 10
} else {
- fmt.Fprintf(os.Stderr, "%s: -B argument contains invalid hex digit %c: %s\n", os.Args[0], val[0], ov)
- Exit(2)
+ Exitf("-B argument contains invalid hex digit %c: %s", val[0], ov)
}
}
const maxLen = 32
if i >= maxLen {
- fmt.Fprintf(os.Stderr, "%s: -B option too long (max %d digits): %s\n", os.Args[0], maxLen, ov)
- Exit(2)
+ Exitf("-B option too long (max %d digits): %s", maxLen, ov)
}
buildinfo = append(buildinfo, uint8(b))
need := make([]*Elfaux, nsym)
chain := make([]uint32, nsym)
buckets := make([]uint32, nbucket)
- if need == nil || chain == nil || buckets == nil {
- Ctxt.Cursym = nil
- Diag("out of memory")
- Errorexit()
- }
- for i := 0; i < nsym; i++ {
- need[i] = nil
- }
- for i := 0; i < nsym; i++ {
- chain[i] = 0
- }
- for i := 0; i < nbucket; i++ {
- buckets[i] = 0
- }
var b int
var hc uint32
var name string
}
Diag("cannot find elf name %s", name)
- Errorexit()
+ errorexit()
return nil
}
eh := getElfEhdr()
switch Thearch.Thechar {
default:
- Diag("unknown architecture in asmbelf")
- Errorexit()
- fallthrough
-
+ Exitf("unknown architecture in asmbelf: %v", Thearch.Thechar)
case '5':
eh.machine = EM_ARM
-
case '6':
eh.machine = EM_X86_64
-
case '7':
eh.machine = EM_AARCH64
-
case '8':
eh.machine = EM_386
-
case '9':
eh.machine = EM_PPC64
}
if int64(int(length)) != length {
fmt.Fprintf(os.Stderr, "%s: too much pkg data in %s\n", os.Args[0], filename)
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
if int64(Bread(f, bdata)) != length {
fmt.Fprintf(os.Stderr, "%s: short pkg read %s\n", os.Args[0], filename)
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
p0 = strings.Index(data, "\n$$")
if p0 < 0 {
if Debug['u'] != 0 && whence != ArchiveObj {
- fmt.Fprintf(os.Stderr, "%s: cannot find export data in %s\n", os.Args[0], filename)
- Errorexit()
+ Exitf("cannot find export data in %s", filename)
}
return
}
if p1 < 0 {
fmt.Fprintf(os.Stderr, "%s: cannot find end of exports in %s\n", os.Args[0], filename)
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
if !strings.HasPrefix(data[p0:], "package ") {
fmt.Fprintf(os.Stderr, "%s: bad package section in %s - %.20s\n", os.Args[0], filename, data[p0:])
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
p0++
}
if Debug['u'] != 0 && whence != ArchiveObj && (p0+6 > p1 || !strings.HasPrefix(data[p0:], " safe\n")) {
- fmt.Fprintf(os.Stderr, "%s: load of unsafe package %s\n", os.Args[0], filename)
- nerrors++
- Errorexit()
+ Exitf("load of unsafe package %s", filename)
}
name := data[pname:p0]
}
if pkg == "main" && name != "main" {
- fmt.Fprintf(os.Stderr, "%s: %s: not package main (package %s)\n", os.Args[0], filename, name)
- nerrors++
- Errorexit()
+ Exitf("%s: not package main (package %s)", filename, name)
}
loadpkgdata(filename, pkg, data[p0:p1])
if i < 0 {
fmt.Fprintf(os.Stderr, "%s: found $$ // cgo but no newline in %s\n", os.Args[0], filename)
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
if p1 < 0 {
fmt.Fprintf(os.Stderr, "%s: cannot find end of // cgo section in %s\n", os.Args[0], filename)
if Debug['u'] != 0 {
- Errorexit()
+ errorexit()
}
return
}
} else if arg == "auto" {
Linkmode = LinkAuto
} else {
- fmt.Fprintf(os.Stderr, "unknown link mode -linkmode %s\n", arg)
- Errorexit()
+ Exitf("unknown link mode -linkmode %s", arg)
}
}
// symbol 0 is the null symbol.
symbols = make([]*LSym, elfobj.nsymtab)
- if symbols == nil {
- Diag("out of memory")
- Errorexit()
- }
-
for i := 1; i < elfobj.nsymtab; i++ {
if err = readelfsym(elfobj, i, &sym, 1); err != nil {
goto bad
if s.Dupok != 0 {
continue
}
- Diag("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
- Errorexit()
+ Exitf("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
}
s.Sub = sect.sym.Sub
if s.Dupok != 0 {
continue
}
- Diag("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
- Errorexit()
+ Exitf("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
}
s.Type = outer.Type | SSUB
if s.Dupok != 0 {
continue
}
- Diag("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
- Errorexit()
+ Exitf("%s: duplicate symbol reference: %s in both %s and %s", pn, s.Name, s.Outer.Name, sect.sym.Name)
}
s.Sub = sect.sym.Sub
mayberemoveoutfile()
f, err := os.OpenFile(outfile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0775)
if err != nil {
- Diag("cannot create %s: %v", outfile, err)
- Errorexit()
+ Exitf("cannot create %s: %v", outfile, err)
}
cout = f
}
}
-func Errorexit() {
+func Exitf(format string, a ...interface{}) {
+ fmt.Fprintf(os.Stderr, os.Args[0]+": "+format+"\n", a...)
+ if cout != nil {
+ cout.Close()
+ mayberemoveoutfile()
+ }
+ Exit(2)
+}
+
+func errorexit() {
if cout != nil {
// For rmtemp run at atexit time on Windows.
cout.Close()
var f *Biobuf
f, err = Bopenr(file)
if err != nil {
- Diag("cannot open file %s: %v", file, err)
- Errorexit()
+ Exitf("cannot open file %s: %v", file, err)
}
magbuf := make([]byte, len(ARMAG))
break
}
if l < 0 {
- Diag("%s: malformed archive", file)
- Errorexit()
- goto out
+ Exitf("%s: malformed archive", file)
}
off += l
var err error
f, err = Bopenr(h.file)
if f == nil {
- Ctxt.Cursym = nil
- Diag("cannot reopen %s: %v", h.pn, err)
- Errorexit()
+ Exitf("cannot reopen %s: %v", h.pn, err)
}
Bseek(f, h.off, 0)
var err error
cout, err = os.OpenFile(p, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0775)
if err != nil {
- Diag("cannot create %s: %v", p, err)
- Errorexit()
+ Exitf("cannot create %s: %v", p, err)
}
coutbuf = *Binitw(cout)
for i, h := range hostobj {
f, err := os.Open(h.file)
if err != nil {
- Ctxt.Cursym = nil
- Diag("cannot reopen %s: %v", h.pn, err)
- Errorexit()
+ Exitf("cannot reopen %s: %v", h.pn, err)
}
if _, err := f.Seek(h.off, 0); err != nil {
- Ctxt.Cursym = nil
- Diag("cannot seek %s: %v", h.pn, err)
- Errorexit()
+ Exitf("cannot seek %s: %v", h.pn, err)
}
p := fmt.Sprintf("%s/%06d.o", tmpdir, i)
paths = append(paths, p)
w, err := os.Create(p)
if err != nil {
- Ctxt.Cursym = nil
- Diag("cannot create %s: %v", p, err)
- Errorexit()
+ Exitf("cannot create %s: %v", p, err)
}
if _, err := io.CopyN(w, f, h.length); err != nil {
- Ctxt.Cursym = nil
- Diag("cannot write %s: %v", p, err)
- Errorexit()
+ Exitf("cannot write %s: %v", p, err)
}
if err := w.Close(); err != nil {
- Ctxt.Cursym = nil
- Diag("cannot close %s: %v", p, err)
- Errorexit()
+ Exitf("cannot close %s: %v", p, err)
}
}
return paths
}
if out, err := exec.Command(argv[0], argv[1:]...).CombinedOutput(); err != nil {
- Ctxt.Cursym = nil
- Diag("%s: running %s failed: %v\n%s", os.Args[0], argv[0], err, out)
- Errorexit()
+ Exitf("running %s failed: %v\n%s", argv[0], err, out)
}
}
}
if out, err := exec.Command(argv[0], argv[1:]...).CombinedOutput(); err != nil {
- Ctxt.Cursym = nil
- Diag("%s: running %s failed: %v\n%s", os.Args[0], argv[0], err, out)
- Errorexit()
+ Exitf("running %s failed: %v\n%s", argv[0], err, out)
}
}
/* check the header */
line := Brdline(f, '\n')
-
- var import0 int64
- var import1 int64
- var t string
if line == "" {
if Blinelen(f) > 0 {
Diag("%s: not an object file", pn)
return
}
-
- goto eof
+ Diag("truncated object file: %s", pn)
+ return
}
if !strings.HasPrefix(line, "go object ") {
if strings.HasSuffix(pn, ".go") {
- fmt.Printf("%cl: input %s is not .%c file (use %cg to compile .go files)\n", Thearch.Thechar, pn, Thearch.Thechar, Thearch.Thechar)
- Errorexit()
+ Exitf("%cl: input %s is not .%c file (use %cg to compile .go files)", Thearch.Thechar, pn, Thearch.Thechar, Thearch.Thechar)
}
if line == Thestring {
// old header format: just $GOOS
Diag("%s: stale object file", pn)
-
return
}
Diag("%s: not an object file", pn)
-
return
}
// First, check that the basic goos, goarch, and version match.
- t = fmt.Sprintf("%s %s %s ", goos, obj.Getgoarch(), obj.Getgoversion())
+ t := fmt.Sprintf("%s %s %s ", goos, obj.Getgoarch(), obj.Getgoversion())
line = strings.TrimRight(line, "\n")
if !strings.HasPrefix(line[10:]+" ", t) && Debug['f'] == 0 {
}
/* skip over exports and other info -- ends with \n!\n */
- import0 = Boffset(f)
+ import0 := Boffset(f)
c1 = '\n' // the last line ended in \n
c2 = Bgetc(f)
c2 = c3
c3 = Bgetc(f)
if c3 == Beof {
- goto eof
+ Diag("truncated object file: %s", pn)
+ return
}
}
- import1 = Boffset(f)
+ import1 := Boffset(f)
Bseek(f, import0, 0)
ldpkg(f, pkg, import1-import0-2, pn, whence) // -2 for !\n
Bseek(f, import1, 0)
ldobjfile(Ctxt, f, pkg, eof-Boffset(f), pn)
-
- return
-
-eof:
- Diag("truncated object file: %s", pn)
}
func ldshlibsyms(shlib string) {
func setheadtype(s string) {
h := headtype(s)
if h < 0 {
- fmt.Fprintf(os.Stderr, "unknown header type -H %s\n", s)
- Errorexit()
+ Exitf("unknown header type -H %s", s)
}
headstring = s
}
func doversion() {
- fmt.Printf("%cl version %s\n", Thearch.Thechar, obj.Getgoversion())
- Errorexit()
+ Exitf("version %s", obj.Getgoversion())
}
func genasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
undefsym(s)
}
if nerrors > 0 {
- Errorexit()
+ errorexit()
}
}
nerrors++
if nerrors > 20 {
- fmt.Printf("too many errors\n")
- Errorexit()
+ Exitf("too many errors")
}
}
func newMachoSeg(name string, msect int) *MachoSeg {
if nseg >= len(seg) {
- Diag("too many segs")
- Errorexit()
+ Exitf("too many segs")
}
s := &seg[nseg]
func newMachoSect(seg *MachoSeg, name string, segname string) *MachoSect {
if seg.nsect >= seg.msect {
- Diag("too many sects in segment %s", seg.name)
- Errorexit()
+ Exitf("too many sects in segment %s", seg.name)
}
s := &seg.sect[seg.nsect]
mh := getMachoHdr()
switch Thearch.Thechar {
default:
- Diag("unknown mach architecture")
- Errorexit()
- fallthrough
+ Exitf("unknown macho architecture: %v", Thearch.Thechar)
case '5':
mh.cpu = MACHO_CPU_ARM
if Linkmode != LinkExternal {
switch Thearch.Thechar {
default:
- Diag("unknown macho architecture")
- Errorexit()
- fallthrough
+ Exitf("unknown macho architecture: %v", Thearch.Thechar)
case '5':
ml := newMachoLoad(5, 17+2) /* unix thread */
a := machowrite()
if int32(a) > HEADR {
- Diag("HEADR too small: %d > %d", a, HEADR)
+ Exitf("HEADR too small: %d > %d", a, HEADR)
}
}
for pciterinit(Ctxt, &it, &pcln.Pcfile); it.done == 0; pciternext(&it) {
if it.value < 1 || it.value > Ctxt.Nhistfile {
Diag("bad file number in pcfile: %d not in range [1, %d]\n", it.value, Ctxt.Nhistfile)
- Errorexit()
+ errorexit()
}
}
}
if off != end {
Diag("bad math in functab: funcstart=%d off=%d but end=%d (npcdata=%d nfuncdata=%d ptrsize=%d)", funcstart, off, end, pcln.Npcdata, pcln.Nfuncdata, Thearch.Ptrsize)
- Errorexit()
+ errorexit()
}
nfunc++
func addpesection(name string, sectsize int, filesize int) *IMAGE_SECTION_HEADER {
if pensect == 16 {
Diag("too many sections")
- Errorexit()
+ errorexit()
}
h := &sh[pensect]
func chksectoff(h *IMAGE_SECTION_HEADER, off int64) {
if off != int64(h.PointerToRawData) {
Diag("%s.PointerToRawData = %#x, want %#x", cstring(h.Name[:]), uint64(int64(h.PointerToRawData)), uint64(off))
- Errorexit()
+ errorexit()
}
}
func chksectseg(h *IMAGE_SECTION_HEADER, s *Segment) {
if s.Vaddr-PEBASE != uint64(h.VirtualAddress) {
Diag("%s.VirtualAddress = %#x, want %#x", cstring(h.Name[:]), uint64(int64(h.VirtualAddress)), uint64(int64(s.Vaddr-PEBASE)))
- Errorexit()
+ errorexit()
}
if s.Fileoff != uint64(h.PointerToRawData) {
Diag("%s.PointerToRawData = %#x, want %#x", cstring(h.Name[:]), uint64(int64(h.PointerToRawData)), uint64(int64(s.Fileoff)))
- Errorexit()
+ errorexit()
}
}
}
if nexport+1 > len(dexport) {
Diag("pe dynexport table is full")
- Errorexit()
+ errorexit()
}
dexport[nexport] = s
func Asmbpe() {
switch Thearch.Thechar {
default:
- Diag("unknown PE architecture")
- Errorexit()
- fallthrough
-
+ Exitf("unknown PE architecture: %v", Thearch.Thechar)
case '6':
fh.Machine = IMAGE_FILE_MACHINE_AMD64
-
case '8':
fh.Machine = IMAGE_FILE_MACHINE_I386
}
if Buildmode == BuildmodeExe {
Buildmode = BuildmodeCShared
} else if Buildmode != BuildmodeCShared {
- Diag("-shared and -buildmode=%s are incompatible\n", Buildmode.String())
- Errorexit()
+ Exitf("-shared and -buildmode=%s are incompatible", Buildmode.String())
}
}
Thearch.Archinit()
if Linkshared && !Iself {
- Diag("-linkshared can only be used on elf systems")
- Errorexit()
+ Exitf("-linkshared can only be used on elf systems")
}
if Debug['v'] != 0 {
Bflush(&Bso)
- Errorexit()
+ errorexit()
}