[PATCH] D21482: Support/ELF: Add R_AMDGPU_GOTPCREL relocation
Rafael Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 17 17:57:32 PDT 2016
git-clang-format the patch.
Out of curiosity, why do you need a got? Are GPU fancy enough to have
shared libraries and symbol preemption these days?
Cheers,
Rafael
On 17 June 2016 at 17:31, Tom Stellard <thomas.stellard at amd.com> wrote:
> tstellarAMD created this revision.
> tstellarAMD added reviewers: arsenm, kzhuravl, rafael, ruiu, tony-tye.
> tstellarAMD added a subscriber: llvm-commits.
> Herald added subscribers: kzhuravl, arsenm.
>
> We will start generating this in a future patch.
>
> Change-Id: Id5fae1e8e6887ab7bbecbf445d1834a3aed4a5c9
>
> http://reviews.llvm.org/D21482
>
> Files:
> docs/CodeGenerator.rst
> include/llvm/Support/ELFRelocs/AMDGPU.def
> lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
>
> Index: lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> ===================================================================
> --- lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> +++ lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
> @@ -38,6 +38,12 @@
> const MCValue &Target,
> const MCFixup &Fixup,
> bool IsPCRel) const {
> +
> + switch (Target.getAccessVariant()) {
> + default: break;
> + case MCSymbolRefExpr::VK_GOTPCREL: return ELF::R_AMDGPU_GOTPCREL;
> + }
> +
> switch (Fixup.getKind()) {
> default: break;
> case FK_Data_4:
> Index: include/llvm/Support/ELFRelocs/AMDGPU.def
> ===================================================================
> --- include/llvm/Support/ELFRelocs/AMDGPU.def
> +++ include/llvm/Support/ELFRelocs/AMDGPU.def
> @@ -9,3 +9,4 @@
> ELF_RELOC(R_AMDGPU_REL32, 4)
> ELF_RELOC(R_AMDGPU_REL64, 5)
> ELF_RELOC(R_AMDGPU_ABS32, 6)
> +ELF_RELOC(R_AMDGPU_GOTPCREL, 7)
> Index: docs/CodeGenerator.rst
> ===================================================================
> --- docs/CodeGenerator.rst
> +++ docs/CodeGenerator.rst
> @@ -2676,6 +2676,9 @@
>
> * **A** --- Represents the addend used to compute the value of the relocatable
> field
> +* **G** --- Represents the offset into the global offset table at which the
> + relocation entry’s symbol will reside during execution.
> +* **GOT** --- Represents the address of the global offset table.
> * **P** --- Represents the place (section offset or address) of the storage unit
> being relocated (computed using ``r_offset``)
> * **S** --- Represents the value of the symbol whose index resides in the
> @@ -2694,4 +2697,5 @@
> ``R_AMDGPU_REL32`` 4 ``word32`` S + A - P
> ``R_AMDGPU_REL64`` 5 ``word64`` S + A - P
> ``R_AMDGPU_ABS32`` 6 ``word32`` S + A
> + ``R_AMDGPU_GOTPCREL 7 ``word32`` G + GOT + A - P
> ===================== ===== ========== ====================
>
>
More information about the llvm-commits
mailing list