add -nobounds (similar to -gcflags=-B)

This commit is contained in:
Damian Gryski
2025-04-14 17:01:03 -07:00
committed by Ron Evans
parent 133e32c1c4
commit 0fdf08d14f
5 changed files with 9 additions and 0 deletions
+1
View File
@@ -214,6 +214,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
MaxStackAlloc: config.MaxStackAlloc(),
NeedsStackObjects: config.NeedsStackObjects(),
Debug: !config.Options.SkipDWARF, // emit DWARF except when -internal-nodwarf is passed
Nobounds: config.Options.Nobounds,
PanicStrategy: config.PanicStrategy(),
}
+1
View File
@@ -43,6 +43,7 @@ type Options struct {
PrintCommands func(cmd string, args ...string) `json:"-"`
Semaphore chan struct{} `json:"-"` // -p flag controls cap
Debug bool
Nobounds bool
PrintSizes string
PrintAllocs *regexp.Regexp // regexp string
PrintStacks bool
+1
View File
@@ -58,6 +58,7 @@ type Config struct {
MaxStackAlloc uint64
NeedsStackObjects bool
Debug bool // Whether to emit debug information in the LLVM module.
Nobounds bool // Whether to skip bounds checks
PanicStrategy string
}
+4
View File
@@ -438,6 +438,10 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
}
}
}
if c.Nobounds {
info.nobounds = true
}
}
// Check whether this function can be used in //go:wasmimport or
+2
View File
@@ -1514,6 +1514,7 @@ func main() {
printCommands := flag.Bool("x", false, "Print commands")
parallelism := flag.Int("p", runtime.GOMAXPROCS(0), "the number of build jobs that can run in parallel")
nodebug := flag.Bool("no-debug", false, "strip debug information")
nobounds := flag.Bool("nobounds", false, "do not emit bounds checks")
ocdCommandsString := flag.String("ocd-commands", "", "OpenOCD commands, overriding target spec (can specify multiple separated by commas)")
ocdOutput := flag.Bool("ocd-output", false, "print OCD daemon output during debug")
port := flag.String("port", "", "flash port (can specify multiple candidates separated by commas)")
@@ -1625,6 +1626,7 @@ func main() {
SkipDWARF: *skipDwarf,
Semaphore: make(chan struct{}, *parallelism),
Debug: !*nodebug,
Nobounds: *nobounds,
PrintSizes: *printSize,
PrintStacks: *printStacks,
PrintAllocs: printAllocs,