From: Vladislav Khmelevsky Date: Sun, 20 Mar 2022 13:10:27 +0000 (+0300) Subject: [BOLT] LongJmp: Check for shouldEmit X-Git-Tag: upstream/15.0.7~11811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c14519ecbba54870553611ed34dbec596e1f7e7;p=platform%2Fupstream%2Fllvm.git [BOLT] LongJmp: Check for shouldEmit Check that the function will be emitted in the final binary. Preserving old function address is needed in case it is PLT trampiline, that is currently not moved by the BOLT. Differential Revision: https://reviews.llvm.org/D122098 --- diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index 8a9835d..a848fdc 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -1534,6 +1534,9 @@ void BinaryContext::preprocessDebugInfo() { } bool BinaryContext::shouldEmit(const BinaryFunction &Function) const { + if (Function.isPseudo()) + return false; + if (opts::processAllFunctions()) return true; diff --git a/bolt/lib/Passes/LongJmp.cpp b/bolt/lib/Passes/LongJmp.cpp index 56b50cb..24139f2 100644 --- a/bolt/lib/Passes/LongJmp.cpp +++ b/bolt/lib/Passes/LongJmp.cpp @@ -345,6 +345,11 @@ uint64_t LongJmpPass::tentativeLayoutRelocMode( CurrentIndex = 0; bool ColdLayoutDone = false; for (BinaryFunction *Func : SortedFunctions) { + if (!BC.shouldEmit(*Func)) { + HotAddresses[Func] = Func->getAddress(); + continue; + } + if (!ColdLayoutDone && CurrentIndex >= LastHotIndex) { DotAddress = tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress);