Browse Source

all: use -opt flag for optimization level in CFlags (-Os, etc)

This brings some consistency to the CFlags and fixes the issue that on
some platforms (Linux, MacOS), no optimization level was set and
therefore C files in packages were not optimized at all.
pull/2148/head
Ayke van Laethem 3 years ago
committed by Ron Evans
parent
commit
6234bf9a88
  1. 2
      compileopts/config.go
  2. 1
      targets/cortex-m.json
  3. 1
      targets/gameboy-advance.json
  4. 1
      targets/riscv.json
  5. 3
      targets/wasi.json
  6. 3
      targets/wasm.json
  7. 1
      targets/xtensa.json

2
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
}

1
targets/cortex-m.json

@ -10,7 +10,6 @@
"automatic-stack-size": true,
"default-stack-size": 2048,
"cflags": [
"-Oz",
"-mthumb",
"-Werror",
"-fshort-enums",

1
targets/gameboy-advance.json

@ -10,7 +10,6 @@
"cflags": [
"--target=arm4-none-eabi",
"-mcpu=arm7tdmi",
"-Oz",
"-Werror",
"-fshort-enums",
"-fomit-frame-pointer",

1
targets/riscv.json

@ -7,7 +7,6 @@
"rtlib": "compiler-rt",
"libc": "picolibc",
"cflags": [
"-Os",
"-Werror",
"-fno-exceptions", "-fno-unwind-tables",
"-ffunction-sections", "-fdata-sections"

3
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",

3
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",

1
targets/xtensa.json

@ -7,7 +7,6 @@
"scheduler": "none",
"cflags": [
"--target=xtensa",
"-Oz",
"-Werror",
"-fshort-enums",
"-Wno-macro-redefined",

Loading…
Cancel
Save