mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-20 04:19:04 +00:00
main: remove -no-debug flag
The -no-debug flag controls whether to emit DWARF debug information.
However, instead of limiting debug information altogether, I think it's
better to strip it off at the end if it isn't needed. For several
reasons:
* Some parts of the compiler now rely on the presence of debug
information for proper diagnostics.
* It works better with the cache: there is no distinction between
debug and no-debug builds.
* It makes it easier (or possible at all) to enable debug information
in the wasi-libc library without big downsides.
I'm doing this in a separate commit so this can be reverted if needed.
This commit is contained in:
@@ -209,9 +209,8 @@ func (c *Config) CFlags() []string {
|
||||
cflags = append(cflags, "-nostdlibinc", "-Xclang", "-internal-isystem", "-Xclang", filepath.Join(root, "lib", "picolibc", "newlib", "libc", "include"))
|
||||
cflags = append(cflags, "-I"+filepath.Join(root, "lib/picolibc-include"))
|
||||
}
|
||||
if c.EmitDWARF() {
|
||||
cflags = append(cflags, "-g")
|
||||
}
|
||||
// Always emit debug information. It is optionally stripped at link time.
|
||||
cflags = append(cflags, "-g")
|
||||
return cflags
|
||||
}
|
||||
|
||||
@@ -250,12 +249,6 @@ func (c *Config) VerifyIR() bool {
|
||||
return c.Options.VerifyIR
|
||||
}
|
||||
|
||||
// EmitDWARF returns whether to add debug symbols to the IR, for debugging with
|
||||
// GDB and similar.
|
||||
func (c *Config) EmitDWARF() bool {
|
||||
return c.Options.EmitDWARF
|
||||
}
|
||||
|
||||
// Debug returns whether debug (DWARF) information should be retained by the
|
||||
// linker. The default varies by target but can be controlled with the -debug
|
||||
// command line flag.
|
||||
|
||||
Reference in New Issue
Block a user