Skip to content

Commit c161b30

Browse files
committed
[yaml2obj] Support R_PPC_* relocation types
1 parent fb7ddd0 commit c161b30

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,9 @@ void ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration(
839839
case ELF::EM_CSKY:
840840
#include "llvm/BinaryFormat/ELFRelocs/CSKY.def"
841841
break;
842+
case ELF::EM_PPC:
843+
#include "llvm/BinaryFormat/ELFRelocs/PowerPC.def"
844+
break;
842845
case ELF::EM_PPC64:
843846
#include "llvm/BinaryFormat/ELFRelocs/PowerPC64.def"
844847
break;
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
## Test that llvm-readobj shows proper relocation type
2+
## names and values for ppc target.
3+
4+
# RUN: yaml2obj %s -o %t-ppc.o
5+
# RUN: llvm-readobj -r --expand-relocs %t-ppc.o | FileCheck %s
6+
7+
# CHECK: Type: R_PPC_NONE (0)
8+
# CHECK: Type: R_PPC_ADDR32 (1)
9+
# CHECK: Type: R_PPC_ADDR24 (2)
10+
# CHECK: Type: R_PPC_ADDR16 (3)
11+
# CHECK: Type: R_PPC_ADDR16_LO (4)
12+
# CHECK: Type: R_PPC_ADDR16_HI (5)
13+
# CHECK: Type: R_PPC_ADDR16_HA (6)
14+
# CHECK: Type: R_PPC_ADDR14 (7)
15+
# CHECK: Type: R_PPC_ADDR14_BRTAKEN (8)
16+
# CHECK: Type: R_PPC_ADDR14_BRNTAKEN (9)
17+
# CHECK: Type: R_PPC_REL24 (10)
18+
# CHECK: Type: R_PPC_REL14 (11)
19+
# CHECK: Type: R_PPC_REL14_BRTAKEN (12)
20+
# CHECK: Type: R_PPC_REL14_BRNTAKEN (13)
21+
# CHECK: Type: R_PPC_GOT16 (14)
22+
# CHECK: Type: R_PPC_GOT16_LO (15)
23+
# CHECK: Type: R_PPC_GOT16_HI (16)
24+
# CHECK: Type: R_PPC_GOT16_HA (17)
25+
# CHECK: Type: R_PPC_PLTREL24 (18)
26+
# CHECK: Type: R_PPC_COPY (19)
27+
# CHECK: Type: R_PPC_GLOB_DAT (20)
28+
# CHECK: Type: R_PPC_JMP_SLOT (21)
29+
# CHECK: Type: R_PPC_RELATIVE (22)
30+
# CHECK: Type: R_PPC_LOCAL24PC (23)
31+
# CHECK: Type: R_PPC_UADDR32 (24)
32+
# CHECK: Type: R_PPC_UADDR16 (25)
33+
# CHECK: Type: R_PPC_REL32 (26)
34+
# CHECK: Type: R_PPC_PLT32 (27)
35+
# CHECK: Type: R_PPC_PLTREL32 (28)
36+
# CHECK: Type: R_PPC_PLT16_LO (29)
37+
# CHECK: Type: R_PPC_PLT16_HI (30)
38+
# CHECK: Type: R_PPC_PLT16_HA (31)
39+
# CHECK: Type: R_PPC_SDAREL16 (32)
40+
# CHECK: Type: R_PPC_SECTOFF (33)
41+
# CHECK: Type: R_PPC_SECTOFF_LO (34)
42+
# CHECK: Type: R_PPC_SECTOFF_HI (35)
43+
# CHECK: Type: R_PPC_SECTOFF_HA (36)
44+
# CHECK: Type: R_PPC_ADDR30 (37)
45+
# CHECK: Type: R_PPC_TLS (67)
46+
# CHECK: Type: R_PPC_DTPMOD32 (68)
47+
# CHECK: Type: R_PPC_TPREL16 (69)
48+
# CHECK: Type: R_PPC_TPREL16_LO (70)
49+
# CHECK: Type: R_PPC_TPREL16_HI (71)
50+
# CHECK: Type: R_PPC_TPREL16_HA (72)
51+
# CHECK: Type: R_PPC_TPREL32 (73)
52+
# CHECK: Type: R_PPC_DTPREL16 (74)
53+
# CHECK: Type: R_PPC_DTPREL16_LO (75)
54+
# CHECK: Type: R_PPC_DTPREL16_HI (76)
55+
# CHECK: Type: R_PPC_DTPREL16_HA (77)
56+
# CHECK: Type: R_PPC_DTPREL32 (78)
57+
# CHECK: Type: R_PPC_GOT_TLSGD16 (79)
58+
# CHECK: Type: R_PPC_GOT_TLSGD16_LO (80)
59+
# CHECK: Type: R_PPC_GOT_TLSGD16_HI (81)
60+
# CHECK: Type: R_PPC_GOT_TLSGD16_HA (82)
61+
# CHECK: Type: R_PPC_GOT_TLSLD16 (83)
62+
# CHECK: Type: R_PPC_GOT_TLSLD16_LO (84)
63+
# CHECK: Type: R_PPC_GOT_TLSLD16_HI (85)
64+
# CHECK: Type: R_PPC_GOT_TLSLD16_HA (86)
65+
# CHECK: Type: R_PPC_GOT_TPREL16 (87)
66+
# CHECK: Type: R_PPC_GOT_TPREL16_LO (88)
67+
# CHECK: Type: R_PPC_GOT_TPREL16_HI (89)
68+
# CHECK: Type: R_PPC_GOT_TPREL16_HA (90)
69+
# CHECK: Type: R_PPC_GOT_DTPREL16 (91)
70+
# CHECK: Type: R_PPC_GOT_DTPREL16_LO (92)
71+
# CHECK: Type: R_PPC_GOT_DTPREL16_HI (93)
72+
# CHECK: Type: R_PPC_GOT_DTPREL16_HA (94)
73+
# CHECK: Type: R_PPC_TLSGD (95)
74+
# CHECK: Type: R_PPC_TLSLD (96)
75+
# CHECK: Type: R_PPC_IRELATIVE (248)
76+
# CHECK: Type: R_PPC_REL16 (249)
77+
# CHECK: Type: R_PPC_REL16_LO (250)
78+
# CHECK: Type: R_PPC_REL16_HI (251)
79+
# CHECK: Type: R_PPC_REL16_HA (252)
80+
81+
--- !ELF
82+
FileHeader:
83+
Class: ELFCLASS32
84+
Data: ELFDATA2MSB
85+
Type: ET_REL
86+
Machine: EM_PPC
87+
Sections:
88+
- Name: .rela.text
89+
Type: SHT_RELA
90+
Relocations:
91+
- Type: R_PPC_NONE
92+
- Type: R_PPC_ADDR32
93+
- Type: R_PPC_ADDR24
94+
- Type: R_PPC_ADDR16
95+
- Type: R_PPC_ADDR16_LO
96+
- Type: R_PPC_ADDR16_HI
97+
- Type: R_PPC_ADDR16_HA
98+
- Type: R_PPC_ADDR14
99+
- Type: R_PPC_ADDR14_BRTAKEN
100+
- Type: R_PPC_ADDR14_BRNTAKEN
101+
- Type: R_PPC_REL24
102+
- Type: R_PPC_REL14
103+
- Type: R_PPC_REL14_BRTAKEN
104+
- Type: R_PPC_REL14_BRNTAKEN
105+
- Type: R_PPC_GOT16
106+
- Type: R_PPC_GOT16_LO
107+
- Type: R_PPC_GOT16_HI
108+
- Type: R_PPC_GOT16_HA
109+
- Type: R_PPC_PLTREL24
110+
- Type: R_PPC_COPY
111+
- Type: R_PPC_GLOB_DAT
112+
- Type: R_PPC_JMP_SLOT
113+
- Type: R_PPC_RELATIVE
114+
- Type: R_PPC_LOCAL24PC
115+
- Type: R_PPC_UADDR32
116+
- Type: R_PPC_UADDR16
117+
- Type: R_PPC_REL32
118+
- Type: R_PPC_PLT32
119+
- Type: R_PPC_PLTREL32
120+
- Type: R_PPC_PLT16_LO
121+
- Type: R_PPC_PLT16_HI
122+
- Type: R_PPC_PLT16_HA
123+
- Type: R_PPC_SDAREL16
124+
- Type: R_PPC_SECTOFF
125+
- Type: R_PPC_SECTOFF_LO
126+
- Type: R_PPC_SECTOFF_HI
127+
- Type: R_PPC_SECTOFF_HA
128+
- Type: R_PPC_ADDR30
129+
- Type: R_PPC_TLS
130+
- Type: R_PPC_DTPMOD32
131+
- Type: R_PPC_TPREL16
132+
- Type: R_PPC_TPREL16_LO
133+
- Type: R_PPC_TPREL16_HI
134+
- Type: R_PPC_TPREL16_HA
135+
- Type: R_PPC_TPREL32
136+
- Type: R_PPC_DTPREL16
137+
- Type: R_PPC_DTPREL16_LO
138+
- Type: R_PPC_DTPREL16_HI
139+
- Type: R_PPC_DTPREL16_HA
140+
- Type: R_PPC_DTPREL32
141+
- Type: R_PPC_GOT_TLSGD16
142+
- Type: R_PPC_GOT_TLSGD16_LO
143+
- Type: R_PPC_GOT_TLSGD16_HI
144+
- Type: R_PPC_GOT_TLSGD16_HA
145+
- Type: R_PPC_GOT_TLSLD16
146+
- Type: R_PPC_GOT_TLSLD16_LO
147+
- Type: R_PPC_GOT_TLSLD16_HI
148+
- Type: R_PPC_GOT_TLSLD16_HA
149+
- Type: R_PPC_GOT_TPREL16
150+
- Type: R_PPC_GOT_TPREL16_LO
151+
- Type: R_PPC_GOT_TPREL16_HI
152+
- Type: R_PPC_GOT_TPREL16_HA
153+
- Type: R_PPC_GOT_DTPREL16
154+
- Type: R_PPC_GOT_DTPREL16_LO
155+
- Type: R_PPC_GOT_DTPREL16_HI
156+
- Type: R_PPC_GOT_DTPREL16_HA
157+
- Type: R_PPC_TLSGD
158+
- Type: R_PPC_TLSLD
159+
- Type: R_PPC_IRELATIVE
160+
- Type: R_PPC_REL16
161+
- Type: R_PPC_REL16_LO
162+
- Type: R_PPC_REL16_HI
163+
- Type: R_PPC_REL16_HA

0 commit comments

Comments
 (0)