[llvm-branch-commits] [lld] [PAC][lld][AArch64][ELF] Support signed GOT with tiny code model (PR #113816)
Daniil Kovalev via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 4 12:05:04 PST 2024
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/113816
>From f061ec8df5648bdff25e0278075ad515e681b698 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Fri, 25 Oct 2024 21:28:18 +0300
Subject: [PATCH 1/7] [PAC][lld][AArch64][ELF] Support signed GOT with tiny
code model
Support `R_AARCH64_AUTH_GOT_ADR_PREL_LO21` and `R_AARCH64_AUTH_GOT_LD_PREL19`
GOT-generating relocations.
---
lld/ELF/Arch/AArch64.cpp | 5 ++
lld/ELF/InputSection.cpp | 1 +
lld/ELF/Relocations.cpp | 11 +--
lld/ELF/Relocations.h | 1 +
lld/test/ELF/aarch64-got-relocations-pauth.s | 73 ++++++++++++++++++++
5 files changed, 87 insertions(+), 4 deletions(-)
diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index 9571e0e9566fc3..b63551d0f682e5 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -205,6 +205,9 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
case R_AARCH64_AUTH_LD64_GOT_LO12_NC:
case R_AARCH64_AUTH_GOT_ADD_LO12_NC:
return RE_AARCH64_AUTH_GOT;
+ case R_AARCH64_AUTH_GOT_LD_PREL19:
+ case R_AARCH64_AUTH_GOT_ADR_PREL_LO21:
+ return RE_AARCH64_AUTH_GOT_PC;
case R_AARCH64_LD64_GOTPAGE_LO15:
return RE_AARCH64_GOT_PAGE;
case R_AARCH64_ADR_GOT_PAGE:
@@ -548,6 +551,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
write32AArch64Addr(loc, val >> 12);
break;
case R_AARCH64_ADR_PREL_LO21:
+ case R_AARCH64_AUTH_GOT_ADR_PREL_LO21:
checkInt(ctx, loc, val, 21, rel);
write32AArch64Addr(loc, val);
break;
@@ -568,6 +572,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
case R_AARCH64_CONDBR19:
case R_AARCH64_LD_PREL_LO19:
case R_AARCH64_GOT_LD_PREL19:
+ case R_AARCH64_AUTH_GOT_LD_PREL19:
checkAlignment(ctx, loc, val, 4, rel);
checkInt(ctx, loc, val, 21, rel);
writeMaskedBits32le(loc, (val & 0x1FFFFC) << 3, 0x1FFFFC << 3);
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 26dc5c606f57f9..76af4ec4193a4f 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -817,6 +817,7 @@ uint64_t InputSectionBase::getRelocTargetVA(Ctx &ctx, const Relocation &r,
case RE_AARCH64_GOT_PAGE:
return r.sym->getGotVA(ctx) + a - getAArch64Page(ctx.in.got->getVA());
case R_GOT_PC:
+ case R_AARCH64_AUTH_GOT_PC:
case R_RELAX_TLS_GD_TO_IE:
return r.sym->getGotVA(ctx) + a - p;
case R_GOTPLT_GOTREL:
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index c1aba70724f45d..4bd73e58b7c758 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -210,8 +210,9 @@ static bool needsPlt(RelExpr expr) {
}
bool lld::elf::needsGot(RelExpr expr) {
- return oneof<R_GOT, RE_AARCH64_AUTH_GOT, R_GOT_OFF, RE_MIPS_GOT_LOCAL_PAGE,
- RE_MIPS_GOT_OFF, RE_MIPS_GOT_OFF32, RE_AARCH64_GOT_PAGE_PC,
+ return oneof<R_GOT, RE_AARCH64_AUTH_GOT, RE_AARCH64_AUTH_GOT_PC, R_GOT_OFF,
+ RE_MIPS_GOT_LOCAL_PAGE, RE_MIPS_GOT_OFF, RE_MIPS_GOT_OFF32,
+ RE_AARCH64_GOT_PAGE_PC, RE_AARCH64_AUTH_GOT_PAGE_PC,
RE_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC, R_GOTPLT,
RE_AARCH64_GOT_PAGE, RE_LOONGARCH_GOT, RE_LOONGARCH_GOT_PAGE_PC>(
expr);
@@ -995,7 +996,8 @@ bool RelocationScanner::isStaticLinkTimeConstant(RelExpr e, RelType type,
R_GOTPLTONLY_PC, R_PLT_PC, R_PLT_GOTREL, R_PLT_GOTPLT,
R_GOTPLT_GOTREL, R_GOTPLT_PC, RE_PPC32_PLTREL, RE_PPC64_CALL_PLT,
RE_PPC64_RELAX_TOC, RE_RISCV_ADD, RE_AARCH64_GOT_PAGE,
- RE_AARCH64_AUTH_GOT, RE_LOONGARCH_PLT_PAGE_PC, RE_LOONGARCH_GOT,
+ RE_AARCH64_AUTH_GOT, RE_AARCH64_AUTH_GOT_PC,
+ RE_LOONGARCH_PLT_PAGE_PC, RE_LOONGARCH_GOT,
RE_LOONGARCH_GOT_PAGE_PC>(e))
return true;
@@ -1111,7 +1113,8 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
// Many LoongArch TLS relocs reuse the RE_LOONGARCH_GOT type, in which
// case the NEEDS_GOT flag shouldn't get set.
bool needsGotAuth =
- (expr == RE_AARCH64_AUTH_GOT || expr == RE_AARCH64_AUTH_GOT_PAGE_PC);
+ (expr == RE_AARCH64_AUTH_GOT || expr == RE_AARCH64_AUTH_GOT_PC ||
+ expr == RE_AARCH64_AUTH_GOT_PAGE_PC);
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
if (!(flags & NEEDS_GOT)) {
sym.setFlags(needsGotAuth ? (NEEDS_GOT | NEEDS_GOT_AUTH) : NEEDS_GOT);
diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h
index 50487206a8b6db..e0c3d13c68f9b4 100644
--- a/lld/ELF/Relocations.h
+++ b/lld/ELF/Relocations.h
@@ -94,6 +94,7 @@ enum RelExpr {
RE_AARCH64_AUTH_GOT_PAGE_PC,
RE_AARCH64_GOT_PAGE,
RE_AARCH64_AUTH_GOT,
+ RE_AARCH64_AUTH_GOT_PC,
RE_AARCH64_PAGE_PC,
RE_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC,
RE_AARCH64_TLSDESC_PAGE,
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index 63538c3872b8f6..f197c6250a8144 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -77,6 +77,79 @@ _start:
adrp x1, :got_auth:zed
add x1, x1, :got_auth_lo12:zed
+#--- ok-tiny.s
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux ok-tiny.s -o ok-tiny.o
+
+# RUN: ld.lld ok-tiny.o a.so -pie -o external-tiny
+# RUN: llvm-readelf -r -S -x .got external-tiny | FileCheck %s --check-prefix=EXTERNAL-TINY
+
+# RUN: ld.lld ok-tiny.o a.o -pie -o local-tiny
+# RUN: llvm-readelf -r -S -x .got -s local-tiny | FileCheck %s --check-prefix=LOCAL-TINY
+
+# EXTERNAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
+# EXTERNAL-TINY-NEXT: 0000000000020380 000000010000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0
+# EXTERNAL-TINY-NEXT: 0000000000020388 000000020000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0
+
+## Symbol's values for bar and zed are equal since they contain no content (see Inputs/shared.s)
+# LOCAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
+# LOCAL-TINY-NEXT: 0000000000020320 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260
+# LOCAL-TINY-NEXT: 0000000000020328 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260
+
+# EXTERNAL-TINY: Hex dump of section '.got':
+# EXTERNAL-TINY-NEXT: 0x00020380 00000000 00000080 00000000 000000a0
+# ^^
+# 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
+# ^^
+# 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
+
+# LOCAL-TINY: Symbol table '.symtab' contains {{.*}} entries:
+# LOCAL-TINY: Num: Value Size Type Bind Vis Ndx Name
+# LOCAL-TINY: 0000000000010260 0 FUNC GLOBAL DEFAULT 6 bar
+# LOCAL-TINY: 0000000000010260 0 NOTYPE GLOBAL DEFAULT 6 zed
+
+# LOCAL-TINY: Hex dump of section '.got':
+# LOCAL-TINY-NEXT: 0x00020320 00000000 00000080 00000000 000000a0
+# ^^
+# 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
+# ^^
+# 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
+
+# RUN: llvm-objdump -d external-tiny | FileCheck %s --check-prefix=EXTERNAL-TINY-ASM
+
+# EXTERNAL-TINY-ASM: <_start>:
+# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20380
+# EXTERNAL-TINY-ASM-NEXT: ldr x1, [x0]
+# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20380
+# EXTERNAL-TINY-ASM-NEXT: ldr x1, 0x20380
+# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20388
+# EXTERNAL-TINY-ASM-NEXT: ldr x1, [x0]
+# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20388
+# EXTERNAL-TINY-ASM-NEXT: ldr x1, 0x20388
+
+# RUN: llvm-objdump -d local-tiny | FileCheck %s --check-prefix=LOCAL-TINY-ASM
+
+# LOCAL-TINY-ASM: <_start>:
+# LOCAL-TINY-ASM-NEXT: adr x0, 0x20320
+# LOCAL-TINY-ASM-NEXT: ldr x1, [x0]
+# LOCAL-TINY-ASM-NEXT: adr x0, 0x20320
+# LOCAL-TINY-ASM-NEXT: ldr x1, 0x20320
+# LOCAL-TINY-ASM-NEXT: adr x0, 0x20328
+# LOCAL-TINY-ASM-NEXT: ldr x1, [x0]
+# LOCAL-TINY-ASM-NEXT: adr x0, 0x20328
+# LOCAL-TINY-ASM-NEXT: ldr x1, 0x20328
+
+.globl _start
+_start:
+ adr x0, :got_auth:bar
+ ldr x1, [x0]
+ adr x0, :got_auth:bar
+ ldr x1, :got_auth:bar
+ adr x0, :got_auth:zed
+ ldr x1, [x0]
+ adr x0, :got_auth:zed
+ ldr x1, :got_auth:zed
+
#--- err.s
# RUN: llvm-mc -filetype=obj -triple=aarch64 err.s -o err.o
>From 8fa4f1946811548d18dd0cd0c11b72a93cc54abc Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Fri, 1 Nov 2024 13:18:43 +0300
Subject: [PATCH 2/7] Use `##` for comments in tests
---
lld/test/ELF/aarch64-got-relocations-pauth.s | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index f197c6250a8144..041b430c27b91a 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -98,10 +98,10 @@ _start:
# EXTERNAL-TINY: Hex dump of section '.got':
# EXTERNAL-TINY-NEXT: 0x00020380 00000000 00000080 00000000 000000a0
-# ^^
-# 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
-# ^^
-# 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
+## ^^
+## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
+## ^^
+## 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
# LOCAL-TINY: Symbol table '.symtab' contains {{.*}} entries:
# LOCAL-TINY: Num: Value Size Type Bind Vis Ndx Name
@@ -110,10 +110,10 @@ _start:
# LOCAL-TINY: Hex dump of section '.got':
# LOCAL-TINY-NEXT: 0x00020320 00000000 00000080 00000000 000000a0
-# ^^
-# 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
-# ^^
-# 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
+## ^^
+## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
+## ^^
+## 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA
# RUN: llvm-objdump -d external-tiny | FileCheck %s --check-prefix=EXTERNAL-TINY-ASM
>From 9af14a2948db6aae0b970054d482717b8bf3230c Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Mon, 18 Nov 2024 08:33:11 +0300
Subject: [PATCH 3/7] Address review comments
---
lld/test/ELF/aarch64-got-relocations-pauth.s | 44 ++++++--------------
1 file changed, 13 insertions(+), 31 deletions(-)
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index 041b430c27b91a..14baf84e9f7288 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -79,7 +79,7 @@ _start:
#--- ok-tiny.s
-# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux ok-tiny.s -o ok-tiny.o
+# RUN: llvm-mc -filetype=obj -triple=aarch64 ok-tiny.s -o ok-tiny.o
# RUN: ld.lld ok-tiny.o a.so -pie -o external-tiny
# RUN: llvm-readelf -r -S -x .got external-tiny | FileCheck %s --check-prefix=EXTERNAL-TINY
@@ -88,16 +88,16 @@ _start:
# RUN: llvm-readelf -r -S -x .got -s local-tiny | FileCheck %s --check-prefix=LOCAL-TINY
# EXTERNAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
-# EXTERNAL-TINY-NEXT: 0000000000020380 000000010000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0
-# EXTERNAL-TINY-NEXT: 0000000000020388 000000020000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0
+# EXTERNAL-TINY-NEXT: 0000000000020368 000000010000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0
+# EXTERNAL-TINY-NEXT: 0000000000020370 000000020000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0
## Symbol's values for bar and zed are equal since they contain no content (see Inputs/shared.s)
# LOCAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
-# LOCAL-TINY-NEXT: 0000000000020320 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260
-# LOCAL-TINY-NEXT: 0000000000020328 0000000000000411 R_AARCH64_AUTH_RELATIVE 10260
+# LOCAL-TINY-NEXT: 0000000000020308 0000000000000411 R_AARCH64_AUTH_RELATIVE 10248
+# LOCAL-TINY-NEXT: 0000000000020310 0000000000000411 R_AARCH64_AUTH_RELATIVE 10248
# EXTERNAL-TINY: Hex dump of section '.got':
-# EXTERNAL-TINY-NEXT: 0x00020380 00000000 00000080 00000000 000000a0
+# EXTERNAL-TINY-NEXT: 0x00020368 00000000 00000080 00000000 000000a0
## ^^
## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
## ^^
@@ -105,11 +105,11 @@ _start:
# LOCAL-TINY: Symbol table '.symtab' contains {{.*}} entries:
# LOCAL-TINY: Num: Value Size Type Bind Vis Ndx Name
-# LOCAL-TINY: 0000000000010260 0 FUNC GLOBAL DEFAULT 6 bar
-# LOCAL-TINY: 0000000000010260 0 NOTYPE GLOBAL DEFAULT 6 zed
+# LOCAL-TINY: 0000000000010248 0 FUNC GLOBAL DEFAULT 6 bar
+# LOCAL-TINY: 0000000000010248 0 NOTYPE GLOBAL DEFAULT 6 zed
# LOCAL-TINY: Hex dump of section '.got':
-# LOCAL-TINY-NEXT: 0x00020320 00000000 00000080 00000000 000000a0
+# LOCAL-TINY-NEXT: 0x00020308 00000000 00000080 00000000 000000a0
## ^^
## 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA
## ^^
@@ -118,36 +118,18 @@ _start:
# RUN: llvm-objdump -d external-tiny | FileCheck %s --check-prefix=EXTERNAL-TINY-ASM
# EXTERNAL-TINY-ASM: <_start>:
-# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20380
-# EXTERNAL-TINY-ASM-NEXT: ldr x1, [x0]
-# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20380
-# EXTERNAL-TINY-ASM-NEXT: ldr x1, 0x20380
-# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20388
-# EXTERNAL-TINY-ASM-NEXT: ldr x1, [x0]
-# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20388
-# EXTERNAL-TINY-ASM-NEXT: ldr x1, 0x20388
+# EXTERNAL-TINY-ASM-NEXT: adr x0, 0x20368
+# EXTERNAL-TINY-ASM-NEXT: ldr x1, 0x20370
# RUN: llvm-objdump -d local-tiny | FileCheck %s --check-prefix=LOCAL-TINY-ASM
# LOCAL-TINY-ASM: <_start>:
-# LOCAL-TINY-ASM-NEXT: adr x0, 0x20320
-# LOCAL-TINY-ASM-NEXT: ldr x1, [x0]
-# LOCAL-TINY-ASM-NEXT: adr x0, 0x20320
-# LOCAL-TINY-ASM-NEXT: ldr x1, 0x20320
-# LOCAL-TINY-ASM-NEXT: adr x0, 0x20328
-# LOCAL-TINY-ASM-NEXT: ldr x1, [x0]
-# LOCAL-TINY-ASM-NEXT: adr x0, 0x20328
-# LOCAL-TINY-ASM-NEXT: ldr x1, 0x20328
+# LOCAL-TINY-ASM-NEXT: adr x0, 0x20308
+# LOCAL-TINY-ASM-NEXT: ldr x1, 0x20310
.globl _start
_start:
adr x0, :got_auth:bar
- ldr x1, [x0]
- adr x0, :got_auth:bar
- ldr x1, :got_auth:bar
- adr x0, :got_auth:zed
- ldr x1, [x0]
- adr x0, :got_auth:zed
ldr x1, :got_auth:zed
#--- err.s
>From c9c3b8bec86f81a4ff36c89a58fef3ac174804ff Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Mon, 2 Dec 2024 01:26:30 +0300
Subject: [PATCH 4/7] Remove unneeded blank line in test
---
lld/test/ELF/aarch64-got-relocations-pauth.s | 1 -
1 file changed, 1 deletion(-)
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index 14baf84e9f7288..bbbc7b42e68eb4 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -78,7 +78,6 @@ _start:
add x1, x1, :got_auth_lo12:zed
#--- ok-tiny.s
-
# RUN: llvm-mc -filetype=obj -triple=aarch64 ok-tiny.s -o ok-tiny.o
# RUN: ld.lld ok-tiny.o a.so -pie -o external-tiny
>From 25fb571c111474494a7d2c0497b6592783998ec6 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Wed, 4 Dec 2024 14:50:34 +0300
Subject: [PATCH 5/7] Fix build after #118424
---
lld/ELF/InputSection.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 76af4ec4193a4f..efa7ba3e7cb063 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -817,7 +817,7 @@ uint64_t InputSectionBase::getRelocTargetVA(Ctx &ctx, const Relocation &r,
case RE_AARCH64_GOT_PAGE:
return r.sym->getGotVA(ctx) + a - getAArch64Page(ctx.in.got->getVA());
case R_GOT_PC:
- case R_AARCH64_AUTH_GOT_PC:
+ case RE_AARCH64_AUTH_GOT_PC:
case R_RELAX_TLS_GD_TO_IE:
return r.sym->getGotVA(ctx) + a - p;
case R_GOTPLT_GOTREL:
>From 6f3cb95c5a714af5ed6921a3aefb0b87856abc53 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Wed, 4 Dec 2024 14:50:52 +0300
Subject: [PATCH 6/7] Change reloc codes in tests (see also #118214)
---
lld/test/ELF/aarch64-got-relocations-pauth.s | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index bbbc7b42e68eb4..c429e0d85341b5 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -87,8 +87,8 @@ _start:
# RUN: llvm-readelf -r -S -x .got -s local-tiny | FileCheck %s --check-prefix=LOCAL-TINY
# EXTERNAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
-# EXTERNAL-TINY-NEXT: 0000000000020368 000000010000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0
-# EXTERNAL-TINY-NEXT: 0000000000020370 000000020000e201 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0
+# EXTERNAL-TINY-NEXT: 0000000000020368 0000000100000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 bar + 0
+# EXTERNAL-TINY-NEXT: 0000000000020370 0000000200000412 R_AARCH64_AUTH_GLOB_DAT 0000000000000000 zed + 0
## Symbol's values for bar and zed are equal since they contain no content (see Inputs/shared.s)
# LOCAL-TINY: Offset Info Type Symbol's Value Symbol's Name + Addend
>From 0c161dac70c7015ee505d2ce780a62faead7142b Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Wed, 4 Dec 2024 15:02:51 +0300
Subject: [PATCH 7/7] Fix formatting
---
lld/ELF/Relocations.cpp | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 4bd73e58b7c758..b08b85c96e445a 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -989,16 +989,15 @@ bool RelocationScanner::isStaticLinkTimeConstant(RelExpr e, RelType type,
const Symbol &sym,
uint64_t relOff) const {
// These expressions always compute a constant
- if (oneof<R_GOTPLT, R_GOT_OFF, R_RELAX_HINT, RE_MIPS_GOT_LOCAL_PAGE,
- RE_MIPS_GOTREL, RE_MIPS_GOT_OFF, RE_MIPS_GOT_OFF32,
- RE_MIPS_GOT_GP_PC, RE_AARCH64_GOT_PAGE_PC,
- RE_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC,
- R_GOTPLTONLY_PC, R_PLT_PC, R_PLT_GOTREL, R_PLT_GOTPLT,
- R_GOTPLT_GOTREL, R_GOTPLT_PC, RE_PPC32_PLTREL, RE_PPC64_CALL_PLT,
- RE_PPC64_RELAX_TOC, RE_RISCV_ADD, RE_AARCH64_GOT_PAGE,
- RE_AARCH64_AUTH_GOT, RE_AARCH64_AUTH_GOT_PC,
- RE_LOONGARCH_PLT_PAGE_PC, RE_LOONGARCH_GOT,
- RE_LOONGARCH_GOT_PAGE_PC>(e))
+ if (oneof<
+ R_GOTPLT, R_GOT_OFF, R_RELAX_HINT, RE_MIPS_GOT_LOCAL_PAGE,
+ RE_MIPS_GOTREL, RE_MIPS_GOT_OFF, RE_MIPS_GOT_OFF32, RE_MIPS_GOT_GP_PC,
+ RE_AARCH64_GOT_PAGE_PC, RE_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC,
+ R_GOTONLY_PC, R_GOTPLTONLY_PC, R_PLT_PC, R_PLT_GOTREL, R_PLT_GOTPLT,
+ R_GOTPLT_GOTREL, R_GOTPLT_PC, RE_PPC32_PLTREL, RE_PPC64_CALL_PLT,
+ RE_PPC64_RELAX_TOC, RE_RISCV_ADD, RE_AARCH64_GOT_PAGE,
+ RE_AARCH64_AUTH_GOT, RE_AARCH64_AUTH_GOT_PC, RE_LOONGARCH_PLT_PAGE_PC,
+ RE_LOONGARCH_GOT, RE_LOONGARCH_GOT_PAGE_PC>(e))
return true;
// These never do, except if the entire file is position dependent or if
More information about the llvm-branch-commits
mailing list