Skip to content

[emscripten] Simply LTO flag setup. NFC#7997

Merged
sbc100 merged 1 commit into
mainfrom
simplify_lto_setup
Oct 28, 2025
Merged

[emscripten] Simply LTO flag setup. NFC#7997
sbc100 merged 1 commit into
mainfrom
simplify_lto_setup

Conversation

@sbc100
Copy link
Copy Markdown
Member

@sbc100 sbc100 commented Oct 25, 2025

We have a setting (BYN_ENABLE_LTO) which controls if LTO is enabled, and this is enabled for emscripten by default.

With emscripten we also want to add -flto=thin to the linker flags (on other targets its not needed but in emscripten we need this so the linker knows to use specific LTO system libraries)

I'm not sure if was intentional to use -flto and some places and -flto=thin in others, but this change consistency does thing LTO. If we want to add option for full LTO we could do that later.

Also, don't enable LTO by default in debug build.

@sbc100 sbc100 requested review from kripken and tlively October 25, 2025 21:57
@sbc100 sbc100 force-pushed the simplify_lto_setup branch from 8e0a679 to 86ca9c3 Compare October 25, 2025 22:04
We have a setting (BYN_ENABLE_LTO) which controls if LTO is enabled, and
this is enabled for emscripten by default.

With emscripten we also want to add `-flto=thin` to the linker flags
(on other targets its not needed but in emscripten we need this so the
linker knows to use specific LTO system libraries)

I'm not sure if was intentional to use `-flto` and some places and
`-flto=thin` in others, but this change consistency does thing LTO.

Also, don't enable LTO by default in debug builds.
@sbc100 sbc100 force-pushed the simplify_lto_setup branch from 86ca9c3 to 5080286 Compare October 25, 2025 22:06
Comment thread CMakeLists.txt
@sbc100 sbc100 merged commit d0156b4 into main Oct 28, 2025
16 checks passed
@sbc100 sbc100 deleted the simplify_lto_setup branch October 28, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants