Skip to content

Commit 721c31e

Browse files
committed
Revert "[BOLT] Avoid reference updates for non-JT symbol operands (#88838)"
This reverts commit 9d5411f. Breaks aarch64 buildbot: https://lab.llvm.org/buildbot/#/builders/221/builds/22130
1 parent cc6113d commit 721c31e

File tree

2 files changed

+4
-64
lines changed

2 files changed

+4
-64
lines changed

bolt/lib/Passes/ValidateMemRefs.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ bool ValidateMemRefs::checkAndFixJTReference(BinaryFunction &BF, MCInst &Inst,
2929
if (!BD)
3030
return false;
3131

32-
JumpTable *JT = BC.getJumpTableContainingAddress(BD->getAddress());
32+
const uint64_t TargetAddress = BD->getAddress() + Offset;
33+
JumpTable *JT = BC.getJumpTableContainingAddress(TargetAddress);
3334
if (!JT)
3435
return false;
3536

@@ -42,9 +43,8 @@ bool ValidateMemRefs::checkAndFixJTReference(BinaryFunction &BF, MCInst &Inst,
4243
// the jump table label with a regular rodata reference. Get a
4344
// non-JT reference by fetching the symbol 1 byte before the JT
4445
// label.
45-
MCSymbol *NewSym = BC.getOrCreateGlobalSymbol(BD->getAddress() - 1, "DATAat");
46-
BC.MIB->setOperandToSymbolRef(Inst, OperandNum, NewSym, Offset + 1, &*BC.Ctx,
47-
0);
46+
MCSymbol *NewSym = BC.getOrCreateGlobalSymbol(TargetAddress - 1, "DATAat");
47+
BC.MIB->setOperandToSymbolRef(Inst, OperandNum, NewSym, 1, &*BC.Ctx, 0);
4848
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: replaced reference @" << BF.getPrintName()
4949
<< " from " << BD->getName() << " to " << NewSym->getName()
5050
<< " + 1\n");

bolt/test/X86/jt-symbol-disambiguation-4.s

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)