[BOLT][AArch64] add lock to FixRelaxations pass

Since the pass is multithreaded, BC.Ctx must be protected. Otherwise we get crashes when processing.

Reviewed by: yota9

Differential Revision: https://reviews.llvm.org/D141465
This commit is contained in:
Denis Revunov 2023-01-11 03:38:47 -05:00
parent 6f00e11657
commit c8ff968b84

View File

@ -39,6 +39,7 @@ void FixRelaxations::runOnFunction(BinaryFunction &BF) {
if (!Symbol || AdrpSymbol == Symbol)
continue;
auto L = BC.scopeLock();
const int64_t Addend = BC.MIB->getTargetAddend(Add);
BC.MIB->setOperandToSymbolRef(Adrp, /*OpNum*/ 1, Symbol, Addend,
BC.Ctx.get(), ELF::R_AARCH64_NONE);