On Sun, Oct 30, 2022 at 04:22:34PM +0100, Mark Wielaard wrote: > Hi, > > On Wed, Oct 26, 2022 at 10:39:09AM +0200, Jakub Jelinek wrote: > > I must say I don't understand nor like this DW_LANG_Rust_old stuff at all. > > Other languages don't do similar dances. > > Look for D, or Go. Neither of them has any non-standard lang code as > > fallback, they use the DWARF assigned DW_LANG_* code, and DW_LANG_C as > > fallback. On most arches, DWARF 5 is the default anyway, or non-strict > > DWARF at least. Where neither is enabled because of prehistoric or buggy > > DWARF consumers, it is unlikely they'd handle Rust sanely anyway. > > Just follow what Go does in the same function. > > DW_LANG_Rust_old was used by old rustc compilers <= 2016 before DWARF5 > assigned an official number. It might be recognized by some > debuggers. But I agree that these days it doesn't really make sense to > emit it. When producing strict DWARF it is also slightly odd to emit a > non-standard language code. So I agree that it makes sense to do what > Go does, always emit DW_LANG_Rust unless we emit strict DWARF for > versions before 5 (and then just fall back to DW_LANG_C). > > The attached patch (against "upstream gccrs") does that. I kept the > oldlang.rs testcase just to see that the -gstrict-dwarf -gdwarf-3 case > does something sane. > > The only "issue" is that is_rust () depends on the comp_unit_die > DW_AT_language being DW_LANG_Rust. But the only usage of is_rust > already depends on strict DWARF. > > https://code.wildebeest.org/git/user/mjw/gccrs/commit/?h=no-Rust-old > if someone wants to push that, to merge for a v4.
LGTM, thanks. Jakub