Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions gcc/dwarf2out.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5600,14 +5600,15 @@ is_fortran (const_tree decl)
return is_fortran ();
}

/* Return TRUE if the language is Rust. */
/* Return TRUE if the language is Rust.
Note, returns FALSE for dwarf_version < 5 && dwarf_strict. */

static inline bool
is_rust ()
{
unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language);

return lang == DW_LANG_Rust || lang == DW_LANG_Rust_old;
return lang == DW_LANG_Rust;
}

/* Return TRUE if the language is Ada. */
Expand Down Expand Up @@ -25215,13 +25216,6 @@ gen_compile_unit_die (const char *filename)
}
else if (strcmp (language_string, "GNU F77") == 0)
language = DW_LANG_Fortran77;
else if (strcmp (language_string, "GNU Rust") == 0)
{
if (dwarf_version >= 5 || !dwarf_strict)
language = DW_LANG_Rust;
else
language = DW_LANG_Rust_old;
}
else if (dwarf_version >= 3 || !dwarf_strict)
{
if (strcmp (language_string, "GNU Ada") == 0)
Expand All @@ -25247,6 +25241,8 @@ gen_compile_unit_die (const char *filename)
{
if (strcmp (language_string, "GNU Go") == 0)
language = DW_LANG_Go;
else if (strcmp (language_string, "GNU Rust") == 0)
language = DW_LANG_Rust;
}
}
/* Use a degraded Fortran setting in strict DWARF2 so is_fortran works. */
Expand Down
4 changes: 2 additions & 2 deletions gcc/testsuite/rust/debug/oldlang.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main () {
// { dg-do compile }
// { dg-options "-gstrict-dwarf -gdwarf-3 -dA" }
// DW_LANG_Rust_old is 0x9000
// { dg-final { scan-assembler "0x9000\[ \t]\[^\n\r]* DW_AT_language" } } */
// Strict DWARF < 5 uses DW_LANG_C = 0x0002
// { dg-final { scan-assembler "0x2\[ \t]\[^\n\r]* DW_AT_language" } } */
}