[PATCH] D91404: RFC: [ELF] Add --dwarf32-before-dwarf64 to place DWARF32 input sections before DWARF64

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 16:53:41 PST 2020


ayermolo added a comment.

In D91404#2394228 <https://reviews.llvm.org/D91404#2394228>, @MaskRay wrote:

> In D91404#2393750 <https://reviews.llvm.org/D91404#2393750>, @avl wrote:
>
>>> Well, this is a bit different from my original idea but is an overall good heuristic for many of the debug sections. It works for .debug_info, which is one of the biggest sections; it does not work for .debug_line, though, which is not that big as .debug_info, but potentially might become problematic in the (distant) future; it also does not work for .debug_abbrev, .debug_addr, .debug_ranges, and some others, which are usually not that big. However, the patch should be extended to support .debug_str, which can be even larger than .debug_info.
>>
>> Would it be useful if decision done for the debug_info section would also be applied to all other debug sections from the same object file?
>
>
>
> In D91404#2393718 <https://reviews.llvm.org/D91404#2393718>, @ikudrin wrote:
>
>> Well, this is a bit different from my original idea but is an overall good heuristic for many of the debug sections. It works for `.debug_info`, which is one of the biggest sections; it does not work for `.debug_line`, though, which is not that big as `.debug_info`, but potentially might become problematic in the (distant) future; it also does not work for `.debug_abbrev`, `.debug_addr`, `.debug_ranges`, and some others, which are usually not that big. However, the patch should be extended to support `.debug_str`, which can be even larger than `.debug_info`.
>
> We either mark `InputFile` or `InputSectionBase` referenced by a 64-bit absolute relocation. I prefer `InputBaseBase` which is more direct (we have spare bits in SectionBase after `keepUnique`).
>
> DWARF v4 `.debug_str` is referenced by `.debug_info`'s non-first relocation. The `InputSectionBase` based referenced bit approach does not work. So maybe we have to use `InputFile`.

If I understand this correctly if we store some kind of DWARF64 flag in InputFile, we can still use firstReloc approach. 
The assumption is that all the input sections within the file will have the same DWARF pointer width.
Otherwise we have to scan all the relocs and mark corresponding sections where Symbol is pointing as DWARF64.
Correct?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91404/new/

https://reviews.llvm.org/D91404



More information about the llvm-commits mailing list