Why is '--no-gc-sections' added in build with MAIN_MODULE/SIDE_MODULE=1? #16926
-
Line 298 in a62c811 --no-gc-sections '--gc-sections' greatly decreases function count (which helps us not to run into the limit of functions). But we can't use it because of '--no-gc-sections'. Why was it added? Is there a way to bypass this and will it be correct? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Because with |
Beta Was this translation helpful? Give feedback.
Because with
-sMAIN_MODULE=1
we explicitly want to include everything. If you want to DCE your main module you need to build withMAIN_MODULE=2
. That is the main difference between =1 and =2. One does DCE and the other conservatively keeps everything alive in case it is needed at runtime.