1 ## Check how llvm-readelf prints sections to segments mapping.
3 ## Check that --section-mapping produces a sections to segments
4 ## mapping and not anything else.
5 # RUN: yaml2obj %s -o %t64.elf
6 # RUN: llvm-readelf --section-mapping %t64.elf \
7 # RUN: | FileCheck %s --check-prefix=MAPPING --strict-whitespace --match-full-lines --implicit-check-not={{.}}
9 # MAPPING: Section to Segment mapping:
10 # MAPPING-NEXT: Segment Sections...
11 # MAPPING-NEXT: 00 .foo.begin .foo.end {{$}}
12 # MAPPING-NEXT: 01 .bar.begin .bar.end {{$}}
13 # MAPPING-NEXT: None .strtab .shstrtab {{$}}
20 EPhEntSize: [[PHENTSIZE=<none>]]
41 ## Case 1: an arbitrary segment with sections.
47 ## Case 2: another segment with different sections.
54 ## Check that --section-mapping=false --program-headers produces just program headers.
55 # RUN: llvm-readelf --section-mapping=false --program-headers %t64.elf \
56 # RUN: | FileCheck %s --check-prefix=SEC-MAPPING-FALSE --implicit-check-not="Section to Segment mapping:"
58 # SEC-MAPPING-FALSE: Program Headers:
60 ## Check that only one copy of the section/segment mapping table is produced
61 ## when both --section-mapping and --program-headers are used.
62 # RUN: llvm-readelf --section-mapping --program-headers %t64.elf \
63 # RUN: | FileCheck %s --check-prefix=MAPPING --implicit-check-not="Section to Segment mapping:"
65 ## Check the output when an object has no section headers.
66 ## RUN: llvm-objcopy --strip-sections %t64.elf %tno-shdrs.o
67 ## RUN: llvm-readelf --section-mapping %tno-shdrs.o | FileCheck %s --check-prefix=NO-SECHDRS
69 # NO-SECHDRS: Section to Segment mapping:
70 # NO-SECHDRS-NEXT: Segment Sections...
71 # NO-SECHDRS-NEXT: 00 {{$}}
72 # NO-SECHDRS-NEXT: 01 {{$}}
73 # NO-SECHDRS-NOT: {{.}}
75 ## Check we report a warning when we are unable to read program headers.
76 # RUN: yaml2obj %s -DPHENTSIZE=1 -o %t64-err1.elf
77 # RUN: llvm-readelf --section-mapping %t64-err1.elf 2>&1 | \
78 # RUN: FileCheck %s -DFILE=%t64-err1.elf --check-prefix=PHENTSIZE
80 # PHENTSIZE: Section to Segment mapping:
81 # PHENTSIZE-NEXT: Segment Sections...
82 # PHENTSIZE-NEXT: warning: '[[FILE]]': can't read program headers to build section to segment mapping: invalid e_phentsize: 1