<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/81558>81558</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Padding between debug_str_offsets is not support by DWARF verifier
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            debuginfo
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          felipepiovezan
      </td>
    </tr>
</table>

<pre>
    If we run the verifier with --all on `llvm/test/DebugInfo/X86/dwarfdump-str-offsets.s`, 
it will claim the input is invalid because it adds padding between debug_str_offsets:

```
        .long .debug_str_offsets_segment0_end-.debug_str_offsets_base0+4
        .short 5    # DWARF version
        .short 0    # Padding
.debug_str_offsets_base0:
        .long str_producer
 .long str_CU1
        .long str_CU1_dir
        .long str_Subprogram
        .long str_Variable1
        .long str_Variable2
        .long str_Variable3
.debug_str_offsets_segment0_end:
# A 4-byte gap.
 .long 0
```

Now, if we interpret the DWARF spec literally, it doesn't talk about padding.
It really makes it sound like offset_of_dwarf_version + length must point to
the next contribution. Indeed, this is what the verifier expects (and why this
test fails to verify).

Dwarfdump, on the other hand, takes a different approach. It calls
`collectContributionData(Units)`, which scans all compile units, extracts their
DW_AT_str_offsets_base and uses those to build a list of "this is where the
different debug_str_offset contributions start". It even "subtracts" the header
size from those to find the headers.

So one utility acknowledges (and prints!) those gaps because it uses an indirect way
to find where they are, but the other rejects them. How to reconcile these?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVU1v2zgQ_TX0ZWBBou3YPviQxjA2l0Wx3W73ZlDiSOKGJgXOMKr76xeU5NhpYzQIhAR88_HmzYciMo1D3InVJ7Haz1Tk1oddjdZ02Bn_ij-Um5Ven3fPNfQIITrgFuEVg6kNBugNtzCfK2vBOxAPubWvJyEPjMRCHvZYxubZ1V7Iw7-bByEPuleh1vHUzYnD3Nc1IVNG4iEX8glE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