aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/ObjectYAML/MachO
diff options
context:
space:
mode:
authorXing GUO <higuoxing@gmail.com>2020-07-31 12:56:10 +0800
committerXing GUO <higuoxing@gmail.com>2020-07-31 20:18:53 +0800
commit74b02d73e34278e081dcb4946d66b9562f0986fe (patch)
tree10320faba4ef11858d7d7059a9723b44416a4d8d /llvm/test/ObjectYAML/MachO
parent760e4f22027ca1d609d21d220a28661ab091eb29 (diff)
downloadllvm-74b02d73e34278e081dcb4946d66b9562f0986fe.zip
llvm-74b02d73e34278e081dcb4946d66b9562f0986fe.tar.gz
llvm-74b02d73e34278e081dcb4946d66b9562f0986fe.tar.bz2
[DWARFYAML] Make the debug_aranges entry optional.
This patch makes the 'debug_aranges' entry optional. If the entry is empty, yaml2obj will only emit the header for it. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D84921
Diffstat (limited to 'llvm/test/ObjectYAML/MachO')
-rw-r--r--llvm/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml67
1 files changed, 66 insertions, 1 deletions
diff --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml b/llvm/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml
index ecdd88a..1e9b880 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml
@@ -1,4 +1,7 @@
-# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+## a) Test that yaml2macho is able to emit the .debug_aranges section and obj2yaml
+## is able to convert it back.
+
+# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s
--- !mach-o
FileHeader:
@@ -331,3 +334,65 @@ DWARF:
# CHECK-NEXT: Descriptors:
# CHECK-NEXT: - Address: 0x0000000100000F50
# CHECK-NEXT: Length: 52
+
+## b) Test that if the "debug_aranges" entry is empty, yaml2macho will only emit the
+## section header.
+
+# RUN: yaml2obj --docnum=2 %s -o %t2.o
+# RUN: llvm-readobj --sections --section-data %t2.o | FileCheck %s --check-prefix=EMPTY-SECTION
+
+# EMPTY-SECTION: Index: 0
+# EMPTY-SECTION-NEXT: Name: __debug_aranges (5F 5F 64 65 62 75 67 5F 61 72 61 6E 67 65 73 00)
+# EMPTY-SECTION-NEXT: Segment: __DWARF (5F 5F 44 57 41 52 46 00 00 00 00 00 00 00 00 00)
+# EMPTY-SECTION-NEXT: Address: 0x0
+# EMPTY-SECTION-NEXT: Size: 0xC
+# EMPTY-SECTION-NEXT: Offset: 528
+# EMPTY-SECTION-NEXT: Alignment: 0
+# EMPTY-SECTION-NEXT: RelocationOffset: 0x0
+# EMPTY-SECTION-NEXT: RelocationCount: 0
+# EMPTY-SECTION-NEXT: Type: Regular (0x0)
+# EMPTY-SECTION-NEXT: Attributes [ (0x0)
+# EMPTY-SECTION-NEXT: ]
+# EMPTY-SECTION-NEXT: Reserved1: 0x0
+# EMPTY-SECTION-NEXT: Reserved2: 0x0
+# EMPTY-SECTION-NEXT: Reserved3: 0x0
+# EMPTY-SECTION-NEXT: SectionData (
+# EMPTY-SECTION-NEXT: )
+
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x01000007
+ cpusubtype: 0x00000003
+ filetype: 0x0000000A
+ ncmds: 1
+ sizeofcmds: 232
+ flags: 0x00000000
+ reserved: 0x00000000
+LoadCommands:
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DWARF
+ vmaddr: 0x00
+ vmsize: 0x00
+ fileoff: 0x00
+ filesize: 0x00
+ maxprot: 0
+ initprot: 0
+ nsects: 1
+ flags: 0
+ Sections:
+ - sectname: __debug_aranges
+ segname: __DWARF
+ addr: 0x00
+ size: 12
+ offset: 528
+ align: 0
+ reloff: 0x00000000
+ nreloc: 0
+ flags: 0x00000000
+ reserved1: 0x00000000
+ reserved2: 0x00000000
+ reserved3: 0x00000000
+DWARF:
+ debug_aranges: []