[PATCH] D85006: [DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 07:08:27 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d8ca4ae2b1a: [DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0. (authored by Higuoxing).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85006/new/
https://reviews.llvm.org/D85006
Files:
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml
@@ -669,3 +669,67 @@
- Lists:
- Entries: []
Content: ''
+
+## u) Test that when the "OffsetEntryCount" is specified to be 0 and "Offsets" is not specified,
+## the offsets array is not emitted.
+
+# RUN: yaml2obj --docnum=19 -DENTRYCOUNT=0 %s -o %t19.o
+# RUN: llvm-readelf --hex-dump=.debug_rnglists %t19.o | \
+# RUN: FileCheck %s --check-prefix=NO-OFFSETS
+
+# NO-OFFSETS: Hex dump of section '.debug_rnglists':
+# NO-OFFSETS-NEXT: 0x00000000 0e000000 05000800 00000000 02010202 ................
+## ^------- offset_entry_count (4-byte)
+## ^- DW_RLE_startx_endx
+## ^- operands[0] (ULEB128) 0x01
+## ^- operands[1] (ULEB128) 0x02
+## ^- DW_RLE_startx_endx
+# NO-OFFSETS-NEXT: 0x00000010 0102 ..
+## ^- operands[0] (ULEB128) 0x01
+## ^- operands[1] (ULEB128) 0x02
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+DWARF:
+ debug_rnglists:
+ - OffsetEntryCount: [[ENTRYCOUNT=<none>]]
+ Offsets: [[OFFSETS=<none>]]
+ Lists:
+ - Entries:
+ - Operator: DW_RLE_startx_endx
+ Values: [ 0x01, 0x02 ]
+ - Entries:
+ - Operator: DW_RLE_startx_endx
+ Values: [ 0x01, 0x02 ]
+
+## v) Test that when the "Offsets" entry is specified to be empty and the "OffsetEntryCount" is not specified,
+## the offsets array will be omitted.
+
+# RUN: yaml2obj --docnum=19 -DOFFSETS=[] %s -o %t20.o
+# RUN: llvm-readelf --hex-dump=.debug_rnglists %t20.o | \
+# RUN: FileCheck %s --check-prefix=NO-OFFSETS
+
+## w) Test that if "Offsets" is specified, the offsets array will be emitted accordingly, even when
+## the "OffsetEntryCount" is specified to be 0.
+
+# RUN: yaml2obj --docnum=19 -DOFFSETS=[0x01,0x02,0x03] -DENTRYCOUNT=0 %s -o %t21.o
+# RUN: llvm-readelf --hex-dump=.debug_rnglists %t21.o | \
+# RUN: FileCheck %s --check-prefix=OFFSETS
+
+# OFFSETS: Hex dump of section '.debug_rnglists':
+# OFFSETS-NEXT: 0x00000000 0e000000 05000800 00000000 01000000 ................
+## ^------- offset_entry_count (4-byte)
+## ^------- offsets[0] (4-byte)
+# OFFSETS-NEXT: 0x00000010 02000000 03000000 02010202 0102 ..............
+## ^------- offsets[1] (4-byte)
+## ^------- offsets[2] (4-byte)
+## ^- DW_RLE_startx_endx
+## ^- operands[0] (ULEB128) 0x01
+## ^- operands[1] (ULEB128) 0x02
+## ^- DW_RLE_startx_endx
+## ^- operands[0] (ULEB128) 0x01
+## ^- operands[1] (ULEB128) 0x02
Index: llvm/lib/ObjectYAML/DWARFEmitter.cpp
===================================================================
--- llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -749,7 +749,7 @@
EmitOffsets(ArrayRef<uint64_t>((const uint64_t *)Table.Offsets->data(),
Table.Offsets->size()),
0);
- else
+ else if (OffsetEntryCount != 0)
EmitOffsets(Offsets, OffsetsSize);
OS.write(ListBuffer.data(), ListBuffer.size());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85006.282613.patch
Type: text/x-patch
Size: 4221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200803/c12b1d37/attachment.bin>
More information about the llvm-commits
mailing list