Skip to content

Commit 83590c4

Browse files
committed
Revert expression decoding in next_pc
1 parent 164b5e2 commit 83590c4

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -354,41 +354,21 @@ class RuntimeDyldCheckerExprEval {
354354
EvalResult(("Cannot decode unknown symbol '" + Symbol + "'").str()),
355355
"");
356356

357-
// if there is an offset number expr
358-
int64_t SymbolOffset = 0;
359-
BinOpToken BinOp;
360-
std::tie(BinOp, RemainingExpr) = parseBinOpToken(RemainingExpr);
361-
switch (BinOp) {
362-
case BinOpToken::Add: {
363-
EvalResult Number;
364-
std::tie(Number, RemainingExpr) = evalNumberExpr(RemainingExpr);
365-
SymbolOffset = Number.getValue();
366-
break;
367-
}
368-
case BinOpToken::Invalid:
369-
break;
370-
default:
371-
return std::make_pair(
372-
unexpectedToken(RemainingExpr, RemainingExpr,
373-
"expected '+' for offset or ')' if no offset"),
374-
"");
375-
}
376-
377357
if (!RemainingExpr.starts_with(")"))
378358
return std::make_pair(
379359
unexpectedToken(RemainingExpr, RemainingExpr, "expected ')'"), "");
380360
RemainingExpr = RemainingExpr.substr(1).ltrim();
381361

382362
MCInst Inst;
383363
uint64_t InstSize;
384-
if (!decodeInst(Symbol, Inst, InstSize, SymbolOffset))
364+
if (!decodeInst(Symbol, Inst, InstSize, 0))
385365
return std::make_pair(
386366
EvalResult(("Couldn't decode instruction at '" + Symbol + "'").str()),
387367
"");
388368

389-
uint64_t SymbolAddr =
390-
PCtx.IsInsideLoad ? Checker.getSymbolLocalAddr(Symbol)
391-
: Checker.getSymbolRemoteAddr(Symbol) + SymbolOffset;
369+
uint64_t SymbolAddr = PCtx.IsInsideLoad
370+
? Checker.getSymbolLocalAddr(Symbol)
371+
: Checker.getSymbolRemoteAddr(Symbol);
392372

393373
// ARM mode adds an offset of 4 bytes to PC
394374
auto TT = Checker.getTripleForSymbol(Checker.getTargetFlag(Symbol));

llvm/test/ExecutionEngine/JITLink/AArch32/ELF_relocations_arm.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# CHECK-INSTR: 0000000c <call_target_arm>
3030
# CHECK-INSTR: 00000010 <call_target_thumb>
3131
# jitlink-check: decode_operand(call_site + 0, 0) = call_target_arm - next_pc(call_site)
32-
# jitlink-check: decode_operand(call_site + 4, 0) = call_target_thumb - next_pc(call_site + 4)
32+
# jitlink-check: decode_operand(call_site + 4, 0) = call_target_thumb - (call_site + 12)
3333
.globl call_site
3434
.type call_site,%function
3535
.p2align 2

0 commit comments

Comments
 (0)