[lld] 4cfff19 - [ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 12 19:26:08 PST 2021
Author: Fangrui Song
Date: 2021-12-12T19:26:03-08:00
New Revision: 4cfff19b883da3fadd27979edea4038f33a31344
URL: https://github.com/llvm/llvm-project/commit/4cfff19b883da3fadd27979edea4038f33a31344
DIFF: https://github.com/llvm/llvm-project/commit/4cfff19b883da3fadd27979edea4038f33a31344.diff
LOG: [ELF] Move adjustSplitStackFunctionPrologues's splitStack check to the caller. NFC
Avoid a function call in the majority of cases and make the output smaller.
Added:
Modified:
lld/ELF/InputSection.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 4d5bd1f1e5f2..a8d3163cde64 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -992,7 +992,7 @@ static void relocateNonAllocForRelocatable(InputSection *sec, uint8_t *buf) {
template <class ELFT>
void InputSectionBase::relocate(uint8_t *buf, uint8_t *bufEnd) {
- if (flags & SHF_EXECINSTR)
+ if ((flags & SHF_EXECINSTR) && LLVM_UNLIKELY(getFile<ELFT>()->splitStack))
adjustSplitStackFunctionPrologues<ELFT>(buf, bufEnd);
if (flags & SHF_ALLOC) {
@@ -1175,8 +1175,6 @@ static bool enclosingPrologueAttempted(uint64_t offset,
template <class ELFT>
void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
uint8_t *end) {
- if (!getFile<ELFT>()->splitStack)
- return;
DenseSet<Defined *> prologues;
std::vector<Relocation *> morestackCalls;
More information about the llvm-commits
mailing list