mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
main: add -debug flag that controls debuginfo stripping
Debug information is useful in many case, but in the case of WebAssembly it increases the binary size by a large amount. It also inhibits compression of relocations. Therefore I've made debug information optional and disabled by default. (Debug information is still generated, but stripped from the binary at the link step).
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
var (
|
||||
validGCOptions = []string{"none", "leaking", "extalloc", "conservative"}
|
||||
validSchedulerOptions = []string{"none", "tasks", "coroutines"}
|
||||
validDebugOptions = []string{"auto", "true", "false"}
|
||||
validSerialOptions = []string{"none", "uart", "usb"}
|
||||
validPrintSizeOptions = []string{"none", "short", "full"}
|
||||
validPanicStrategyOptions = []string{"print", "trap"}
|
||||
@@ -28,7 +29,8 @@ type Options struct {
|
||||
DumpSSA bool
|
||||
VerifyIR bool
|
||||
PrintCommands func(cmd string, args ...string)
|
||||
Debug bool
|
||||
EmitDWARF bool
|
||||
Debug string
|
||||
PrintSizes string
|
||||
PrintAllocs *regexp.Regexp // regexp string
|
||||
PrintStacks bool
|
||||
@@ -70,6 +72,12 @@ func (o *Options) Verify() error {
|
||||
}
|
||||
}
|
||||
|
||||
if !isInArray(validDebugOptions, o.Debug) {
|
||||
return fmt.Errorf(`invalid debug option '%s': valid values are %s`,
|
||||
o.Debug,
|
||||
strings.Join(validDebugOptions, ", "))
|
||||
}
|
||||
|
||||
if o.PrintSizes != "" {
|
||||
valid := isInArray(validPrintSizeOptions, o.PrintSizes)
|
||||
if !valid {
|
||||
|
||||
Reference in New Issue
Block a user