[llvm] [BOLT] Support computed goto and allow map addrs inside functions (PR #120267)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 21:40:05 PST 2025
================
@@ -2439,6 +2439,26 @@ void RewriteInstance::readDynamicRelocations(const SectionRef &Section,
if (Symbol)
SymbolIndex[Symbol] = getRelocationSymbol(InputFile, Rel);
+ const uint64_t ReferencedAddress = SymbolAddress + Addend;
+ BinaryFunction *Func =
+ BC->getBinaryFunctionContainingAddress(ReferencedAddress);
+
+ if (Func) {
+ if (!Func->isInConstantIsland(ReferencedAddress)) {
+ if (const uint64_t ReferenceOffset =
+ ReferencedAddress - Func->getAddress()) {
+ Func->addEntryPointAtOffset(ReferenceOffset);
+ } else if (ReferencedAddress < Func->getAddress()) {
+ BC->errs() << "BOLT-ERROR: Unable to compute symbol offset.\n";
+ exit(1);
+ }
+ } else {
+ BC->errs() << "BOLT-ERROR: Referenced address: " << ReferencedAddress
----------------
maksfb wrote:
nit: error message format
```suggestion
BC->errs() << "BOLT-ERROR: referenced address: " << ReferencedAddress
```
https://github.com/llvm/llvm-project/pull/120267
More information about the llvm-commits
mailing list