summaryrefslogtreecommitdiff
path: root/bolt/lib/Rewrite/RewriteInstance.cpp
diff options
context:
space:
mode:
authorMaksim Panchenko <maks@fb.com>2025-11-08 00:31:03 -0800
committerGitHub <noreply@github.com>2025-11-08 00:31:03 -0800
commitaf456dfa111bbfc54950fd56a95a446488add406 (patch)
tree108d183fd91b54233ca1874949fd6d1eea13db74 /bolt/lib/Rewrite/RewriteInstance.cpp
parent77342761a9060159f09c0c6d5aa3da2e543a4877 (diff)
[BOLT] Refactor tracking internals of BinaryFunction. NFCI (#167074)
In addition to tracking offsets inside a `BinaryFunction` that are referenced by data relocations, we need to track those relocations too. Plus, we will need to map symbols referenced by such relocations back to the containing function. This change introduces `BinaryFunction::InternalRefDataRelocations` to track the aforementioned relocations and expands `BinaryContext::SymbolToFunctionMap` to include local/temp symbols involved in relocation processing. There is no functional change introduced that should affect the output. Future PRs will use the new tracking capabilities.
Diffstat (limited to 'bolt/lib/Rewrite/RewriteInstance.cpp')
-rw-r--r--bolt/lib/Rewrite/RewriteInstance.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index ab3431ef8bd5..5769577aa3f7 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2954,8 +2954,10 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
// if-condition above) so we're handling a relocation from a function
// to itself. RISC-V uses such relocations for branches, for example.
// These should not be registered as externally references offsets.
- if (!ContainingBF)
- ReferencedBF->registerReferencedOffset(RefFunctionOffset);
+ if (!ContainingBF && !ReferencedBF->isInConstantIsland(Address)) {
+ ReferencedBF->registerInternalRefDataRelocation(RefFunctionOffset,
+ Rel.getOffset());
+ }
}
if (opts::Verbosity > 1 &&
BinarySection(*BC, RelocatedSection).isWritable())