From 39433a3553cb08c754bd7e5e7f20f3e402892194 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 9 Jul 2020 17:08:19 +0200 Subject: [PATCH] compileopts: automatically add -g flag when including debug symbols Debug information is often useful and there is no reason to include it for Go code but not for C code. Also, disabling debug information should disable it entirely, not just for Go code. --- compileopts/config.go | 3 +++ targets/gameboy-advance.json | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compileopts/config.go b/compileopts/config.go index 24a12a9f..4c30d6b5 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -176,6 +176,9 @@ 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.Debug() { + cflags = append(cflags, "-g") + } return cflags } diff --git a/targets/gameboy-advance.json b/targets/gameboy-advance.json index 4bf12474..735d9229 100644 --- a/targets/gameboy-advance.json +++ b/targets/gameboy-advance.json @@ -9,7 +9,6 @@ "rtlib": "compiler-rt", "libc": "picolibc", "cflags": [ - "-g", "--target=arm4-none-eabi", "-mcpu=arm7tdmi", "-Oz",