Skip to content

Commit a4ace3d

Browse files
authored
[PAC][lld] Fix reloc against adrp imm in PAC PLT header (#113429)
The PAC PLT header contains adrp instruction which immediate should be filled. In https://reviews.llvm.org/D62609, the adrp instruction address was calculated incorrectly. This patch resolves the issue. The test is already present in test/ELF/aarch64-feature-pac.s
1 parent d8ef7b6 commit a4ace3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lld/ELF/Arch/AArch64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ void AArch64BtiPac::writePltHeader(uint8_t *buf) const {
10481048
memcpy(buf, pltData, sizeof(pltData));
10491049

10501050
relocateNoSym(buf + 4, R_AARCH64_ADR_PREL_PG_HI21,
1051-
getAArch64Page(got + 16) - getAArch64Page(plt + 8));
1051+
getAArch64Page(got + 16) - getAArch64Page(plt + 4));
10521052
relocateNoSym(buf + 8, R_AARCH64_LDST64_ABS_LO12_NC, got + 16);
10531053
relocateNoSym(buf + 12, R_AARCH64_ADD_ABS_LO12_NC, got + 16);
10541054
if (!btiHeader)

0 commit comments

Comments
 (0)