[PATCH] D94612: [LLD][ELF][AArch64] Add support for R_AARCH64_LD64_GOTPAGE_LO15 relocation

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 10:00:33 PST 2021


psmith added a comment.

Looks like we need to make sure that the relocation is a static link time constant so that it can be used in PIE and Shared Libs. Otherwise LGTM.



================
Comment at: lld/ELF/Relocations.cpp:409
   if (oneof<R_DTPREL, R_GOTPLT, R_GOT_OFF, R_TLSLD_GOT_OFF,
             R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF,
             R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD,
----------------
I think R_AARCH64_GOT_PAGE needs to be added here, otherwise we get a link error about text relocations when -pie or --shared.


================
Comment at: lld/test/ELF/aarch64-gotpage.s:5
+# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %t/test.s -o %t.o
+# RUN: ld.lld -pie --script %t/script %t.o -o %t.exe
+# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=RELOCS %s
----------------
Will be worth adding a test case with pie or shared to make sure the relocation is allowed in those cases.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94612/new/

https://reviews.llvm.org/D94612



More information about the llvm-commits mailing list