diff --git a/compileopts/config.go b/compileopts/config.go index 8f815ffb..4aa8ed5e 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -211,6 +211,8 @@ func (c *Config) CFlags() []string { } // Always emit debug information. It is optionally stripped at link time. cflags = append(cflags, "-g") + // Use the same optimization level as TinyGo. + cflags = append(cflags, "-O"+c.Options.Opt) return cflags } diff --git a/targets/cortex-m.json b/targets/cortex-m.json index 0021d03c..dacf2181 100644 --- a/targets/cortex-m.json +++ b/targets/cortex-m.json @@ -10,7 +10,6 @@ "automatic-stack-size": true, "default-stack-size": 2048, "cflags": [ - "-Oz", "-mthumb", "-Werror", "-fshort-enums", diff --git a/targets/gameboy-advance.json b/targets/gameboy-advance.json index 2eb8aaa8..e2d58159 100644 --- a/targets/gameboy-advance.json +++ b/targets/gameboy-advance.json @@ -10,7 +10,6 @@ "cflags": [ "--target=arm4-none-eabi", "-mcpu=arm7tdmi", - "-Oz", "-Werror", "-fshort-enums", "-fomit-frame-pointer", diff --git a/targets/riscv.json b/targets/riscv.json index 1ccf123a..4b78db60 100644 --- a/targets/riscv.json +++ b/targets/riscv.json @@ -7,7 +7,6 @@ "rtlib": "compiler-rt", "libc": "picolibc", "cflags": [ - "-Os", "-Werror", "-fno-exceptions", "-fno-unwind-tables", "-ffunction-sections", "-fdata-sections" diff --git a/targets/wasi.json b/targets/wasi.json index b80b77d1..fd481b65 100644 --- a/targets/wasi.json +++ b/targets/wasi.json @@ -7,8 +7,7 @@ "libc": "wasi-libc", "cflags": [ "--target=wasm32--wasi", - "--sysroot={root}/lib/wasi-libc/sysroot", - "-Oz" + "--sysroot={root}/lib/wasi-libc/sysroot" ], "ldflags": [ "--allow-undefined", diff --git a/targets/wasm.json b/targets/wasm.json index eb03eb8c..083b6230 100644 --- a/targets/wasm.json +++ b/targets/wasm.json @@ -7,8 +7,7 @@ "libc": "wasi-libc", "cflags": [ "--target=wasm32--wasi", - "--sysroot={root}/lib/wasi-libc/sysroot", - "-Oz" + "--sysroot={root}/lib/wasi-libc/sysroot" ], "ldflags": [ "--allow-undefined", diff --git a/targets/xtensa.json b/targets/xtensa.json index 6ebfc4e9..7fa24f5b 100644 --- a/targets/xtensa.json +++ b/targets/xtensa.json @@ -7,7 +7,6 @@ "scheduler": "none", "cflags": [ "--target=xtensa", - "-Oz", "-Werror", "-fshort-enums", "-Wno-macro-redefined",