[llvm-branch-commits] [NFC][ELF][AArch64] Replace memtag hack with less-confusing code (PR #171182)
Jessica Clarke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 8 10:35:52 PST 2025
================
@@ -741,7 +741,7 @@ static void addRelativeReloc(Ctx &ctx, InputSectionBase &isec,
// https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#841extended-semantics-of-r_aarch64_relative
if (sym.isTagged() && !isAArch64Auth &&
(addend < 0 || static_cast<uint64_t>(addend) >= sym.getSize()))
- isec.addReloc({expr, type, offsetInSec, addend, &sym});
+ isec.addReloc({R_ADDEND_NEG, type, offsetInSec, addend, &sym});
----------------
jrtc27 wrote:
I'd like to move this into RelocationBaseSection::addReloc itself, like how is done for Elf_Rel, as otherwise any other place that calls RelocationBaseSection::add(Relative)Reloc needs to know about this oddity. In practice there are none, but the less "weird" all these various ABI extensions are in terms of fitting into LLD's APIs the better. Downstream in Morello LLD we've similarly hidden the way R_MORELLO_RELATIVE works (it emits a "fragment" that describes the capability base/length/permissions, and the dynamic relocation's addend is the capability offset) so you "just" call RelocationBaseSection::add(Relative)Reloc and all the magic for how to actually do that happens for you. Following that for MTE globals would be a good idea IMO.
https://github.com/llvm/llvm-project/pull/171182
More information about the llvm-branch-commits
mailing list