[llvm] [Exegesis] Do not assume the size and layout of the assembled snippet (PR #79636)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 15:11:41 PST 2024
================
@@ -365,11 +365,18 @@ Expected<ExecutableFunction> ExecutableFunction::create(
auto SymbolSizes = object::computeSymbolSizes(*ObjectFileHolder.getBinary());
// Get the size of the function that we want to call into (with the name of
- // FunctionID). This should always be the third symbol returned by
- // calculateSymbolSizes.
- assert(SymbolSizes.size() == 3);
- assert(cantFail(std::get<0>(SymbolSizes[2]).getName()) == FunctionID);
- uintptr_t CodeSize = std::get<1>(SymbolSizes[2]);
+ // FunctionID).
+ auto SymbolIt = llvm::find_if(SymbolSizes, [&](const auto &Pair) {
+ auto SymbolName = Pair.first.getName();
+ if (SymbolName)
+ return *SymbolName == FunctionID;
+ // Suppress the error.
----------------
mshockwave wrote:
Done
https://github.com/llvm/llvm-project/pull/79636
More information about the llvm-commits
mailing list