[PATCH] D87205: [DWARFYAML] Make the debug_addr section optional.
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 01:02:41 PDT 2020
Higuoxing updated this revision to Diff 290196.
Higuoxing marked an inline comment as done.
Higuoxing added a comment.
Address review comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87205/new/
https://reviews.llvm.org/D87205
Files:
llvm/include/llvm/ObjectYAML/DWARFYAML.h
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/ObjectYAML/DWARFYAML.cpp
llvm/test/tools/yaml2obj/ELF/DWARF/debug-addr.yaml
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-addr.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-addr.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-addr.yaml
@@ -631,3 +631,18 @@
[[SIZENAME]]: 3
Entries:
- Address: 0x1234
+
+## n) Test that the .debug_addr section header is emitted if the "debug_addr"
+## entry is empty.
+
+# RUN: yaml2obj --docnum=12 %s -o %t12.o
+# RUN: llvm-readobj --sections %t12.o | \
+# RUN: FileCheck %s -DSIZE=0 -DADDRALIGN=1 --check-prefix=SHDR
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+DWARF:
+ debug_addr: []
Index: llvm/lib/ObjectYAML/DWARFYAML.cpp
===================================================================
--- llvm/lib/ObjectYAML/DWARFYAML.cpp
+++ llvm/lib/ObjectYAML/DWARFYAML.cpp
@@ -32,7 +32,7 @@
SecNames.insert("debug_ranges");
if (!DebugLines.empty())
SecNames.insert("debug_line");
- if (!DebugAddr.empty())
+ if (DebugAddr)
SecNames.insert("debug_addr");
if (!DebugAbbrev.empty())
SecNames.insert("debug_abbrev");
Index: llvm/lib/ObjectYAML/DWARFEmitter.cpp
===================================================================
--- llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -594,7 +594,7 @@
}
Error DWARFYAML::emitDebugAddr(raw_ostream &OS, const Data &DI) {
- for (const AddrTableEntry &TableEntry : DI.DebugAddr) {
+ for (const AddrTableEntry &TableEntry : *DI.DebugAddr) {
uint8_t AddrSize;
if (TableEntry.AddrSize)
AddrSize = *TableEntry.AddrSize;
Index: llvm/include/llvm/ObjectYAML/DWARFYAML.h
===================================================================
--- llvm/include/llvm/ObjectYAML/DWARFYAML.h
+++ llvm/include/llvm/ObjectYAML/DWARFYAML.h
@@ -215,7 +215,7 @@
Optional<std::vector<StringOffsetsTable>> DebugStrOffsets;
Optional<std::vector<ARange>> DebugAranges;
std::vector<Ranges> DebugRanges;
- std::vector<AddrTableEntry> DebugAddr;
+ Optional<std::vector<AddrTableEntry>> DebugAddr;
Optional<PubSection> PubNames;
Optional<PubSection> PubTypes;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87205.290196.patch
Type: text/x-patch
Size: 2175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200907/240865f5/attachment.bin>
More information about the llvm-commits
mailing list