[emscripten] Simply LTO flag setup. NFC#7997
Merged
Merged
Conversation
8e0a679 to
86ca9c3
Compare
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.
86ca9c3 to
5080286
Compare
tlively
approved these changes
Oct 27, 2025
kripken
approved these changes
Oct 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=thinto 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
-fltoand some places and-flto=thinin 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.