Hi Jakub,

> On Thu, Nov 26, 2020 at 02:26:58PM +0100, Rainer Orth wrote:
>>   which shows that the problem is detected in the depths of
>>   libbacktrace's DWARF reader.  There's something completely off in
>>   places, like line numbers well beyond the end of dwarf.c.
>> 
>>   TBH, I don't really feel like diving into the innards of libbacktrace
>>   and DWARF at this point to investigate.
>
> Perhaps try binutils readelf -wi or dwarflint etc. to find out where things
> go wrong, and then just look at the assembly and whether it matches what as
> made out of it?

that was certainly easier than getting into libbacktrace.  I've looked
for the smallest object linked into libgo that showed readelf -wi
differences.  errors.o had

--- build.no-leb128/sparc-sun-solaris2.11/libgo/errors.o.readelf-wi     
2020-11-26 14:55:17.792533040 +0000
+++ build.leb128/sparc-sun-solaris2.11/libgo/errors.o.readelf-wi        
2020-11-26 14:54:59.099964700 +0000
@@ -957,7 +957,7 @@
     <7b1>   DW_AT_decl_line   : 89
     <7b2>   DW_AT_decl_column : 2
     <7b3>   DW_AT_type        : <0x314>
-    <7b7>   DW_AT_location    : 3 byte block: 91 94 7f         (DW_OP_fbreg: 
-108)
+    <7b7>   DW_AT_location    : 3 byte block: 91 54 7f         (DW_OP_fbreg: 
-44; DW_OP_breg15 (r15): 0)
  <3><7bb>: Abbrev Number: 35 (DW_TAG_lexical_block)
     <7bc>   DW_AT_ranges      : 0x98
     <7c0>   DW_AT_sibling     : <0x806>

The corresponding assembler is

        .byte   0x3     ! uleb128 0x3; DW_AT_location
        .byte   0x91    ! DW_OP_fbreg
        .byte   0x94,0x7f       ! sleb128 -108

without leb128 directives and

        .uleb128 0x3    ! DW_AT_location
        .byte   0x91    ! DW_OP_fbreg
        .sleb128 -108

with them.  Solaris/SPARC as emits 54 7f for the .sleb128, not 94 7f.

No wonder things go astray from there...

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to