[lld] r365662 - ELF: Add support for R_AARCH64_ADR_PREL_PG_HI21_NC relocation.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 09:42:20 PDT 2019
Author: pcc
Date: Wed Jul 10 09:42:20 2019
New Revision: 365662
URL: http://llvm.org/viewvc/llvm-project?rev=365662&view=rev
Log:
ELF: Add support for R_AARCH64_ADR_PREL_PG_HI21_NC relocation.
Differential Revision: https://reviews.llvm.org/D64456
Added:
lld/trunk/test/ELF/aarch64-hi21-nc.s
Modified:
lld/trunk/ELF/Arch/AArch64.cpp
lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
Modified: lld/trunk/ELF/Arch/AArch64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/AArch64.cpp?rev=365662&r1=365661&r2=365662&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/AArch64.cpp (original)
+++ lld/trunk/ELF/Arch/AArch64.cpp Wed Jul 10 09:42:20 2019
@@ -103,6 +103,7 @@ RelExpr AArch64::getRelExpr(RelType type
case R_AARCH64_LD_PREL_LO19:
return R_PC;
case R_AARCH64_ADR_PREL_PG_HI21:
+ case R_AARCH64_ADR_PREL_PG_HI21_NC:
return R_AARCH64_PAGE_PC;
case R_AARCH64_LD64_GOT_LO12_NC:
case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
@@ -270,6 +271,8 @@ void AArch64::relocateOne(uint8_t *loc,
case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
case R_AARCH64_TLSDESC_ADR_PAGE21:
checkInt(loc, val, 33, type);
+ LLVM_FALLTHROUGH;
+ case R_AARCH64_ADR_PREL_PG_HI21_NC:
write32AArch64Addr(loc, val >> 12);
break;
case R_AARCH64_ADR_PREL_LO21:
Modified: lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s?rev=365662&r1=365661&r2=365662&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s Wed Jul 10 09:42:20 2019
@@ -4,8 +4,10 @@
// CHECK: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol dat; recompile with -fPIC
// CHECK: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
+// CHECK: relocation R_AARCH64_ADR_PREL_PG_HI21_NC cannot be used against symbol dat; recompile with -fPIC
adrp x0, dat
+ adrp x0, :pg_hi21_nc:dat
.data
.globl dat
dat:
Added: lld/trunk/test/ELF/aarch64-hi21-nc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-hi21-nc.s?rev=365662&view=auto
==============================================================================
--- lld/trunk/test/ELF/aarch64-hi21-nc.s (added)
+++ lld/trunk/test/ELF/aarch64-hi21-nc.s Wed Jul 10 09:42:20 2019
@@ -0,0 +1,8 @@
+// REQUIRES: aarch64
+// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t
+// RUN: llvm-objdump -d %t | FileCheck %s
+
+foo = . + 0x1100000000000000
+// CHECK: adrp x0, #0
+adrp x0, :pg_hi21_nc:foo
More information about the llvm-commits
mailing list