[PATCH] D153345: [BOLT] Don't register internal func relocs as external references
Job Noorman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 00:40:46 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG38ba2824c856: [BOLT] Don't register internal func relocs as external references (authored by jobnoorman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153345/new/
https://reviews.llvm.org/D153345
Files:
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2875,7 +2875,13 @@
ReferencedSymbol =
ReferencedBF->getOrCreateLocalLabel(Address,
/*CreatePastEnd =*/true);
- ReferencedBF->registerReferencedOffset(RefFunctionOffset);
+
+ // If ContainingBF != nullptr, it equals ReferencedBF (see
+ // 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 (opts::Verbosity > 1 &&
BinarySection(*BC, RelocatedSection).isWritable())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153345.533491.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230622/04e829a5/attachment.bin>
More information about the llvm-commits
mailing list