mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 07:57:36 +08:00
[ELF] addOrphanSections: avoid std::function
This commit is contained in:
@@ -829,8 +829,7 @@ void LinkerScript::addOrphanSections() {
|
||||
StringMap<TinyPtrVector<OutputSection *>> map;
|
||||
SmallVector<OutputSection *, 0> v;
|
||||
|
||||
std::function<void(InputSectionBase *)> add;
|
||||
add = [&](InputSectionBase *s) {
|
||||
auto add = [&](InputSectionBase *s) {
|
||||
if (s->isLive() && !s->parent) {
|
||||
orphanSections.push_back(s);
|
||||
|
||||
@@ -846,11 +845,6 @@ void LinkerScript::addOrphanSections() {
|
||||
s->getOutputSection()->sectionIndex == UINT32_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
if (config->relocatable)
|
||||
for (InputSectionBase *depSec : s->dependentSections)
|
||||
if (depSec->flags & SHF_LINK_ORDER)
|
||||
add(depSec);
|
||||
};
|
||||
|
||||
// For further --emit-reloc handling code we need target output section
|
||||
@@ -869,6 +863,10 @@ void LinkerScript::addOrphanSections() {
|
||||
if (auto *relIS = dyn_cast_or_null<InputSectionBase>(rel->parent))
|
||||
add(relIS);
|
||||
add(isec);
|
||||
if (config->relocatable)
|
||||
for (InputSectionBase *depSec : isec->dependentSections)
|
||||
if (depSec->flags & SHF_LINK_ORDER)
|
||||
add(depSec);
|
||||
}
|
||||
|
||||
// If no SECTIONS command was given, we should insert sections commands
|
||||
|
||||
Reference in New Issue
Block a user