summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-readobj/elf-relr-relocs.test
blob: da1b6abe52c39281fae2b96dee5805a229c10a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# The binary blobs in this file were created like this:
# llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu Inputs/elf-relr-relocs1.s -o - | obj2yaml | grep Content:

# RUN: yaml2obj -docnum 1 %s \
# RUN:   | llvm-readobj --relocations --raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-LLVM1 %s
# RAW-LLVM1:      Section (1) .relr.dyn {
# RAW-LLVM1-NEXT:   0x10D60
# RAW-LLVM1-NEXT:   0x103
# RAW-LLVM1-NEXT:   0x20000
# RAW-LLVM1-NEXT:   0xF0501
# RAW-LLVM1-NEXT:   0xA700550400009
# RAW-LLVM1-NEXT: }

# RUN: yaml2obj -docnum 1 %s \
# RUN:   | llvm-readobj --relocations - \
# RUN:   | FileCheck --check-prefix=LLVM1 %s
# LLVM1:      Section (1) .relr.dyn {
# LLVM1-NEXT:   0x10D60 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x10D68 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x10DA0 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20000 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20040 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20050 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20080 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20088 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20090 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20098 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20210 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202A8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202D8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202E8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x202F8 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20308 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20358 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20360 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20368 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20380 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT:   0x20390 R_X86_64_RELATIVE - 0x0
# LLVM1-NEXT: }

# RUN: yaml2obj -docnum 1 %s \
# RUN:   | llvm-readelf -relocations -raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-GNU1 %s
# RAW-GNU1:      Relocation section '.relr.dyn' at offset 0x180 contains 5 entries:
# RAW-GNU1:      0000000000010d60
# RAW-GNU1-NEXT: 0000000000000103
# RAW-GNU1-NEXT: 0000000000020000
# RAW-GNU1-NEXT: 00000000000f0501
# RAW-GNU1-NEXT: 000a700550400009

# RUN: yaml2obj -docnum 1 %s \
# RUN:   | llvm-readelf -relocations - \
# RUN:   | FileCheck --check-prefix=GNU1 %s
# GNU1:      Relocation section '.relr.dyn' at offset 0x180 contains 21 entries:
# GNU1:      0000000000010d60  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000010d68  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000010da0  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020000  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020040  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020050  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020080  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020088  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020090  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020098  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020210  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202a8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202d8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202e8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 00000000000202f8  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020308  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020358  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020360  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020368  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020380  0000000000000008 R_X86_64_RELATIVE
# GNU1-NEXT: 0000000000020390  0000000000000008 R_X86_64_RELATIVE

# elf-relr-relocs1.s
--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_DYN
  Machine:         EM_X86_64
  Entry:           0x0000000000001000
Sections:
  - Name:            .relr.dyn
    Type:            SHT_RELR
    Flags:           [ SHF_ALLOC ]
    Address:         0x00000000000001C8
    Link:            .symtab
    AddressAlign:    0x0000000000000001
    Content:         600D0100000000000301000000000000000002000000000001050F00000000000900405005700A00
...

# RUN: yaml2obj -docnum 2 %s \
# RUN:   | llvm-readobj --relocations --raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-LLVM2 %s
# RAW-LLVM2:      Section (1) .relr.dyn {
# RAW-LLVM2-NEXT:   0x10D60
# RAW-LLVM2-NEXT:   0x103
# RAW-LLVM2-NEXT:   0x20000
# RAW-LLVM2-NEXT:   0xF0501
# RAW-LLVM2-NEXT:   0x50400009
# RAW-LLVM2-NEXT: }

# RUN: yaml2obj -docnum 2 %s \
# RUN:   | llvm-readobj --relocations - \
# RUN:   | FileCheck --check-prefix=LLVM2 %s
# LLVM2:      Section (1) .relr.dyn {
# LLVM2-NEXT:   0x10D60 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x10D64 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x10D80 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20000 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20020 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20028 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20040 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20044 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20048 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x2004C R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x20088 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200D4 R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200EC R_386_RELATIVE - 0x0
# LLVM2-NEXT:   0x200F4 R_386_RELATIVE - 0x0
# LLVM2-NEXT: }

# RUN: yaml2obj -docnum 2 %s \
# RUN:   | llvm-readelf -relocations -raw-relr - \
# RUN:   | FileCheck --check-prefix=RAW-GNU2 %s
# RAW-GNU2:      Relocation section '.relr.dyn' at offset 0xfc contains 5 entries:
# RAW-GNU2:      00010d60
# RAW-GNU2-NEXT: 00000103
# RAW-GNU2-NEXT: 00020000
# RAW-GNU2-NEXT: 000f0501
# RAW-GNU2-NEXT: 50400009

# RUN: yaml2obj -docnum 2 %s \
# RUN:   | llvm-readelf -relocations - \
# RUN:   | FileCheck --check-prefix=GNU2 %s
# GNU2:      Relocation section '.relr.dyn' at offset 0xfc contains 14 entries:
# GNU2:      00010d60  00000008 R_386_RELATIVE
# GNU2-NEXT: 00010d64  00000008 R_386_RELATIVE
# GNU2-NEXT: 00010d80  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020000  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020020  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020028  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020040  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020044  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020048  00000008 R_386_RELATIVE
# GNU2-NEXT: 0002004c  00000008 R_386_RELATIVE
# GNU2-NEXT: 00020088  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200d4  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200ec  00000008 R_386_RELATIVE
# GNU2-NEXT: 000200f4  00000008 R_386_RELATIVE

# elf-relr-relocs2.s
--- !ELF
FileHeader:
  Class:           ELFCLASS32
  Data:            ELFDATA2LSB
  Type:            ET_DYN
  Machine:         EM_386
  Entry:           0x00001000
Sections:
  - Name:            .relr.dyn
    Type:            SHT_RELR
    Flags:           [ SHF_ALLOC ]
    Address:         0x000001C8
    Link:            .symtab
    AddressAlign:    0x00000001
    Content:         600D0100030100000000020001050F0009004050
...
OpenPOWER on IntegriCloud