[lld] f53eb88 - ELF: Remove lock from MTE global relocation handling code.

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 10:39:02 PDT 2025


Author: Peter Collingbourne
Date: 2025-04-10T10:38:59-07:00
New Revision: f53eb88d2589590960b56a3cc54c5da97cc41842

URL: https://github.com/llvm/llvm-project/commit/f53eb88d2589590960b56a3cc54c5da97cc41842
DIFF: https://github.com/llvm/llvm-project/commit/f53eb88d2589590960b56a3cc54c5da97cc41842.diff

LOG: 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

Added: 
    

Modified: 
    lld/ELF/Relocations.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 81de664fd1c23..277acb26987bc 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<std::mutex> lock(ctx.relocMutex);
-    part.relaDyn->addRelativeReloc(ctx.target->relativeRel, isec, offsetInSec,
-                                   sym, addend, type, expr);
+    part.relaDyn->addRelativeReloc<shard>(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


        


More information about the llvm-commits mailing list