[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
[llvm-complete.git] / test / tools / llvm-objdump / section-filter.test
blob6a93856d13b619af2d6124d6b8927aee19d9f75d
1 ## Test that --section works correctly for -h.
2 ## We test the LMA here too, because the code at the time of writing uses the 
3 ## value of --section when looking up section LMAs.
4 # RUN: yaml2obj %s --docnum=1 -o %t.h.elf
5 # RUN: llvm-objdump -h %t.h.elf -j=.text --section=.bss \
6 # RUN:   | FileCheck %s --check-prefix=SHDRS --implicit-check-not=.data --implicit-check-not=.text2
8 # SHDRS: Name  Size     VMA              LMA
9 # SHDRS: .text 00000001 0000000000000400 0000000000001000
10 # SHDRS: .bss  00000001 0000000000000420 0000000000003000
12 --- !ELF
13 FileHeader:
14   Class:   ELFCLASS64
15   Data:    ELFDATA2LSB
16   Type:    ET_EXEC
17   Machine: EM_X86_64
18 Sections:
19   - Name:         .text
20     Type:         SHT_PROGBITS
21     Flags:        [SHF_ALLOC, SHF_EXECINSTR]
22     Address:      0x400
23     AddressAlign: 0x10
24     Content:      'c3'
25   - Name:         .text2
26     Type:         SHT_PROGBITS
27     Flags:        [SHF_ALLOC, SHF_EXECINSTR]
28     Address:      0x401
29     Content:      '90'
30   - Name:         .data
31     Type:         SHT_PROGBITS
32     Flags:        [SHF_ALLOC, SHF_WRITE]
33     Address:      0x410
34     AddressAlign: 0x10
35     Content:      '42'
36   - Name:         .bss
37     Type:         SHT_NOBITS
38     Flags:        [SHF_ALLOC, SHF_WRITE]
39     Address:      0x420
40     AddressAlign: 0x10
41     Size:         1
42 ProgramHeaders:
43   - Type:  PT_LOAD
44     VAddr: 0x400
45     PAddr: 0x1000
46     Sections:
47       - Section: .text
48       - Section: .text2
49   - Type:  PT_LOAD
50     VAddr: 0x410
51     PAddr: 0x2000
52     Sections:
53       - Section: .data
54   - Type:  PT_LOAD
55     VAddr: 0x420
56     PAddr: 0x3000
57     Sections:
58       - Section: .bss
60 ## Test that --section works with --fault-map-section.
61 # RUN: yaml2obj %s --docnum=2 -o %t.o
62 # RUN: llvm-objdump %t.o --fault-map-section -j __clangast \
63 # RUN:   | FileCheck %s --check-prefixes=FAULTMAP,NO-FAULTMAP
64 # RUN: llvm-objdump %t.o --fault-map-section -j .llvm_faultmaps \
65 # RUN:   | FileCheck %s --check-prefixes=FAULTMAP,WITH-FAULTMAP
67 # FAULTMAP:           FaultMap table:
68 # NO-FAULTMAP-NEXT:   <not found>
69 # WITH-FAULTMAP-NEXT: Version: 0x1
70 # WITH-FAULTMAP-NEXT: NumFunctions: 0
72 ## Test that --section works with --raw-clang-ast.
73 # RUN: llvm-objdump %t.o --raw-clang-ast -j .llvm_faultmaps \
74 # RUN:   | FileCheck %s --check-prefix=NO-AST --allow-empty
75 # RUN: llvm-objdump %t.o --raw-clang-ast -j __clangast \
76 # RUN:   | FileCheck %s --check-prefix=CLANG-AST
78 # NO-AST-NOT: {{.}}
79 # CLANG-AST: foobar
81 --- !ELF
82 FileHeader:
83   Class:   ELFCLASS64
84   Data:    ELFDATA2LSB
85   Type:    ET_REL
86   Machine: EM_X86_64
87 Sections:
88   - Name:    .llvm_faultmaps
89     Type:    SHT_PROGBITS
90     Content: '0100000000000000'
91   - Name:    __clangast
92     Type:    SHT_PROGBITS
93     Content: '666f6f626172' # "foobar"
95 ## Test that the -j alias can be used flexibly. Create a baseline and ensure
96 ## all other combinations are identical.
97 # RUN: llvm-objdump %t.h.elf -h -s --section .symtab > %t.full
98 # RUN: llvm-objdump %t.h.elf -h -s -j .symtab > %t.1
99 # RUN: llvm-objdump %t.h.elf -h -s -j=.symtab > %t.2
100 # RUN: llvm-objdump %t.h.elf -h -s -j.symtab > %t.3
101 # RUN: llvm-objdump %t.h.elf -hsj .symtab > %t.4
102 # RUN: llvm-objdump %t.h.elf -hsj=.symtab > %t.5
103 # RUN: llvm-objdump %t.h.elf -hsj.symtab > %t.6
105 # RUN: cmp %t.full %t.1
106 # RUN: cmp %t.full %t.2
107 # RUN: cmp %t.full %t.3
108 # RUN: cmp %t.full %t.4
109 # RUN: cmp %t.full %t.5
110 # RUN: cmp %t.full %t.6
112 ## Test that an unknown section name causes all section output to be suppressed.
113 # RUN: llvm-objdump %t.h.elf -h --section foobar \
114 # RUN:   | FileCheck %s --check-prefix=NO-SECTION
116 # NO-SECTION:      Sections:
117 # NO-SECTION-NEXT: Idx Name Size VMA Type
118 # NO-SECTION-NOT:  {{.}}