diff options
| author | Tony Tye <Tony.Tye@amd.com> | 2017-10-16 20:44:29 +0000 |
|---|---|---|
| committer | Tony Tye <Tony.Tye@amd.com> | 2017-10-16 20:44:29 +0000 |
| commit | d288430c3e8597c5eb74ab6fe9ee6f4ef75b1723 (patch) | |
| tree | 79707b24ef4e29d1dade7244035019508ae5218b /llvm | |
| parent | 038f4ea367c577052d9332ff01d2794bdd9cfb6a (diff) | |
| download | bcm5719-llvm-d288430c3e8597c5eb74ab6fe9ee6f4ef75b1723.tar.gz bcm5719-llvm-d288430c3e8597c5eb74ab6fe9ee6f4ef75b1723.zip | |
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
llvm-svn: 315935
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/docs/AMDGPUUsage.rst | 9 | ||||
| -rw-r--r-- | llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def | 1 | ||||
| -rw-r--r-- | llvm/test/Object/AMDGPU/elf64-relocs.yaml | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst index 8b94a3e6a5a..35611bc6fcd 100644 --- a/llvm/docs/AMDGPUUsage.rst +++ b/llvm/docs/AMDGPUUsage.rst @@ -684,7 +684,12 @@ Following notations are used for specifying relocation calculations: **S** Represents the value of the symbol whose index resides in the relocation - entry. + entry. Relocations not using this must specify a symbol index of ``STN_UNDEF``. + +**B** + Represents the base address of a loaded executable or shared object which is + the difference between the ELF address and the actual load address. Relocations + using this are only valid in executable or shared objects. The following relocation types are supported: @@ -706,6 +711,8 @@ The following relocation types are supported: ``R_AMDGPU_GOTPCREL32_HI`` 9 ``word32`` (G + GOT + A - P) >> 32 ``R_AMDGPU_REL32_LO`` 10 ``word32`` (S + A - P) & 0xFFFFFFFF ``R_AMDGPU_REL32_HI`` 11 ``word32`` (S + A - P) >> 32 + *reserved* 12 + ``R_AMDGPU_RELATIVE64`` 13 ``word64`` B + A ========================== ===== ========== ============================== .. _amdgpu-dwarf: diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def index c66f88d14ec..00b19c4161d 100644 --- a/llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def +++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def @@ -14,3 +14,4 @@ ELF_RELOC(R_AMDGPU_GOTPCREL32_LO, 8) ELF_RELOC(R_AMDGPU_GOTPCREL32_HI, 9) ELF_RELOC(R_AMDGPU_REL32_LO, 10) ELF_RELOC(R_AMDGPU_REL32_HI, 11) +ELF_RELOC(R_AMDGPU_RELATIVE64, 13) diff --git a/llvm/test/Object/AMDGPU/elf64-relocs.yaml b/llvm/test/Object/AMDGPU/elf64-relocs.yaml index 541119852af..bc6c2b89d5f 100644 --- a/llvm/test/Object/AMDGPU/elf64-relocs.yaml +++ b/llvm/test/Object/AMDGPU/elf64-relocs.yaml @@ -15,6 +15,7 @@ # CHECK: 0x18 R_AMDGPU_GOTPCREL32_HI - 0x0 # CHECK: 0x20 R_AMDGPU_REL32_LO - 0x0 # CHECK: 0x22 R_AMDGPU_REL32_HI - 0x0 +# CHECK: 0x24 R_AMDGPU_RELATIVE64 - 0x0 # CHECK: } # CHECK: ] @@ -72,6 +73,9 @@ Sections: - Offset: 0x22 Symbol: s11 Type: R_AMDGPU_REL32_HI + - Offset: 0x24 + Symbol: s12 + Type: R_AMDGPU_RELATIVE64 Symbols: Local: |

