[PATCH 1/2] Support for clang-generated DWARF5 sections .debug_addr/.debug_str_offsets

E, Nagajyothi Nagajyothi.E@amd.com
Sun May 16 11:29:02 GMT 2021

[AMD Official Use Only - Internal Distribution Only]


Please review and commit the attached patch to support clang-generated DWARF5 debug sections .debug_addr and .debug_str_offsets.
This patch does not address ODR and multifile support, which will be added through subsequent patches. Due to this, the ODR tests and cycle.sh of the testsuite fail during 'make check'.

The accompanying testsuite patch may be used while running
	 make check CC="clang -gdwarf-5" CXX="clang++ -gdwarf-5"
to avoid test failures due to readelf, as readelf does not support some of the strx forms generated by clang.


-----Original Message-----
From: Mark Wielaard <mark@klomp.org> 
Sent: Thursday, February 18, 2021 8:15 PM
To: E, Nagajyothi <Nagajyothi.E@amd.com>; dwz@sourceware.org
Cc: George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>
Subject: Re: Plan to contribute for supporting split dwarf (-gsplit-dwarf) in dwz

[CAUTION: External Email]

Hi Nagajyothi,

On Wed, 2021-02-17 at 05:53 +0000, E, Nagajyothi via Dwz wrote:
> I am working on adding support for the dwarf5 .debug_str_offsets, 
> .debug_addr sections and the related forms DW_FORM_strx[1234], DW_FORM_addrx[1234].
> Please let me know if anyone has already started work on these.

Thanks, I don't believe anybody is working on this right now.

There is already a bug for .debug_addr/DW_FORM_addrx[1234] support:
I think this shouldn't be too hard. Any DIE that references an address cannot be moved to an alt file, so simply mark it with die_no_multifile. We do try to optimize DW_AT_low/high_pc attribute pairs, so double check that doesn't interfere with DW_FORM_addrx[1234] processing.

Also note that there are two new location operations DW_OP_addrx and DW_OP_constx that can reference the .debug_addr section index.

As a followup you could try optimizing things, but then you need to keep track of all the addresses used and see if there are duplicates that could be turned into a (smaller) DW_FORM_addrx[1234] index. But I would keep that separate from the initial implementation.

For .debug_str_offset/DW_FORM_strx[1234] I opened a new bug.

This is a little trickier than DW_FORM_addrx[1234] since such DIEs using DW_FORM_strx may be moved to a multifile. You also probably want to make them equal to DW_FORM_strp entries pointing (indirectly) to the same string.

You might want to add a note to the the bugs that you are working on them.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR27375-PR27434-Recognize-new-DWARF5-sections-.debug.patch
Type: application/octet-stream
Size: 21776 bytes
Desc: 0001-PR27375-PR27434-Recognize-new-DWARF5-sections-.debug.patch
URL: <https://sourceware.org/pipermail/dwz/attachments/20210516/e1ba13c8/attachment-0001.obj>

More information about the Dwz mailing list