https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118221
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- You can possibly "emulate" multiple debug info sections by compiling each TU with LTO and link it with -flinker-output=nolto-rel -flto-partition=max and hack lto-wrapper (from GCC) to _not_ partially link the LTRANS objects but put them into an archive. That would get you -ffunction-sections by means of one object file per function (each with separate debug info). In the end it would be cleanest if GCC would produce .debug_info.FUNC for .text.FUNC, possibly keeping the early debug for the full TU inside .debug_info, thus effectively mimic the LTO debug info layout within a single TU when using -ffunction-sections (and similarly for -fdata-sections). But I don't see anybody spending the cycles on this less used feature and thus would hope for a gdb / linker workaround.