File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -5291,6 +5291,19 @@ void RewriteInstance::patchELFGOT(ELFObjectFile<ELFT> *File) {
5291
5291
GOTContents.size ());
5292
5292
++GOTEntry) {
5293
5293
if (uint64_t NewAddress = getNewFunctionAddress (*GOTEntry)) {
5294
+ auto *Function = BC->getBinaryFunctionAtAddress (*GOTEntry);
5295
+
5296
+ // On static binaries, avoid patching got entries that did not belong to
5297
+ // the original text section. One such special case is the '_init'
5298
+ // function, belonging to the '.init' section.
5299
+ if (BC->IsStaticExecutable &&
5300
+ Function->getOriginSectionName () != " .bolt.org.text" ) {
5301
+ LLVM_DEBUG (dbgs () << " BOLT-DEBUG: ignoring GOT entry 0x"
5302
+ << Twine::utohexstr (*GOTEntry) << " for '"
5303
+ << Function->getOneName () << " '" << ' \n ' );
5304
+ continue ;
5305
+ }
5306
+
5294
5307
LLVM_DEBUG (dbgs () << " BOLT-DEBUG: patching GOT entry 0x"
5295
5308
<< Twine::utohexstr (*GOTEntry) << " with 0x"
5296
5309
<< Twine::utohexstr (NewAddress) << ' \n ' );
You can’t perform that action at this time.
0 commit comments