llvm.org GIT mirror llvm / 84208dd
[AMDGPU] Add 32-bit lo/hi got and pc relative variant kinds and emit appropriate relocations Differential Revision: https://reviews.llvm.org/D25548 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284195 91177308-0d34-0410-b5e6-96231b3b80d8 Konstantin Zhuravlyov 4 years ago
4 changed file(s) with 36 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
265265
266266 VK_WebAssembly_FUNCTION, // Function table index, rather than virtual addr
267267
268 VK_AMDGPU_GOTPCREL32_LO, // symbol@gotpcrel32@lo
269 VK_AMDGPU_GOTPCREL32_HI, // symbol@gotpcrel32@hi
270 VK_AMDGPU_REL32_LO, // symbol@rel32@lo
271 VK_AMDGPU_REL32_HI, // symbol@rel32@hi
272
268273 VK_TPREL,
269274 VK_DTPREL
270275 };
274274 case VK_Hexagon_IE: return "IE";
275275 case VK_Hexagon_IE_GOT: return "IEGOT";
276276 case VK_WebAssembly_FUNCTION: return "FUNCTION";
277 case VK_AMDGPU_GOTPCREL32_LO: return "gotpcrel32@lo";
278 case VK_AMDGPU_GOTPCREL32_HI: return "gotpcrel32@hi";
279 case VK_AMDGPU_REL32_LO: return "rel32@lo";
280 case VK_AMDGPU_REL32_HI: return "rel32@hi";
277281 }
278282 llvm_unreachable("Invalid variant kind");
279283 }
371375 .Case("prel31", VK_ARM_PREL31)
372376 .Case("sbrel", VK_ARM_SBREL)
373377 .Case("tlsldo", VK_ARM_TLSLDO)
378 .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO)
379 .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI)
380 .Case("rel32@lo", VK_AMDGPU_REL32_LO)
381 .Case("rel32@hi", VK_AMDGPU_REL32_HI)
374382 .Default(VK_Invalid);
375383 }
376384
5252 break;
5353 case MCSymbolRefExpr::VK_GOTPCREL:
5454 return ELF::R_AMDGPU_GOTPCREL;
55 case MCSymbolRefExpr::VK_AMDGPU_GOTPCREL32_LO:
56 return ELF::R_AMDGPU_GOTPCREL32_LO;
57 case MCSymbolRefExpr::VK_AMDGPU_GOTPCREL32_HI:
58 return ELF::R_AMDGPU_GOTPCREL32_HI;
59 case MCSymbolRefExpr::VK_AMDGPU_REL32_LO:
60 return ELF::R_AMDGPU_REL32_LO;
61 case MCSymbolRefExpr::VK_AMDGPU_REL32_HI:
62 return ELF::R_AMDGPU_REL32_HI;
5563 }
5664
5765 switch (Fixup.getKind()) {
33 // CHECK: .rel.text {
44 // CHECK: R_AMDGPU_ABS32_LO SCRATCH_RSRC_DWORD0 0x0
55 // CHECK: R_AMDGPU_ABS32_HI SCRATCH_RSRC_DWORD1 0x0
6 // CHECK: R_AMDGPU_GOTPCREL global_var 0x0
6 // CHECK: R_AMDGPU_GOTPCREL global_var0 0x0
7 // CHECK: R_AMDGPU_GOTPCREL32_LO global_var1 0x0
8 // CHECK: R_AMDGPU_GOTPCREL32_HI global_var2 0x0
9 // CHECK: R_AMDGPU_REL32_LO global_var3 0x0
10 // CHECK: R_AMDGPU_REL32_HI global_var4 0x0
711 // CHECK: R_AMDGPU_ABS32 var 0x0
812 // CHECK: }
913 // CHECK: .rel.data {
1418 kernel:
1519 s_mov_b32 s0, SCRATCH_RSRC_DWORD0
1620 s_mov_b32 s1, SCRATCH_RSRC_DWORD1
17 s_mov_b32 s2, global_var@GOTPCREL
21 s_mov_b32 s2, global_var0@GOTPCREL
22 s_mov_b32 s3, global_var1@gotpcrel32@lo
23 s_mov_b32 s4, global_var2@gotpcrel32@hi
24 s_mov_b32 s5, global_var3@rel32@lo
25 s_mov_b32 s6, global_var4@rel32@hi
1826
19 .globl global_var
27 .globl global_var0
28 .globl global_var1
29 .globl global_var2
30 .globl global_var3
31 .globl global_var4
2032
2133 .globl SCRATCH_RSRC_DWORD0
2234