[Web] Use Oz instead of Os when optimizing for size

LLVM has an Oz optimization flag, which they define as:

`Like -Os (and thus -O2), but reduces code size further.`

I've tested this, on a release builds, and the result is ~25% smaller
uncompressed size, and ~10% smaller when compressed.
This commit is contained in:
Fabio Alessandrelli 2024-09-24 14:13:51 +02:00
parent c3e16cda00
commit 59d4a52fe4
1 changed files with 6 additions and 2 deletions

View File

@ -770,8 +770,12 @@ else:
env.Append(CCFLAGS=["-O2"]) env.Append(CCFLAGS=["-O2"])
env.Append(LINKFLAGS=["-O2"]) env.Append(LINKFLAGS=["-O2"])
elif env["optimize"] == "size": elif env["optimize"] == "size":
env.Append(CCFLAGS=["-Os"]) if methods.using_emcc(env):
env.Append(LINKFLAGS=["-Os"]) env.Append(CCFLAGS=["-Oz"])
env.Append(LINKFLAGS=["-Oz"])
else:
env.Append(CCFLAGS=["-Os"])
env.Append(LINKFLAGS=["-Os"])
elif env["optimize"] == "debug": elif env["optimize"] == "debug":
env.Append(CCFLAGS=["-Og"]) env.Append(CCFLAGS=["-Og"])
env.Append(LINKFLAGS=["-Og"]) env.Append(LINKFLAGS=["-Og"])