4 ms·
Other flags that can be useful not mentioned here: * -fvisibility=internal (stronger than hidden and must be used with a LOT OF CARE, e.g. never pass a funct
by jcelerier 3y ago
Other flags that can be useful not mentioned here:
* -fvisibility=internal (stronger than hidden and must be used with a LOT OF CARE, e.g. never pass a function pointer to a function not marked explicitly with hidden or default visibility in that case as its ABI may change)
* -Bsymbolic / -Bsymbolic-functions / -fno-semantic-interposition (interesting explanations: http://maskray.me/blog/2021-05-09-fno-semantic-interposition)
* -fno-stack-protector (not recommended for libz aha)
* -fno-plt / -fno-ident (very small effect, more for the sake of completeness)
* -fvirtual-function-elimination (surprisingly not done by default, here I can sometime get back a few percent through this on OO heavy codebases)
* -ffunction-sections -fdata-sections -Wl,--gc-sections (largest improvement in my experience, sometimes this literally halved binary size for me when coupled with lto)
* -Wl,--as-needed
* -Wl,--icf=all (I heard horror stories about this but it works fine here)
in some cases, when all used together (as there's some synergy between the various optimizations of these flags) this can have double-digits effects on binary size reduction percentage