1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Package flags implements top-level flags and the usage message for the assembler.
17 Debug = flag.Bool("debug", false, "dump instructions as they are parsed")
18 OutputFile = flag.String("o", "", "output file; default foo.6 for /a/b/c/foo.s on amd64")
19 PrintOut = flag.Bool("S", false, "print assembly and machine code")
20 TrimPath = flag.String("trimpath", "", "remove prefix from recorded source file paths")
21 Shared = flag.Bool("shared", false, "generate code that can be linked into a shared library")
22 Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries")
23 AllErrors = flag.Bool("e", false, "no limit on number of errors reported")
32 flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifer=value; can be set multiple times")
33 flag.Var(&I, "I", "include directory; can be set multiple times")
36 // MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2.
37 type MultiFlag []string
39 func (m *MultiFlag) String() string {
46 func (m *MultiFlag) Set(val string) error {
47 (*m) = append(*m, val)
52 fmt.Fprintf(os.Stderr, "usage: asm [options] file.s\n")
53 fmt.Fprintf(os.Stderr, "Flags:\n")
66 if *OutputFile == "" {
67 input := filepath.Base(flag.Arg(0))
68 if strings.HasSuffix(input, ".s") {
69 input = input[:len(input)-2]
71 *OutputFile = fmt.Sprintf("%s.o", input)