github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/asm/internal/flags/flags.go (about) 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. 4 5 // Package flags implements top-level flags and the usage message for the assembler. 6 package flags 7 8 import ( 9 "github.com/shogo82148/std/cmd/internal/obj" 10 "github.com/shogo82148/std/flag" 11 ) 12 13 var ( 14 Debug = flag.Bool("debug", false, "dump instructions as they are parsed") 15 OutputFile = flag.String("o", "", "output file; default foo.o for /a/b/c/foo.s as first argument") 16 TrimPath = flag.String("trimpath", "", "remove prefix from recorded source file paths") 17 Shared = flag.Bool("shared", false, "generate code that can be linked into a shared library") 18 Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries") 19 Linkshared = flag.Bool("linkshared", false, "generate code that will be linked against Go shared libraries") 20 AllErrors = flag.Bool("e", false, "no limit on number of errors reported") 21 SymABIs = flag.Bool("gensymabis", false, "write symbol ABI information to output file, don't assemble") 22 Importpath = flag.String("p", obj.UnlinkablePkg, "set expected package import to path") 23 Spectre = flag.String("spectre", "", "enable spectre mitigations in `list` (all, ret)") 24 ) 25 26 var DebugFlags struct { 27 MayMoreStack string `help:"call named function before all stack growth checks"` 28 PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"` 29 } 30 31 var ( 32 D MultiFlag 33 I MultiFlag 34 PrintOut int 35 DebugV bool 36 ) 37 38 // MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2. 39 type MultiFlag []string 40 41 func (m *MultiFlag) String() string 42 43 func (m *MultiFlag) Set(val string) error 44 45 func Usage() 46 47 func Parse()