Add new compilation flags #8408
Draft
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.
Summary
As mentioned in #8259 CSS implementation had a big impact on the binary size due to its extensive use of C++ templates. Current binary size is 6.4MB and this PR adds compilation flags to bring it down. The result size is 3.1MB
Added flags:
-flto
: enables Link Time Optimization -- compiler generates intermediate code that can be used during the linking stage to optimize size of the binary.--icf=safe
: enables Identical Code Folding -- this linker option reduces the binary size by merging identical functions or read-only data sections, optimizing memory usage. Thesafe
mode works in a way that should not alter program's behavior: If the program, or any external systems interacting with the program, depend on the specific memory addresses of functions or data, --icf=safe should maintain these dependencies correctly, avoiding alterations that could affect functionality based on memory layout.