[clang] [lld] [llvm] [DebugInfo][LLD] Use SHT_DWARF64 for lld DWARF32/DWARF64 debug section ordering (PR #206690)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 02:33:59 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h,c -- clang/test/CodeGen/debug-info-dwarf64-section-type.c clang/tools/driver/cc1as_main.cpp lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/InputFiles.cpp lld/ELF/OutputSections.cpp llvm/include/llvm/BinaryFormat/ELF.h llvm/include/llvm/MC/MCObjectFileInfo.h llvm/include/llvm/MC/MCSectionELF.h llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/lib/MC/MCAsmInfoELF.cpp llvm/lib/MC/MCObjectFileInfo.cpp llvm/lib/MC/MCParser/ELFAsmParser.cpp llvm/lib/Object/ELF.cpp llvm/lib/ObjectYAML/ELFYAML.cpp llvm/tools/llvm-mc/llvm-mc.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 26d22c76e..ac9c9001e 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -3246,10 +3246,9 @@ partitionDwarf32AndDwarf64(ArrayRef<InputSectionDescription *> isds) {
if (sections.empty())
return;
- std::stable_partition(sections.begin(), sections.end(),
- [](InputSectionBase *sec) {
- return sec->type != SHT_DWARF64;
- });
+ std::stable_partition(
+ sections.begin(), sections.end(),
+ [](InputSectionBase *sec) { return sec->type != SHT_DWARF64; });
auto it = sections.begin();
for (InputSectionDescription *isd : isds) {
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 7fa94da2f..2db8fb0e1 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -236,8 +236,7 @@ void OutputSection::finalizeInputSections() {
// Keep DWARF32 and DWARF64 debug sections in separate buckets.
return sec->flags == ms->flags && sec->entsize == ms->entsize &&
(!s->name.starts_with(".debug_") || sec->type == ms->type) &&
- (sec->addralign == ms->addralign ||
- !(sec->flags & SHF_STRINGS));
+ (sec->addralign == ms->addralign || !(sec->flags & SHF_STRINGS));
});
if (i == mergeSections.end()) {
MergeSyntheticSection *syn = createMergeSynthetic(
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index f0bedd42d..d2909dad2 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -67,19 +67,23 @@ void MCObjectFileInfo::setELFDwarf64Sections() {
if (Ctx->getObjectFileType() != MCContext::IsELF)
return;
- for (MCSection *Sec :
- {DwarfAbbrevSection, DwarfInfoSection, DwarfLineSection,
- DwarfLineStrSection, DwarfFrameSection, DwarfPubNamesSection,
- DwarfPubTypesSection, DwarfGnuPubNamesSection,
- DwarfGnuPubTypesSection, DwarfStrSection, DwarfLocSection,
- DwarfARangesSection, DwarfRangesSection, DwarfMacinfoSection,
- DwarfMacroSection, DwarfDebugNamesSection, DwarfStrOffSection,
- DwarfAddrSection, DwarfRnglistsSection, DwarfLoclistsSection,
- DwarfInfoDWOSection, DwarfTypesDWOSection, DwarfAbbrevDWOSection,
- DwarfStrDWOSection, DwarfLineDWOSection, DwarfLocDWOSection,
- DwarfStrOffDWOSection, DwarfRnglistsDWOSection,
- DwarfMacinfoDWOSection, DwarfMacroDWOSection,
- DwarfLoclistsDWOSection, DwarfCUIndexSection, DwarfTUIndexSection})
+ for (MCSection *Sec : {DwarfAbbrevSection, DwarfInfoSection,
+ DwarfLineSection, DwarfLineStrSection,
+ DwarfFrameSection, DwarfPubNamesSection,
+ DwarfPubTypesSection, DwarfGnuPubNamesSection,
+ DwarfGnuPubTypesSection, DwarfStrSection,
+ DwarfLocSection, DwarfARangesSection,
+ DwarfRangesSection, DwarfMacinfoSection,
+ DwarfMacroSection, DwarfDebugNamesSection,
+ DwarfStrOffSection, DwarfAddrSection,
+ DwarfRnglistsSection, DwarfLoclistsSection,
+ DwarfInfoDWOSection, DwarfTypesDWOSection,
+ DwarfAbbrevDWOSection, DwarfStrDWOSection,
+ DwarfLineDWOSection, DwarfLocDWOSection,
+ DwarfStrOffDWOSection, DwarfRnglistsDWOSection,
+ DwarfMacinfoDWOSection, DwarfMacroDWOSection,
+ DwarfLoclistsDWOSection, DwarfCUIndexSection,
+ DwarfTUIndexSection})
static_cast<MCSectionELF *>(Sec)->setType(ELF::SHT_DWARF64);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/206690
More information about the cfe-commits
mailing list