summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 3590153dcb8..ae72534a30a 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -596,14 +596,10 @@ void LinkerScript::process(BaseCommand &Base) {
static OutputSection *
findSection(StringRef Name, const std::vector<OutputSection *> &Sections) {
- auto End = Sections.end();
- auto HasName = [=](OutputSection *Sec) { return Sec->Name == Name; };
- auto I = std::find_if(Sections.begin(), End, HasName);
- std::vector<OutputSection *> Ret;
- if (I == End)
- return nullptr;
- assert(std::find_if(I + 1, End, HasName) == End);
- return *I;
+ for (OutputSection *Sec : Sections)
+ if (Sec->Name == Name)
+ return Sec;
+ return nullptr;
}
// This function searches for a memory region to place the given output
OpenPOWER on IntegriCloud