Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries")
AllErrors = flag.Bool("e", false, "no limit on number of errors reported")
SymABIs = flag.Bool("gensymabis", false, "write symbol ABI information to output file, don't assemble")
- Newobj = flag.Bool("newobj", false, "use new object file format")
+ Importpath = flag.String("p", "", "set expected package import to path")
++ Spectre = flag.String("spectre", "", "enable spectre mitigations in `list` (all, ret)")
- Spectre = flag.String("spectre", "", "enable spectre mitigations in `list` (all, ret)")
+ Go115Newobj = flag.Bool("go115newobj", true, "use new object file format")
)
var (
}
ctxt.Flag_dynlink = *flags.Dynlink
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
- ctxt.Flag_newobj = *flags.Newobj
+ ctxt.Flag_go115newobj = *flags.Go115Newobj
+ switch *flags.Spectre {
+ default:
+ log.Printf("unknown setting -spectre=%s", *flags.Spectre)
+ os.Exit(2)
+ case "":
+ // nothing
+ case "index":
+ // known to compiler; ignore here so people can use
+ // the same list with -gcflags=-spectre=LIST and -asmflags=-spectrre=LIST
+ case "all", "ret":
+ ctxt.Retpoline = true
+ }
+
ctxt.Bso = bufio.NewWriter(os.Stdout)
defer ctxt.Bso.Flush()
// Record flags that affect the build result. (And don't
// record flags that don't, since that would cause spurious
// changes in the binary.)
- recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "dwarfbasentries", "smallframes", "go115newobj")
- recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "dwarfbasentries", "smallframes", "spectre", "newobj")
++ recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "dwarfbasentries", "smallframes", "spectre", "go115newobj")
if smallFrames {
maxStackVarSize = 128 * 1024
Flag_linkshared bool
Flag_optimize bool
Flag_locationlists bool
- Flag_newobj bool // use new object file format
+ Flag_go115newobj bool // use new object file format
+ Retpoline bool // emit use of retpoline stubs for indirect jmp/call
Bso *bufio.Writer
Pathname string
hashmu sync.Mutex // protects hash, funchash