Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-xray / ARM / extract-instrmap.test
blob334c3e6104288a8c45c54b1757aa8103bbed42dd
1 ## This test makes sure we can extract the instrumentation map from an
2 ## XRay-instrumented PIE file.
4 ## Generated from the following source:
5 ## __attribute__((xray_always_instrument)) void foo() {}
6 ## __attribute__((xray_always_instrument)) void bar() {}
7 ## __attribute__((xray_always_instrument)) void jar() {}
8 ## Built with the following arguments:
9 ## -target armv7a-linux-androideabi -nostdlib -fxray-instrument -fPIC -shared
11 --- !ELF
12 FileHeader:
13   Class:           ELFCLASS32
14   Data:            ELFDATA2LSB
15   Type:            ET_DYN
16   Machine:         EM_ARM
17   Flags:           [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ]
18   Entry:           0x00000000000012B0
19 ProgramHeaders:
20   - Type:     PT_LOAD
21     Flags:    [ PF_R ]
22     FirstSec: .rel.dyn
23     LastSec:  .rel.dyn
24     Align:    0x0000000000001000
25   - Type:     PT_LOAD
26     Flags:    [ PF_X, PF_R ]
27     FirstSec: .text
28     LastSec:  .text
29     VAddr:    0x00000000000012B0
30     Align:    0x0000000000001000
31   - Type:     PT_LOAD
32     Flags:    [ PF_W, PF_R ]
33     FirstSec: xray_instr_map
34     LastSec:  xray_fn_idx
35     VAddr:    0x00000000000033CC
36     Align:    0x0000000000001000
37 Sections:
38   - Name:            .rel.dyn
39     Type:            SHT_REL
40     Flags:           [ SHF_ALLOC ]
41     Address:         0x0000000000000200
42     Link:            .dynsym
43     AddressAlign:    0x0000000000000004
44     Relocations:
45       - Offset:          0x00000000000033CC
46         Type:            R_ARM_RELATIVE
47       - Offset:          0x00000000000033DC
48         Type:            R_ARM_RELATIVE
49       - Offset:          0x00000000000033EC
50         Type:            R_ARM_RELATIVE
51       - Offset:          0x00000000000033FC
52         Type:            R_ARM_RELATIVE
53       - Offset:          0x000000000000340C
54         Type:            R_ARM_RELATIVE
55       - Offset:          0x000000000000341C
56         Type:            R_ARM_RELATIVE
57       - Offset:          0x0000000000003430
58         Type:            R_ARM_RELATIVE
59       - Offset:          0x0000000000003434
60         Type:            R_ARM_RELATIVE
61       - Offset:          0x0000000000003438
62         Type:            R_ARM_RELATIVE
63       - Offset:          0x000000000000343C
64         Type:            R_ARM_RELATIVE
65       - Offset:          0x0000000000003440
66         Type:            R_ARM_RELATIVE
67       - Offset:          0x0000000000003444
68         Type:            R_ARM_RELATIVE
69       - Offset:          0x00000000000033F0
70         Symbol:          _Z3barv
71         Type:            R_ARM_ABS32
72       - Offset:          0x0000000000003400
73         Symbol:          _Z3barv
74         Type:            R_ARM_ABS32
75       - Offset:          0x00000000000033D0
76         Symbol:          _Z3foov
77         Type:            R_ARM_ABS32
78       - Offset:          0x00000000000033E0
79         Symbol:          _Z3foov
80         Type:            R_ARM_ABS32
81       - Offset:          0x0000000000003410
82         Symbol:          _Z3jarv
83         Type:            R_ARM_ABS32
84       - Offset:          0x0000000000003420
85         Symbol:          _Z3jarv
86         Type:            R_ARM_ABS32
87   - Name:            .text
88     Type:            SHT_PROGBITS
89     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
90     Address:         0x00000000000012B0
91     AddressAlign:    0x0000000000000004
92     Size:            180
93   - Name:            xray_instr_map
94     Type:            SHT_PROGBITS
95     Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_LINK_ORDER ]
96     Address:         0x00000000000033CC
97     Link:            .text
98     AddressAlign:    0x0000000000000001
99     Content:         B0120000000000000001000000000000CC120000000000000101000000000000EC120000000000000001000000000000081300000000000001010000000000002813000000000000000100000000000044130000000000000101000000000000
100   - Name:            xray_fn_idx
101     Type:            SHT_PROGBITS
102     Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_LINK_ORDER ]
103     Address:         0x0000000000003430
104     Link:            .text
105     AddressAlign:    0x0000000000000008
106     Content:         CC330000EC330000EC3300000C3400000C3400002C340000
107 DynamicSymbols:
108   - Name:            _Z3barv
109     Type:            STT_FUNC
110     Section:         .text
111     Binding:         STB_GLOBAL
112     Value:           0x00000000000012EC
113     Size:            0x000000000000003C
114   - Name:            _Z3foov
115     Type:            STT_FUNC
116     Section:         .text
117     Binding:         STB_GLOBAL
118     Value:           0x00000000000012B0
119     Size:            0x000000000000003C
120   - Name:            _Z3jarv
121     Type:            STT_FUNC
122     Section:         .text
123     Binding:         STB_GLOBAL
124     Value:           0x0000000000001328
125     Size:            0x000000000000003C
128 # RUN: yaml2obj %s -o %t.so
129 # RUN: llvm-xray extract %t.so -s | FileCheck %s
131 # CHECK:      ---
132 # CHECK-NEXT: - { id: 1, address: 0x12B0, function: 0x12B0, kind: function-enter, always-instrument: true, function-name: 'foo()' }
133 # CHECK-NEXT: - { id: 1, address: 0x12CC, function: 0x12B0, kind: function-exit, always-instrument: true, function-name: 'foo()' }
134 # CHECK-NEXT: - { id: 2, address: 0x12EC, function: 0x12EC, kind: function-enter, always-instrument: true, function-name: 'bar()' }
135 # CHECK-NEXT: - { id: 2, address: 0x1308, function: 0x12EC, kind: function-exit, always-instrument: true, function-name: 'bar()' }
136 # CHECK-NEXT: - { id: 3, address: 0x1328, function: 0x1328, kind: function-enter, always-instrument: true, function-name: 'jar()' }
137 # CHECK-NEXT: - { id: 3, address: 0x1344, function: 0x1328, kind: function-exit, always-instrument: true, function-name: 'jar()' }
138 # CHECK-NEXT: ...
140 # RUN: llvm-xray extract -s --no-demangle %t.so | FileCheck --check-prefix=MANGLED %s
142 # MANGLED:      ---
143 # MANGLED-NEXT: - { id: 1, address: 0x12B0, function: 0x12B0, kind: function-enter, always-instrument: true, function-name: _Z3foov }
144 # MANGLED-NEXT: - { id: 1, address: 0x12CC, function: 0x12B0, kind: function-exit, always-instrument: true, function-name: _Z3foov }
145 # MANGLED-NEXT: - { id: 2, address: 0x12EC, function: 0x12EC, kind: function-enter, always-instrument: true, function-name: _Z3barv }
146 # MANGLED-NEXT: - { id: 2, address: 0x1308, function: 0x12EC, kind: function-exit, always-instrument: true, function-name: _Z3barv }
147 # MANGLED-NEXT: - { id: 3, address: 0x1328, function: 0x1328, kind: function-enter, always-instrument: true, function-name: _Z3jarv }
148 # MANGLED-NEXT: - { id: 3, address: 0x1344, function: 0x1328, kind: function-exit, always-instrument: true, function-name: _Z3jarv }
149 # MANGLED-NEXT: ...