From f53eb88d2589590960b56a3cc54c5da97cc41842 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 10 Apr 2025 10:38:59 -0700 Subject: [PATCH] ELF: Remove lock from MTE global relocation handling code. This lock is unnecessary because we can add the relocations to shards and let them be sorted later. Reviewers: smithp35, fmayer, MaskRay Reviewed By: MaskRay Pull Request: https://github.com/llvm/llvm-project/pull/135123 --- lld/ELF/Relocations.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 81de664fd1c2..277acb26987b 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -847,9 +847,8 @@ static void addRelativeReloc(Ctx &ctx, InputSectionBase &isec, Partition &part = isec.getPartition(ctx); if (sym.isTagged()) { - std::lock_guard lock(ctx.relocMutex); - part.relaDyn->addRelativeReloc(ctx.target->relativeRel, isec, offsetInSec, - sym, addend, type, expr); + part.relaDyn->addRelativeReloc(ctx.target->relativeRel, isec, + offsetInSec, sym, addend, type, expr); // With MTE globals, we always want to derive the address tag by `ldg`-ing // the symbol. When we have a RELATIVE relocation though, we no longer have // a reference to the symbol. Because of this, when we have an addend that