From 311ff227b4327ed76156ce8691f56f8b8e12bf49 Mon Sep 17 00:00:00 2001 From: Kai Luo Date: Fri, 10 Feb 2023 03:17:39 +0000 Subject: [PATCH] [DwarfGenerator] Emit dwarf address section when dwarf version is not less than 4 Some targets (like AIX) might not feature dwarf address section due to low dwarf version. Check before emitting one. Fixed DebugInfo unit test failures in https://lab.llvm.org/buildbot/#/builders/214/builds/5739. Reviewed By: qiucf Differential Revision: https://reviews.llvm.org/D143561 --- llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp index b683bfb..c5b9f5cf 100644 --- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp @@ -582,7 +582,8 @@ StringRef dwarfgen::Generator::generate() { StringPool->emit(*Asm, TLOF->getDwarfStrSection(), TLOF->getDwarfStrOffSection()); - AddressPool.emit(*Asm, TLOF->getDwarfAddrSection(), AddrTableStartSym); + if (Asm->getDwarfVersion() >= 5) + AddressPool.emit(*Asm, TLOF->getDwarfAddrSection(), AddrTableStartSym); MS->switchSection(TLOF->getDwarfInfoSection()); for (auto &CU : CompileUnits) { -- 2.7.4