[llvm] [BOLT][Linux] Support ORC for alternative instructions (PR #96709)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 14:58:42 PDT 2024


================
@@ -4472,6 +4472,18 @@ MCInst *BinaryFunction::getInstructionAtOffset(uint64_t Offset) {
   }
 }
 
+MCInst *BinaryFunction::getInstructionContainingOffset(uint64_t Offset) {
+  assert(CurrentState == State::Disassembled && "Wrong function state");
+
+  if (Offset > Size)
----------------
maksfb wrote:

> is this something that can ever happen

It depends on how we define the interface. If currently someone accidentally calls this with a large offset, they will get no instruction. Technically, this can happen when a function has a padding space that is considered a part of the function, but does not contain any instructions. That's why we have `Size` and `MaxSize` for `BinaryFunction`.

https://github.com/llvm/llvm-project/pull/96709


More information about the llvm-commits mailing list