[llvm] [BOLT] Check if symbol is in data area of function (PR #160143)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 14:07:41 PDT 2025


================
@@ -2374,8 +2374,16 @@ BinaryFunction *BinaryContext::getFunctionForSymbol(const MCSymbol *Symbol,
     return nullptr;
 
   BinaryFunction *BF = BFI->second;
-  if (EntryDesc)
+  if (EntryDesc) {
+    const uint64_t Address = BF->getAddress() + Symbol->getOffset();
----------------
maksfb wrote:

I see. I'd prefer to make `getEntryIDForSymbol()` return an `optional` (i.e. remove the unreachable) and not rely on the implicit behavior.

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


More information about the llvm-commits mailing list