This affects only the RISC-V targets, where the compiler options
-gvariable-location-views and consequently also -ginline-points
are disabled by default, which is unexpected and disables some
useful features of the generated debug info.

Due to a bug in the gas assembler the .loc statement
is not usable to generate location view debug info.
That is detected by configure:

configure:31500: checking assembler for dwarf2 debug_view support
configure:31509: .../riscv-unknown-elf/bin/as    -o conftest.o conftest.s >&5
conftest.s: Assembler messages:
conftest.s:5: Error: .uleb128 only supports constant or subtract expressions
conftest.s:6: Error: .uleb128 only supports constant or subtract expressions
configure:31512: $? = 1
configure: failed program was
        .file 1 "conftest.s"
        .loc 1 3 0 view .LVU1
        nop
        .data
        .uleb128 .LVU1
        .uleb128 .LVU1

configure:31523: result: no

This results in dwarf2out_as_locview_support being set to false,
and that creates a sequence of events, with the end result that
most inlined functions either have no DW_AT_entry_pc, or one
with a wrong entry pc value.

But the location views can also be generated without using any
.loc statements, therefore we should enable the option
-gvariable-location-views by default, regardless of the status
of -gas-locview-support.
---
Regression-tested on riscv-unknown-elf and riscv64-unknown-elf, OK for trunk?

 gcc/toplev.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index eee4805b504..292948122de 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -1475,9 +1475,7 @@ process_options ()
        = (flag_var_tracking
           && debug_info_level >= DINFO_LEVEL_NORMAL
           && dwarf_debuginfo_p ()
-          && !dwarf_strict
-          && dwarf2out_as_loc_support
-          && dwarf2out_as_locview_support);
+          && !dwarf_strict);
     }
   else if (debug_variable_location_views == -1 && dwarf_version != 5)
     {
-- 
2.39.2

Reply via email to