llvm.org GIT mirror llvm / 300ec0a
Add base relative relocation record that can be used for the following case (OpenCL example): static __global int Var = 0; __global int* Ptr[] = {&Var}; ... In this case Var is a non premptable symbol and so its address can be used as the value of Ptr, with a base relative relocation that will add the delta between the ELF address and the actual load address. Such relocations do not require a symbol. Differential Revision: https://reviews.llvm.org/D38909 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315935 91177308-0d34-0410-b5e6-96231b3b80d8 Tony Tye 1 year, 10 months ago
3 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
683683
684684 **S**
685685 Represents the value of the symbol whose index resides in the relocation
686 entry.
686 entry. Relocations not using this must specify a symbol index of ``STN_UNDEF``.
687
688 **B**
689 Represents the base address of a loaded executable or shared object which is
690 the difference between the ELF address and the actual load address. Relocations
691 using this are only valid in executable or shared objects.
687692
688693 The following relocation types are supported:
689694
705710 ``R_AMDGPU_GOTPCREL32_HI`` 9 ``word32`` (G + GOT + A - P) >> 32
706711 ``R_AMDGPU_REL32_LO`` 10 ``word32`` (S + A - P) & 0xFFFFFFFF
707712 ``R_AMDGPU_REL32_HI`` 11 ``word32`` (S + A - P) >> 32
713 *reserved* 12
714 ``R_AMDGPU_RELATIVE64`` 13 ``word64`` B + A
708715 ========================== ===== ========== ==============================
709716
710717 .. _amdgpu-dwarf:
1313 ELF_RELOC(R_AMDGPU_GOTPCREL32_HI, 9)
1414 ELF_RELOC(R_AMDGPU_REL32_LO, 10)
1515 ELF_RELOC(R_AMDGPU_REL32_HI, 11)
16 ELF_RELOC(R_AMDGPU_RELATIVE64, 13)
1414 # CHECK: 0x18 R_AMDGPU_GOTPCREL32_HI - 0x0
1515 # CHECK: 0x20 R_AMDGPU_REL32_LO - 0x0
1616 # CHECK: 0x22 R_AMDGPU_REL32_HI - 0x0
17 # CHECK: 0x24 R_AMDGPU_RELATIVE64 - 0x0
1718 # CHECK: }
1819 # CHECK: ]
1920
7172 - Offset: 0x22
7273 Symbol: s11
7374 Type: R_AMDGPU_REL32_HI
75 - Offset: 0x24
76 Symbol: s12
77 Type: R_AMDGPU_RELATIVE64
7478
7579 Symbols:
7680 Local: