diff options
author | Eymen Ünay <eymenunay@outlook.com> | 2024-05-28 14:53:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 14:53:37 +0300 |
commit | f29352b63b448485177a2e2b31d864f808070c25 (patch) | |
tree | 14ea72d3e781e2887e8ce0b1095fc573e30fbec2 /llvm/lib/ExecutionEngine | |
parent | aefcdedf5b8c3832aa62e8ce02c7597b576d3a28 (diff) | |
download | llvm-f29352b63b448485177a2e2b31d864f808070c25.zip llvm-f29352b63b448485177a2e2b31d864f808070c25.tar.gz llvm-f29352b63b448485177a2e2b31d864f808070c25.tar.bz2 |
[RuntimeDyldChecker][AArch32] Add a PC offset to next_PC for ARM targets (#91746)
In ARM mode, the Program Counter (PC) points to the current instruction's
address + 8 instead of + 4. An offset is added to RuntimeDyldChecker to
use `next_pc` expression in JITLink tests with both Thumb and Arm.
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index 11fb21a..b98d455 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -369,7 +369,13 @@ private: uint64_t SymbolAddr = PCtx.IsInsideLoad ? Checker.getSymbolLocalAddr(Symbol) : Checker.getSymbolRemoteAddr(Symbol); - uint64_t NextPC = SymbolAddr + InstSize; + + // ARM PC offset is 8 instead of 4, because it accounts for an additional + // prefetch instruction that increments PC even though it is implicit. + auto TT = Checker.getTripleForSymbol(Checker.getTargetFlag(Symbol)); + uint64_t PCOffset = TT.getArch() == Triple::ArchType::arm ? 4 : 0; + + uint64_t NextPC = SymbolAddr + InstSize + PCOffset; return std::make_pair(EvalResult(NextPC), RemainingExpr); } |