Skip to content

[AArch64] Add support for pointer authentication relocations#801

Merged
Shankar Easwaran (quic-seaswara) merged 1 commit into
qualcomm:mainfrom
nezetic:auth-reloc-support
Feb 25, 2026
Merged

[AArch64] Add support for pointer authentication relocations#801
Shankar Easwaran (quic-seaswara) merged 1 commit into
qualcomm:mainfrom
nezetic:auth-reloc-support

Conversation

@nezetic

Copy link
Copy Markdown
Contributor

Implements basic PAuth support for AArch64 following the PAuth ABI Extension specification (2025Q1):
https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst

Adds:

  • R_AARCH64_AUTH_ABS64 (0x244): authenticated absolute relocations
  • R_AARCH64_AUTH_RELATIVE (0x411): authenticated relative relocations

Testing:
Covers PIE/non-PIE/static executables, as well as various corner cases from the spec like undefined weak references, COPY relocations and non-allocating sections.

Not included:
GOT/PLT signing, additional AUTH relocation types (future work).

Notes:
I changed the way GNULDBackend::recordRelativeReloc store relative relocations. The original map is only iterated once (in a linear way), but reversing the key / values allows to implement an efficient GNULDBackend::findRelativeReloc.

No changes to existing non-AUTH relocation behavior.

@svs-quic

Copy link
Copy Markdown
Contributor

pzhengqc might be a better suited to review this.

Comment thread lib/Target/AArch64/AArch64ELFDynamic.cpp
@quic-seaswara

Copy link
Copy Markdown
Contributor

Eli Friedman (@efriedma-quic) can you please review this change ?

Comment thread lib/Target/AArch64/AArch64LDBackend.cpp Outdated
Comment thread lib/Target/AArch64/AArch64RelocationFunctions.h Outdated
Comment thread lib/Target/AArch64/AArch64Relocator.cpp Outdated
Comment thread test/AArch64/standalone/Relocations/PAuthReloc.s
Comment thread test/AArch64/standalone/Relocations/PAuthReloc.s
@nezetic Cédric Tessier (nezetic) force-pushed the auth-reloc-support branch 5 times, most recently from 0a0c802 to 51874e0 Compare February 23, 2026 18:29
Implements basic PAuth support for AArch64 following the PAuth ABI Extension
specification (2025Q1):
https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst

**Adds:**
- R_AARCH64_AUTH_ABS64 (0x244): authenticated absolute relocations
- R_AARCH64_AUTH_RELATIVE (0x411): authenticated relative relocations

**Testing:**
Covers PIE/non-PIE/static executables, as well as various corner cases from the
spec like undefined weak references, COPY relocations and non-allocating sections.

**Not included:**
GOT/PLT signing, additional AUTH relocation types (future work).

**Notes:**
I changed the way *GNULDBackend::recordRelativeReloc* store relative relocations.
The original map is only iterated once (in a linear way), but reversing
the key / values allows to implement an efficient *GNULDBackend::findRelativeReloc*.

No changes to existing non-AUTH relocation behavior.

Signed-off-by: Cedric Tessier <ctessier@qti.qualcomm.com>
Comment thread include/eld/Target/GNULDBackend.h
Comment thread lib/Target/AArch64/AArch64ELFDynamic.cpp
Comment thread test/AArch64/standalone/Relocations/PAuthReloc.s
Comment thread test/AArch64/standalone/Relocations/PAuthReloc.s
@quic-seaswara Shankar Easwaran (quic-seaswara) merged commit 4a3231e into qualcomm:main Feb 25, 2026
3 checks passed
ResolveInfo *rsym = pReloc.symInfo();
Relocator::DWord A = pReloc.addend();
Relocator::DWord S = pParent.getSymValue(&pReloc);
Relocator::Address targetVal = S + A;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this changes the behavior for non-pauth code: the value of "S" is modified by the code below (if (rsym && rsym->reserved() & Relocator::ReservePLT) etc.). I assume that's not intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this was never intended :(

I submitted a PR to fix this regression (#1334).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants