3 ms·
That’s true for C/C++ for clang and GCC if you use -fdata-sections for compiling and linking. -function-sections does a similar thing for duplicate functions.
by vlovich123 4y ago
That’s true for C/C++ for clang and GCC if you use -fdata-sections for compiling and linking. -function-sections does a similar thing for duplicate functions.
This doesn’t work across executable boundaries (ie shared libraries) for obvious reasons. Not sure if D’s approach makes that work.
- mmoskal 4y ago-fdata-sections can increase code size if you have lots of small global - the compiler doesn't know where they will be placed and has to generate pointer literals for all of them, in every function that use them (due to function sections). Without data sections it can generate one literal and then use relative addressing. I've been hitting that in embedded code with tight size constraints.
- vlovich123 4y agoDoesn’t that all get removed if you LTO?