On Fri, 2018-05-11 at 18:51 +0200, Richard Biener wrote: > That's an interesting result. Do you have any non-LTO objects? > Basically I'm curious what ld eliminates that gcc with LTO doesn't.
Whole project is compiled with LTO, part of the project is provided as a library (which is archived with arm-none-eabi-gcc-ar). Only non-LTO stuff in the final executable are objects from standard toolchain libraries and I suppose they are the culprit here - the toolchain is compiled with -ffunction-sections -fdata-sections, but without -flto. Maybe I should actually compile the whole toolchain with -flto -ffat- lto-objects? Is this a sane idea? > As to a workaround for the ld bug you can try keeping all .debug_* > sections. IIRC 2.30 has the bug fixed (on the branch). Indeed - "keeping" all the debug sections is a viable alternative. I've found out that it is enough to "keep" just these: /* DWARF 2 */ .debug_info 0 : { KEEP(*(.debug_info .gnu.linkonce.wi.*)); } ... .debug_frame 0 : { KEEP(*(.debug_frame)); } I have to check whether debugging something like that is actually possible (; Thanks for the workaround! Regards, FCh