[PATCH] D77647: [ELF][AArch64] Add R_AARCH64_PLT32 relocation type.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 07:01:07 PDT 2020


psmith created this revision.
psmith added reviewers: leonardchan, mcgrathr, phosek, pcc, jakehehrlich.
Herald added subscribers: danielkiss, rupprecht, MaskRay, kristof.beyls, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: jhenderson.

The R_AARCH64_PLT32 relocation type will be documented in the next release of ELF for the 64-bit Arm Architecture. It is being added in draft state for the benefit of the position independent vtable feature D72959 <https://reviews.llvm.org/D72959>

R_AARCH64_PLT32 is very similar to R_AARCH64_PREL32. The intention is to provide a signed 32-bit integer representing an offset from the place to a function.

- It relocates 32-bit data
- The expression is S + A - P
- The overflow check for the expression is -2^31 <= X < 2^31
- The relocation generates Thunks/Veneers/Stubs and PLT entries as per R_AARCH64_CALL26
- If the symbol S is an undefined weak the ABI draft does not define its value.

The ABI defines a code for ilp32 for completeness, I have added the code but have only added to the existing reloc-types-elf-aarch64.text as there is no ilp32 equivalent test case.


https://reviews.llvm.org/D77647

Files:
  llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
  llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test


Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test
+++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-aarch64.test
@@ -127,6 +127,7 @@
 # CHECK: Type: R_AARCH64_TLS_TPREL64 (1030)
 # CHECK: Type: R_AARCH64_TLSDESC (1031)
 # CHECK: Type: R_AARCH64_IRELATIVE (1032)
+# CHECK: Type: R_AARCH64_PLT32 (1033)
 
 --- !ELF
 FileHeader:
@@ -267,3 +268,4 @@
       - Type: R_AARCH64_TLS_TPREL64
       - Type: R_AARCH64_TLSDESC
       - Type: R_AARCH64_IRELATIVE
+      - Type: R_AARCH64_PLT32
Index: llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
===================================================================
--- llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
+++ llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
@@ -132,6 +132,7 @@
 ELF_RELOC(R_AARCH64_TLS_TPREL64,                     0x406)
 ELF_RELOC(R_AARCH64_TLSDESC,                         0x407)
 ELF_RELOC(R_AARCH64_IRELATIVE,                       0x408)
+ELF_RELOC(R_AARCH64_PLT32,                           0x409)
 
 // ELF_RELOC(R_AARCH64_P32_NONE,                         0)
 ELF_RELOC(R_AARCH64_P32_ABS32,                       0x001)
@@ -219,3 +220,4 @@
 ELF_RELOC(R_AARCH64_P32_TLS_TPREL,                   0x0ba)
 ELF_RELOC(R_AARCH64_P32_TLSDESC,                     0x0bb)
 ELF_RELOC(R_AARCH64_P32_IRELATIVE,                   0x0bc)
+ELF_RELOC(R_AARCH64_P32_PLT32,                       0x0bd)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77647.255667.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200407/f13de281/attachment.bin>


More information about the llvm-commits mailing list