[llvm] [BOLT] Support computed goto and allow map addrs inside functions. (PR #120267)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 14:01:36 PST 2025


================
@@ -2439,6 +2439,13 @@ void RewriteInstance::readDynamicRelocations(const SectionRef &Section,
     if (Symbol)
       SymbolIndex[Symbol] = getRelocationSymbol(InputFile, Rel);
 
+    const uint64_t SymAddress = SymbolAddress + Addend;
+    BinaryFunction *Func = BC->getBinaryFunctionContainingAddress(SymAddress);
+    if (Func && !Func->isInConstantIsland(SymAddress)) {
+      if (const uint64_t SymOffset = SymAddress - Func->getAddress())
+        Func->addEntryPointAtOffset(SymOffset);
+    }
----------------
maksfb wrote:

Can we add more checks? E.g., what happens if `Symbol` points to a function and `SymAddress` falls into another function? What if the reference is in the constant island? It's better to fail at build time.

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


More information about the llvm-commits mailing list