1 ## In this test case we check how we print section and flag descriptions for different targets.
3 ## EM_NONE is a target that does not have any processor and OS specific flags,
4 ## we use it to show how the default flag key is printed.
6 # RUN: yaml2obj -DBITS=32 %s -o %t-default.o
7 # RUN: llvm-readelf -S %t-default.o | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines
9 # ELF32:There are 9 section headers, starting at offset 0x9c:
11 # ELF32-NEXT:Section Headers:
12 # ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
13 # ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
14 # ELF32-NEXT: [ 1] .text PROGBITS 00000000 000034 000001 00 AX 0 0 4
15 # ELF32-NEXT: [ 2] .rel.text REL 00000000 000038 000000 08 6 1 4
16 # ELF32-NEXT: [ 3] .rela.text RELA 00000000 000038 000000 18 6 1 8
17 # ELF32-NEXT: [ 4] .data PROGBITS 00000000 000038 000000 00 WA 0 0 4
18 # ELF32-NEXT: [ 5] .bss NOBITS 00000000 000038 000000 00 WA 0 0 4
19 # ELF32-NEXT: [ 6] .symtab SYMTAB 00000000 000038 000020 10 7 2 8
20 # ELF32-NEXT: [ 7] .strtab STRTAB 00000000 000058 000007 00 0 0 1
21 # ELF32-NEXT: [ 8] .shstrtab STRTAB 00000000 00005f 00003b 00 0 0 1
22 # ELF32-NEXT:Key to Flags:
23 # ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
24 # ELF32-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
25 # ELF32-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
26 # ELF32-NEXT: R (retain), p (processor specific)
30 Class: ELFCLASS[[BITS=64]]
34 Machine: [[MACHINE=EM_NONE]]
38 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
39 AddressAlign: 0x0000000000000004
44 AddressAlign: 0x0000000000000004
45 EntSize: 0x0000000000000008
51 AddressAlign: 0x0000000000000008
52 EntSize: 0x0000000000000018
57 Flags: [ SHF_WRITE, SHF_ALLOC ]
58 AddressAlign: 0x0000000000000004
62 Flags: [ SHF_WRITE, SHF_ALLOC ]
63 AddressAlign: 0x0000000000000004
69 ## For an EM_X86_64 target we print "l" for the SHF_X86_64_LARGE section flag.
70 ## Check we mention it in the flag key.
72 # RUN: yaml2obj -DMACHINE=EM_X86_64 %s -o %t-x64.o
73 # RUN: llvm-readelf -S %t-x64.o | FileCheck %s --check-prefix=ELF64 --strict-whitespace --match-full-lines
75 ## Check that --wide is the same as -W and ignored and also
76 ## that --section is the same as -S.
77 # RUN: llvm-readobj --wide --sections %t-x64.o --elf-output-style=GNU \
78 # RUN: | FileCheck %s --check-prefix=ELF64
79 # RUN: llvm-readobj -W --sections %t-x64.o --elf-output-style=GNU \
80 # RUN: | FileCheck %s --check-prefix=ELF64
81 # RUN: llvm-readelf -W -S %t-x64.o | FileCheck %s --check-prefix=ELF64
83 # ELF64:There are 9 section headers, starting at offset 0xc0:
85 # ELF64-NEXT:Section Headers:
86 # ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
87 # ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
88 # ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 000001 00 AX 0 0 4
89 # ELF64-NEXT: [ 2] .rel.text REL 0000000000000000 000044 000000 08 6 1 4
90 # ELF64-NEXT: [ 3] .rela.text RELA 0000000000000000 000048 000000 18 6 1 8
91 # ELF64-NEXT: [ 4] .data PROGBITS 0000000000000000 000048 000000 00 WA 0 0 4
92 # ELF64-NEXT: [ 5] .bss NOBITS 0000000000000000 000048 000000 00 WA 0 0 4
93 # ELF64-NEXT: [ 6] .symtab SYMTAB 0000000000000000 000048 000030 18 7 2 8
94 # ELF64-NEXT: [ 7] .strtab STRTAB 0000000000000000 000078 000007 00 0 0 1
95 # ELF64-NEXT: [ 8] .shstrtab STRTAB 0000000000000000 00007f 00003b 00 0 0 1
96 # ELF64-NEXT:Key to Flags:
97 # ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
98 # ELF64-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
99 # ELF64-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
100 # ELF64-NEXT: R (retain), l (large), p (processor specific)
102 ## For an EM_ARM target we print "y" for the SHF_ARM_PURECODE section flag.
103 ## Check we mention it in the flag key.
105 # RUN: yaml2obj -DMACHINE=EM_ARM %s -o %t-arm.o
106 # RUN: llvm-readelf -S %t-arm.o | FileCheck %s --check-prefix=ARM --strict-whitespace --match-full-lines
109 # ARM-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
110 # ARM-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
111 # ARM-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
112 # ARM-NEXT: R (retain), y (purecode), p (processor specific)