-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[PAC][lld][AArch64][ELF] Support signed GOT with tiny code model #113816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-lld-elf Author: Daniil Kovalev (kovdan01) ChangesDepends on #113812 Support Full diff: https://github.com/llvm/llvm-project/pull/113816.diff 5 Files Affected:
diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index 86f509f3fd78a7..2f2e0c2a52b0ef 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 R_AARCH64_AUTH_GOT;
+ case R_AARCH64_AUTH_GOT_LD_PREL19:
+ case R_AARCH64_AUTH_GOT_ADR_PREL_LO21:
+ return R_AARCH64_AUTH_GOT_PC;
case R_AARCH64_LD64_GOTPAGE_LO15:
return R_AARCH64_GOT_PAGE;
case R_AARCH64_ADR_GOT_PAGE:
@@ -549,6 +552,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;
@@ -569,6 +573,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 ccc7cf8c6e2de9..ba135afd3580bf 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -788,6 +788,7 @@ uint64_t InputSectionBase::getRelocTargetVA(Ctx &ctx, const Relocation &r,
case R_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 2d3815e58b5f67..324a97d7a55f41 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -210,11 +210,11 @@ static bool needsPlt(RelExpr expr) {
}
bool lld::elf::needsGot(RelExpr expr) {
- return oneof<R_GOT, R_AARCH64_AUTH_GOT, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE,
- R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_AARCH64_GOT_PAGE_PC,
- R_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC, R_GOTPLT,
- R_AARCH64_GOT_PAGE, R_LOONGARCH_GOT, R_LOONGARCH_GOT_PAGE_PC>(
- expr);
+ return oneof<R_GOT, R_AARCH64_AUTH_GOT, R_AARCH64_AUTH_GOT_PC, R_GOT_OFF,
+ R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32,
+ R_AARCH64_GOT_PAGE_PC, R_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC,
+ R_GOTPLT, R_AARCH64_GOT_PAGE, R_LOONGARCH_GOT,
+ R_LOONGARCH_GOT_PAGE_PC>(expr);
}
// True if this expression is of the form Sym - X, where X is a position in the
@@ -1011,8 +1011,8 @@ bool RelocationScanner::isStaticLinkTimeConstant(RelExpr e, RelType type,
R_GOTONLY_PC, R_GOTPLTONLY_PC, R_PLT_PC, R_PLT_GOTREL, R_PLT_GOTPLT,
R_GOTPLT_GOTREL, R_GOTPLT_PC, R_PPC32_PLTREL, R_PPC64_CALL_PLT,
R_PPC64_RELAX_TOC, R_RISCV_ADD, R_AARCH64_GOT_PAGE,
- R_AARCH64_AUTH_GOT, R_LOONGARCH_PLT_PAGE_PC, R_LOONGARCH_GOT,
- R_LOONGARCH_GOT_PAGE_PC>(e))
+ R_AARCH64_AUTH_GOT, R_AARCH64_AUTH_GOT_PC, R_LOONGARCH_PLT_PAGE_PC,
+ R_LOONGARCH_GOT, R_LOONGARCH_GOT_PAGE_PC>(e))
return true;
// These never do, except if the entire file is position dependent or if
@@ -1126,7 +1126,8 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
// Many LoongArch TLS relocs reuse the R_LOONGARCH_GOT type, in which
// case the NEEDS_GOT flag shouldn't get set.
bool needsGotAuth =
- (expr == R_AARCH64_AUTH_GOT || expr == R_AARCH64_AUTH_GOT_PAGE_PC);
+ (expr == R_AARCH64_AUTH_GOT || expr == R_AARCH64_AUTH_GOT_PC ||
+ expr == R_AARCH64_AUTH_GOT_PAGE_PC);
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
if (!(flags & NEEDS_GOT)) {
if (needsGotAuth)
diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h
index 20d88de402ac18..38d55d46116569 100644
--- a/lld/ELF/Relocations.h
+++ b/lld/ELF/Relocations.h
@@ -89,6 +89,7 @@ enum RelExpr {
R_AARCH64_AUTH_GOT_PAGE_PC,
R_AARCH64_GOT_PAGE,
R_AARCH64_AUTH_GOT,
+ R_AARCH64_AUTH_GOT_PC,
R_AARCH64_PAGE_PC,
R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC,
R_AARCH64_TLSDESC_PAGE,
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index f04e3d953388ce..c43f1ca251a9a8 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -78,6 +78,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-none-linux err.s -o err.o
|
@llvm/pr-subscribers-lld Author: Daniil Kovalev (kovdan01) ChangesDepends on #113812 Support Full diff: https://github.com/llvm/llvm-project/pull/113816.diff 5 Files Affected:
diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index 86f509f3fd78a7..2f2e0c2a52b0ef 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 R_AARCH64_AUTH_GOT;
+ case R_AARCH64_AUTH_GOT_LD_PREL19:
+ case R_AARCH64_AUTH_GOT_ADR_PREL_LO21:
+ return R_AARCH64_AUTH_GOT_PC;
case R_AARCH64_LD64_GOTPAGE_LO15:
return R_AARCH64_GOT_PAGE;
case R_AARCH64_ADR_GOT_PAGE:
@@ -549,6 +552,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;
@@ -569,6 +573,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 ccc7cf8c6e2de9..ba135afd3580bf 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -788,6 +788,7 @@ uint64_t InputSectionBase::getRelocTargetVA(Ctx &ctx, const Relocation &r,
case R_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 2d3815e58b5f67..324a97d7a55f41 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -210,11 +210,11 @@ static bool needsPlt(RelExpr expr) {
}
bool lld::elf::needsGot(RelExpr expr) {
- return oneof<R_GOT, R_AARCH64_AUTH_GOT, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE,
- R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_AARCH64_GOT_PAGE_PC,
- R_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC, R_GOTPLT,
- R_AARCH64_GOT_PAGE, R_LOONGARCH_GOT, R_LOONGARCH_GOT_PAGE_PC>(
- expr);
+ return oneof<R_GOT, R_AARCH64_AUTH_GOT, R_AARCH64_AUTH_GOT_PC, R_GOT_OFF,
+ R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32,
+ R_AARCH64_GOT_PAGE_PC, R_AARCH64_AUTH_GOT_PAGE_PC, R_GOT_PC,
+ R_GOTPLT, R_AARCH64_GOT_PAGE, R_LOONGARCH_GOT,
+ R_LOONGARCH_GOT_PAGE_PC>(expr);
}
// True if this expression is of the form Sym - X, where X is a position in the
@@ -1011,8 +1011,8 @@ bool RelocationScanner::isStaticLinkTimeConstant(RelExpr e, RelType type,
R_GOTONLY_PC, R_GOTPLTONLY_PC, R_PLT_PC, R_PLT_GOTREL, R_PLT_GOTPLT,
R_GOTPLT_GOTREL, R_GOTPLT_PC, R_PPC32_PLTREL, R_PPC64_CALL_PLT,
R_PPC64_RELAX_TOC, R_RISCV_ADD, R_AARCH64_GOT_PAGE,
- R_AARCH64_AUTH_GOT, R_LOONGARCH_PLT_PAGE_PC, R_LOONGARCH_GOT,
- R_LOONGARCH_GOT_PAGE_PC>(e))
+ R_AARCH64_AUTH_GOT, R_AARCH64_AUTH_GOT_PC, R_LOONGARCH_PLT_PAGE_PC,
+ R_LOONGARCH_GOT, R_LOONGARCH_GOT_PAGE_PC>(e))
return true;
// These never do, except if the entire file is position dependent or if
@@ -1126,7 +1126,8 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
// Many LoongArch TLS relocs reuse the R_LOONGARCH_GOT type, in which
// case the NEEDS_GOT flag shouldn't get set.
bool needsGotAuth =
- (expr == R_AARCH64_AUTH_GOT || expr == R_AARCH64_AUTH_GOT_PAGE_PC);
+ (expr == R_AARCH64_AUTH_GOT || expr == R_AARCH64_AUTH_GOT_PC ||
+ expr == R_AARCH64_AUTH_GOT_PAGE_PC);
uint16_t flags = sym.flags.load(std::memory_order_relaxed);
if (!(flags & NEEDS_GOT)) {
if (needsGotAuth)
diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h
index 20d88de402ac18..38d55d46116569 100644
--- a/lld/ELF/Relocations.h
+++ b/lld/ELF/Relocations.h
@@ -89,6 +89,7 @@ enum RelExpr {
R_AARCH64_AUTH_GOT_PAGE_PC,
R_AARCH64_GOT_PAGE,
R_AARCH64_AUTH_GOT,
+ R_AARCH64_AUTH_GOT_PC,
R_AARCH64_PAGE_PC,
R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC,
R_AARCH64_TLSDESC_PAGE,
diff --git a/lld/test/ELF/aarch64-got-relocations-pauth.s b/lld/test/ELF/aarch64-got-relocations-pauth.s
index f04e3d953388ce..c43f1ca251a9a8 100644
--- a/lld/test/ELF/aarch64-got-relocations-pauth.s
+++ b/lld/test/ELF/aarch64-got-relocations-pauth.s
@@ -78,6 +78,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-none-linux err.s -o err.o
|
# ^^ | ||
# 0b10000000 bit 63 address diversity = true, bits 61..60 key = IA | ||
# ^^ | ||
# 0b10100000 bit 63 address diversity = true, bits 61..60 key = DA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume these are intentionally not matched. In that case, is there a good reason to keep them in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thanks for the explanation. I think I made a similar comment in one of the other PRs before I saw this. Feel free to ignore that/mark it resolved.
0d23449
to
38d5936
Compare
71a9746
to
e841e19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, LGTM, but lets get another maintainer to take a look before landing.
well, assuming presubmit is working. I see a number of test failures, ATM. |
@ilovepi Yes, these are currently expected - as mentioned in the PR description, it depends on #114525 (codegen support for the feature). The dependency isn't included in the Graphite PR stack since this does not cause merge conflicts (different parts of llvm are altered) - I find it easier to keep PRs separate if it's possible and just mention unmerged dependencies in description (for me, it makes updating PRs more robust). |
38d5936
to
42ca2d9
Compare
e841e19
to
69bc310
Compare
@@ -78,6 +78,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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none
is also an OS component and is misleading when used together with linux
.
Just use aarch64
(or aarch64-linux
when it's important to mention Linux, usually it's not)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but the description should mention why R_AARCH64_AUTH_GOT_PC is added and the existing RelExpr member that is similar to it.
|
||
.globl _start | ||
_start: | ||
adr x0, :got_auth:bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for so many instructions.
We want very few instructions that look like simplified real-world codegen. While it's important to test two symbols to add some nuance, we can simplify the code here. Perhaps we just need
adr x0, :got_auth:bar
ldr x1, :got_auth:zed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggestion, removed excessive instructions in 3c80d75
1621897
to
bf7d8a9
Compare
82a5205
to
ecc8b14
Compare
b277e3b
to
b8a4abd
Compare
ecc8b14
to
1de7b3e
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
b8a4abd
to
e1f8260
Compare
0c161da
to
758fac9
Compare
d7336f6
to
6f44978
Compare
758fac9
to
e7443e9
Compare
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might just use tiny1 tiny2 instead of local-tiny external-tiny, since we may test both preemptible and non-preemptible symbols. local/external isn't accurate linker term anyway (local may mean the local binding)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6f44978
to
8dba1cd
Compare
e7443e9
to
7d94945
Compare
8dba1cd
to
03f9115
Compare
45898ed
to
a0c30ce
Compare
Support `R_AARCH64_AUTH_GOT_ADR_PREL_LO21` and `R_AARCH64_AUTH_GOT_LD_PREL19` GOT-generating relocations.
a0c30ce
to
bc3a2e4
Compare
Depends on #114525
Support
R_AARCH64_AUTH_GOT_ADR_PREL_LO21
andR_AARCH64_AUTH_GOT_LD_PREL19
GOT-generating relocations. A corresponding
RE_AARCH64_AUTH_GOT_PC
memberof
RelExpr
is added, which is an AUTH-specific variant ofR_GOT_PC
.