diff options
| author | Maksim Panchenko <maks@fb.com> | 2025-10-31 08:56:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 08:56:30 -0700 |
| commit | 7c01a905451644c3a195bc32e1b866d3261b5ecc (patch) | |
| tree | 73ac5c47c1dad219029fbcb591f1aefd31193542 /bolt/lib/Core/BinaryFunction.cpp | |
| parent | f6d6d2d5a260169abc1d12e8d828fb74b0d3372a (diff) | |
[BOLT] Refactor handling of branch targets. NFCI (#165828)
Refactor code that verifies external branch destinations and creates
secondary entry points.
Diffstat (limited to 'bolt/lib/Core/BinaryFunction.cpp')
| -rw-r--r-- | bolt/lib/Core/BinaryFunction.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index fbe186454351..ddaad6eef614 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -1697,21 +1697,12 @@ bool BinaryFunction::scanExternalRefs() { if (!TargetFunction || ignoreFunctionRef(*TargetFunction)) continue; - const uint64_t FunctionOffset = - TargetAddress - TargetFunction->getAddress(); - if (!TargetFunction->isInConstantIsland(TargetAddress)) { - BranchTargetSymbol = - FunctionOffset - ? TargetFunction->addEntryPointAtOffset(FunctionOffset) - : TargetFunction->getSymbol(); - } else { - TargetFunction->setIgnored(); - BC.outs() << "BOLT-WARNING: Ignoring entry point at address 0x" - << Twine::utohexstr(Address) - << " in constant island of function " << *TargetFunction - << '\n'; + // Get a reference symbol for the function when address is a valid code + // reference. + BranchTargetSymbol = + BC.handleExternalBranchTarget(TargetAddress, *TargetFunction); + if (!BranchTargetSymbol) continue; - } } // Can't find more references. Not creating relocations since we are not |
