[llvm] [BOLT][AArch64] Fix static binary patching for ELF. (PR #97710)
Vladislav Khmelevsky via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 05:07:04 PDT 2024
================
@@ -5265,6 +5265,21 @@ void RewriteInstance::patchELFGOT(ELFObjectFile<ELFT> *File) {
GOTContents.size());
++GOTEntry) {
if (uint64_t NewAddress = getNewFunctionAddress(*GOTEntry)) {
+ auto *Function = BC->getBinaryFunctionAtAddress(*GOTEntry);
+
+ // On static binaries, avoid patching got entries that did not belong to
+ // the original text section and have an alias. One such special case is
+ // the '_init' function that belongs to the '.init' section. It has
+ // '.init' as an alias, which points to the same address of '_init' in the
+ // original binary.
+ if (BC->IsStaticExecutable && !Function->Aliases.empty() &&
----------------
yota9 wrote:
This way the function entry won't be patched either I think? It might also be a problem
https://github.com/llvm/llvm-project/pull/97710
More information about the llvm-commits
mailing list