"cmd/asm/internal/addr"
"cmd/asm/internal/arch"
+ "cmd/asm/internal/flags"
"cmd/asm/internal/lex"
"cmd/internal/obj"
)
p.pendingLabels = p.pendingLabels[0:0]
}
prog.Pc = int64(p.pc)
- fmt.Println(p.histLineNum, prog)
+ if *flags.Debug {
+ fmt.Println(p.histLineNum, prog)
+ }
}
// asmText assembles a TEXT pseudo-op.
)
var (
- OutputFile = flag.String("o", "", "output file; default foo.6 for /a/b/c/foo.s on arm64 (unused TODO)")
- PrintOut = flag.Bool("S", true, "print assembly and machine code") // TODO: set to false
+ Debug = flag.Bool("debug", false, "dump instructions as they are parsed")
+ OutputFile = flag.String("o", "", "output file; default foo.6 for /a/b/c/foo.s on amd64")
+ PrintOut = flag.Bool("S", false, "print assembly and machine code")
TrimPath = flag.String("trimpath", "", "remove prefix from recorded source file paths (unused TODO)")
)
var ok bool
pList.Firstpc, ok = parser.Parse()
if !ok {
- log.Print("FAIL TODO")
+ log.Fatalf("asm: assembly of %s failed", flag.Arg(0))
os.Exit(1)
}
obj.Writeobjdirect(ctxt, output)