This is an archive of the discontinued LLVM Phabricator instance.

[DWARF5] Replace emission of strp with stx forms in debug_macro section
ClosedPublic

Authored by SouraVX on Apr 25 2020, 10:06 AM.

Details

Summary

DW_MACRO_define_strx forms are supported now in llvm-dwarfdump and these forms can be used in both debug_macro[.dwo] sections. An added advantage for using strx forms over strp forms is that it uses indices approach instead of a relocation to debug_str section.
This patch unify the emission for debug_macro section.

Diff Detail

Event Timeline

SouraVX created this revision.Apr 25 2020, 10:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2020, 10:06 AM

This revision is parent of D78866.

What are the benefits of using STRX code in the non-DWO case?

What are the benefits of using STRX code in the non-DWO case?

I think having one form in both cases (split and non-split) simplifies the emission logic greatly. Otherwise we may have to carve out conditional emission that would be hard to maintain and extend.
Please share your opinion on this.

One more big win in non-DWO case is that switching to strx form will save a relocation per macro entry compared to the counter part strp form which uses relocation.

dblaikie accepted this revision.May 29 2020, 9:18 AM

Sounds good to me - thanks!

One more big win in non-DWO case is that switching to strx form will save a relocation per macro entry compared to the counter part strp form which uses relocation.

Unfortunately I don't think it will provide this benefit - since the str_offsets section will require a relocation for the string anyway. (& though if a macro string is used more than once (probably relatively rare, but not unheard of - def/undef around .def files more than once in the same .cpp file, etc) then strx will at least allow that string to only need one relocation rather than one per use)

But I think the greater benefit of consistency is worthwhile in any case.

This revision is now accepted and ready to land.May 29 2020, 9:18 AM
This revision was automatically updated to reflect the committed changes.