This patch adds two new tests for edge-case behaviour for --section-
mapping, namely when there are no program headers, and when there are no
section headers.
Reviewed by: mattd
Differential Revision: https://reviews.llvm.org/D58456
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354484
91177308-0d34-0410-b5e6-
96231b3b80d8
--- /dev/null
+RUN: llvm-readelf --section-mapping %p/Inputs/trivial.obj.elf-x86-64 | FileCheck %s
+CHECK: Section to Segment mapping:
+CHECK-NEXT: Segment Sections...
+CHECK-NEXT: None .text .rela.text .data .bss .rodata.str1.1 .note.GNU-stack .shstrtab .symtab .strtab {{$}}
+CHECK-NOT: {{.}}
--- /dev/null
+RUN: llvm-objcopy --strip-sections %p/Inputs/phdrs-elf.exe-x86_64 %t.o
+RUN: llvm-readelf --section-mapping %t.o | FileCheck %s
+CHECK: Section to Segment mapping:
+CHECK-NEXT: Segment Sections...
+CHECK-NEXT: 00 {{$}}
+CHECK-NEXT: 01 {{$}}
+CHECK-NEXT: 02 {{$}}
+CHECK-NEXT: 03 {{$}}
+CHECK-NEXT: 04 {{$}}
+CHECK-NEXT: 05 {{$}}
+CHECK-NEXT: 06 {{$}}
+CHECK-NEXT: 07 {{$}}
+CHECK-NEXT: 08 {{$}}
+CHECK-NEXT: 09 {{$}}
+CHECK-NOT: {{.}}