This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Fail when multiple .debug_* sections are used in a single object.
AbandonedPublic

Authored by grimar on Dec 7 2017, 4:39 AM.

Details

Summary

It is based on discussions in "[llvm-dev] [RFC] - Deduplication of debug information in linkers (LLD)." thread.
DWARF5 specification (http://dwarfstd.org/doc/DWARF5.pdf) mentions it can be one or more of debug sections.
For example:

  1. p366 says objects may have multiple .debug_abrev, .debug_info, .debug_line sections for DWARF elimination.
  2. p376 says multiple .debug_info section could be used for deduplication of type units.

It is unclear that we will want to support the optimizations above and in both cases LLD would work incorrectly now
(as we do not expect multiple of above sections) for cases when we are trying to work with DWARF sections.
It is error reporting case and --gdb-index generation case.
So for both safety and simplicity of implementation I suggest to error out when LLDDwarfObj meets object with
any multiple debug sections with the same name.

Diff Detail

Event Timeline

grimar created this revision.Dec 7 2017, 4:39 AM
grimar edited the summary of this revision. (Show Details)Dec 7 2017, 4:42 AM
grimar planned changes to this revision.Dec 8 2017, 12:03 AM

This would not work for case when we have multiple .debug_type sections,
though it is legal and already supported. I'll update patch with the testcase for that
(if approach chosen by this patch be approved during current discussion in mail list).

espindola edited reviewers, added: espindola; removed: rafael.Mar 14 2018, 4:54 PM
grimar abandoned this revision.Jul 30 2020, 1:44 AM

It is too old.