xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/reloc-types-i386.test (revision d9cf9bd4b3c30221a2ec348cdfb01a24d84927b6)
1## Test that llvm-readobj/llvm-readelf shows proper relocation type
2## names and values for i386 target.
3
4# RUN: yaml2obj %s -o %t-i386.o
5# RUN: llvm-readobj -r --expand-relocs %t-i386.o | FileCheck %s --check-prefix=LLVM
6# RUN: llvm-readelf -r --expand-relocs %t-i386.o | FileCheck %s --check-prefix=GNU
7
8# LLVM: Type: R_386_NONE (0)
9# LLVM: Type: R_386_32 (1)
10# LLVM: Type: R_386_PC32 (2)
11# LLVM: Type: R_386_GOT32 (3)
12# LLVM: Type: R_386_PLT32 (4)
13# LLVM: Type: R_386_COPY (5)
14# LLVM: Type: R_386_GLOB_DAT (6)
15# LLVM: Type: R_386_JUMP_SLOT (7)
16# LLVM: Type: R_386_RELATIVE (8)
17# LLVM: Type: R_386_GOTOFF (9)
18# LLVM: Type: R_386_GOTPC (10)
19# LLVM: Type: R_386_32PLT (11)
20# LLVM: Type: R_386_TLS_TPOFF (14)
21# LLVM: Type: R_386_TLS_IE (15)
22# LLVM: Type: R_386_TLS_GOTIE (16)
23# LLVM: Type: R_386_TLS_LE (17)
24# LLVM: Type: R_386_TLS_GD (18)
25# LLVM: Type: R_386_TLS_LDM (19)
26# LLVM: Type: R_386_16 (20)
27# LLVM: Type: R_386_PC16 (21)
28# LLVM: Type: R_386_8 (22)
29# LLVM: Type: R_386_PC8 (23)
30# LLVM: Type: R_386_TLS_GD_32 (24)
31# LLVM: Type: R_386_TLS_GD_PUSH (25)
32# LLVM: Type: R_386_TLS_GD_CALL (26)
33# LLVM: Type: R_386_TLS_GD_POP (27)
34# LLVM: Type: R_386_TLS_LDM_32 (28)
35# LLVM: Type: R_386_TLS_LDM_PUSH (29)
36# LLVM: Type: R_386_TLS_LDM_CALL (30)
37# LLVM: Type: R_386_TLS_LDM_POP (31)
38# LLVM: Type: R_386_TLS_LDO_32 (32)
39# LLVM: Type: R_386_TLS_IE_32 (33)
40# LLVM: Type: R_386_TLS_LE_32 (34)
41# LLVM: Type: R_386_TLS_DTPMOD32 (35)
42# LLVM: Type: R_386_TLS_DTPOFF32 (36)
43# LLVM: Type: R_386_TLS_TPOFF32 (37)
44# LLVM: Type: R_386_TLS_GOTDESC (39)
45# LLVM: Type: R_386_TLS_DESC_CALL (40)
46# LLVM: Type: R_386_TLS_DESC (41)
47# LLVM: Type: R_386_IRELATIVE (42)
48# LLVM: Type: R_386_GOT32X (43)
49
50# GNU:      Relocation section '.rel.text' at offset 0x34 contains 41 entries:
51# GNU-NEXT:  Offset     Info    Type                Sym. Value  Symbol's Name
52# GNU-NEXT: 00000002  00000100 R_386_NONE             00000000   foo
53# GNU-NEXT: 00000008  00000101 R_386_32               00000000   foo
54# GNU-NEXT: 0000000e  00000102 R_386_PC32             00000000   foo
55# GNU-NEXT: 00000014  00000103 R_386_GOT32            00000000   foo
56# GNU-NEXT: 0000001a  00000104 R_386_PLT32            00000000   foo
57# GNU-NEXT: 00000020  00000105 R_386_COPY             00000000   foo
58# GNU-NEXT: 00000026  00000106 R_386_GLOB_DAT         00000000   foo
59# GNU-NEXT: 0000002c  00000107 R_386_JUMP_SLOT        00000000   foo
60# GNU-NEXT: 00000032  00000108 R_386_RELATIVE         00000000   foo
61# GNU-NEXT: 00000038  00000109 R_386_GOTOFF           00000000   foo
62# GNU-NEXT: 0000003e  0000010a R_386_GOTPC            00000000   foo
63# GNU-NEXT: 00000044  0000010b R_386_32PLT            00000000   foo
64# GNU-NEXT: 0000004a  0000010e R_386_TLS_TPOFF        00000000   foo
65# GNU-NEXT: 00000050  0000010f R_386_TLS_IE           00000000   foo
66# GNU-NEXT: 00000056  00000110 R_386_TLS_GOTIE        00000000   foo
67# GNU-NEXT: 0000005c  00000111 R_386_TLS_LE           00000000   foo
68# GNU-NEXT: 00000062  00000112 R_386_TLS_GD           00000000   foo
69# GNU-NEXT: 00000068  00000113 R_386_TLS_LDM          00000000   foo
70# GNU-NEXT: 0000006e  00000114 R_386_16               00000000   foo
71# GNU-NEXT: 00000074  00000115 R_386_PC16             00000000   foo
72# GNU-NEXT: 0000007a  00000116 R_386_8                00000000   foo
73# GNU-NEXT: 00000080  00000117 R_386_PC8              00000000   foo
74# GNU-NEXT: 00000086  00000118 R_386_TLS_GD_32        00000000   foo
75# GNU-NEXT: 0000008c  00000119 R_386_TLS_GD_PUSH      00000000   foo
76# GNU-NEXT: 00000092  0000011a R_386_TLS_GD_CALL      00000000   foo
77# GNU-NEXT: 00000098  0000011b R_386_TLS_GD_POP       00000000   foo
78# GNU-NEXT: 0000009e  0000011c R_386_TLS_LDM_32       00000000   foo
79# GNU-NEXT: 000000a4  0000011d R_386_TLS_LDM_PUSH     00000000   foo
80# GNU-NEXT: 000000aa  0000011e R_386_TLS_LDM_CALL     00000000   foo
81# GNU-NEXT: 000000b0  0000011f R_386_TLS_LDM_POP      00000000   foo
82# GNU-NEXT: 000000b6  00000120 R_386_TLS_LDO_32       00000000   foo
83# GNU-NEXT: 000000bc  00000121 R_386_TLS_IE_32        00000000   foo
84# GNU-NEXT: 000000c2  00000122 R_386_TLS_LE_32        00000000   foo
85# GNU-NEXT: 000000c8  00000123 R_386_TLS_DTPMOD32     00000000   foo
86# GNU-NEXT: 000000ce  00000124 R_386_TLS_DTPOFF32     00000000   foo
87# GNU-NEXT: 000000d4  00000125 R_386_TLS_TPOFF32      00000000   foo
88# GNU-NEXT: 000000da  00000127 R_386_TLS_GOTDESC      00000000   foo
89# GNU-NEXT: 000000e0  00000128 R_386_TLS_DESC_CALL    00000000   foo
90# GNU-NEXT: 000000e6  00000129 R_386_TLS_DESC         00000000   foo
91# GNU-NEXT: 000000ec  0000012a R_386_IRELATIVE        00000000   foo
92# GNU-NEXT: 000000f2  0000012b R_386_GOT32X           00000000   foo
93
94--- !ELF
95FileHeader:
96  Class:   ELFCLASS32
97  Data:    ELFDATA2LSB
98  Type:    ET_REL
99  Machine: EM_386
100Sections:
101  - Name: .rel.text
102    Type: SHT_REL
103    Link: .symtab
104    Relocations:
105      - Offset: 0x0000000000000002
106        Type:   R_386_NONE
107        Symbol: foo
108      - Offset: 0x0000000000000008
109        Type:   R_386_32
110        Symbol: foo
111      - Offset: 0x000000000000000E
112        Type:   R_386_PC32
113        Symbol: foo
114      - Offset: 0x0000000000000014
115        Type:   R_386_GOT32
116        Symbol: foo
117      - Offset: 0x000000000000001A
118        Type:   R_386_PLT32
119        Symbol: foo
120      - Offset: 0x0000000000000020
121        Type:   R_386_COPY
122        Symbol: foo
123      - Offset: 0x0000000000000026
124        Type:   R_386_GLOB_DAT
125        Symbol: foo
126      - Offset: 0x000000000000002C
127        Type:   R_386_JUMP_SLOT
128        Symbol: foo
129      - Offset: 0x0000000000000032
130        Type:   R_386_RELATIVE
131        Symbol: foo
132      - Offset: 0x0000000000000038
133        Type:   R_386_GOTOFF
134        Symbol: foo
135      - Offset: 0x000000000000003E
136        Type:   R_386_GOTPC
137        Symbol: foo
138      - Offset: 0x0000000000000044
139        Type:   R_386_32PLT
140        Symbol: foo
141      - Offset: 0x000000000000004A
142        Type:   R_386_TLS_TPOFF
143        Symbol: foo
144      - Offset: 0x0000000000000050
145        Type:   R_386_TLS_IE
146        Symbol: foo
147      - Offset: 0x0000000000000056
148        Type:   R_386_TLS_GOTIE
149        Symbol: foo
150      - Offset: 0x000000000000005C
151        Type:   R_386_TLS_LE
152        Symbol: foo
153      - Offset: 0x0000000000000062
154        Type:   R_386_TLS_GD
155        Symbol: foo
156      - Offset: 0x0000000000000068
157        Type:   R_386_TLS_LDM
158        Symbol: foo
159      - Offset: 0x000000000000006E
160        Type:   R_386_16
161        Symbol: foo
162      - Offset: 0x0000000000000074
163        Type:   R_386_PC16
164        Symbol: foo
165      - Offset: 0x000000000000007A
166        Type:   R_386_8
167        Symbol: foo
168      - Offset: 0x0000000000000080
169        Type:   R_386_PC8
170        Symbol: foo
171      - Offset: 0x0000000000000086
172        Type:   R_386_TLS_GD_32
173        Symbol: foo
174      - Offset: 0x000000000000008C
175        Type:   R_386_TLS_GD_PUSH
176        Symbol: foo
177      - Offset: 0x0000000000000092
178        Type:   R_386_TLS_GD_CALL
179        Symbol: foo
180      - Offset: 0x0000000000000098
181        Type:   R_386_TLS_GD_POP
182        Symbol: foo
183      - Offset: 0x000000000000009E
184        Type:   R_386_TLS_LDM_32
185        Symbol: foo
186      - Offset: 0x00000000000000A4
187        Type:   R_386_TLS_LDM_PUSH
188        Symbol: foo
189      - Offset: 0x00000000000000AA
190        Type:   R_386_TLS_LDM_CALL
191        Symbol: foo
192      - Offset: 0x00000000000000B0
193        Type:   R_386_TLS_LDM_POP
194        Symbol: foo
195      - Offset: 0x00000000000000B6
196        Type:   R_386_TLS_LDO_32
197        Symbol: foo
198      - Offset: 0x00000000000000BC
199        Type:   R_386_TLS_IE_32
200        Symbol: foo
201      - Offset: 0x00000000000000C2
202        Type:   R_386_TLS_LE_32
203        Symbol: foo
204      - Offset: 0x00000000000000C8
205        Type:   R_386_TLS_DTPMOD32
206        Symbol: foo
207      - Offset: 0x00000000000000CE
208        Type:   R_386_TLS_DTPOFF32
209        Symbol: foo
210      - Offset: 0x00000000000000D4
211        Type:   R_386_TLS_TPOFF32
212        Symbol: foo
213      - Offset: 0x00000000000000DA
214        Type:   R_386_TLS_GOTDESC
215        Symbol: foo
216      - Offset: 0x00000000000000E0
217        Type:   R_386_TLS_DESC_CALL
218        Symbol: foo
219      - Offset: 0x00000000000000E6
220        Type:   R_386_TLS_DESC
221        Symbol: foo
222      - Offset: 0x00000000000000EC
223        Type:   R_386_IRELATIVE
224        Symbol: foo
225      - Offset: 0x00000000000000F2
226        Type:   R_386_GOT32X
227        Symbol: foo
228Symbols:
229  - Name:    foo
230    Binding: STB_GLOBAL
231