mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/asm: make asm -S flag consistent with compile -S flag
Change things so that the -S command line option for the assembler works the same as -S in the compiler, e.g. you can use -S=2 to get additional detail. Change-Id: I7bdfba39a98e67c7ae4b93019e171b188bb99a2d Reviewed-on: https://go-review.googlesource.com/c/go/+/255717 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
7a095c3236
commit
75fab04b83
2 changed files with 5 additions and 6 deletions
|
|
@ -17,7 +17,6 @@ import (
|
||||||
var (
|
var (
|
||||||
Debug = flag.Bool("debug", false, "dump instructions as they are parsed")
|
Debug = flag.Bool("debug", false, "dump instructions as they are parsed")
|
||||||
OutputFile = flag.String("o", "", "output file; default foo.o for /a/b/c/foo.s as first argument")
|
OutputFile = flag.String("o", "", "output file; default foo.o for /a/b/c/foo.s as first argument")
|
||||||
PrintOut = flag.Bool("S", false, "print assembly and machine code")
|
|
||||||
TrimPath = flag.String("trimpath", "", "remove prefix from recorded source file paths")
|
TrimPath = flag.String("trimpath", "", "remove prefix from recorded source file paths")
|
||||||
Shared = flag.Bool("shared", false, "generate code that can be linked into a shared library")
|
Shared = flag.Bool("shared", false, "generate code that can be linked into a shared library")
|
||||||
Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries")
|
Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries")
|
||||||
|
|
@ -28,14 +27,16 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
D MultiFlag
|
D MultiFlag
|
||||||
I MultiFlag
|
I MultiFlag
|
||||||
|
PrintOut int
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifier=value; can be set multiple times")
|
flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifier=value; can be set multiple times")
|
||||||
flag.Var(&I, "I", "include directory; can be set multiple times")
|
flag.Var(&I, "I", "include directory; can be set multiple times")
|
||||||
objabi.AddVersionFlag() // -V
|
objabi.AddVersionFlag() // -V
|
||||||
|
objabi.Flagcount("S", "print assembly and machine code", &PrintOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2.
|
// MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2.
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,7 @@ func main() {
|
||||||
flags.Parse()
|
flags.Parse()
|
||||||
|
|
||||||
ctxt := obj.Linknew(architecture.LinkArch)
|
ctxt := obj.Linknew(architecture.LinkArch)
|
||||||
if *flags.PrintOut {
|
ctxt.Debugasm = flags.PrintOut
|
||||||
ctxt.Debugasm = 1
|
|
||||||
}
|
|
||||||
ctxt.Flag_dynlink = *flags.Dynlink
|
ctxt.Flag_dynlink = *flags.Dynlink
|
||||||
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
|
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
|
||||||
ctxt.IsAsm = true
|
ctxt.IsAsm = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue