File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2779,9 +2779,6 @@ void LinkerDriver::link(opt::InputArgList &args) {
27792779 for (SectionCommand *cmd : script->sectionCommands )
27802780 if (auto *osd = dyn_cast<OutputDesc>(cmd))
27812781 osd->osec .finalizeInputSections ();
2782- llvm::erase_if (inputSections, [](InputSectionBase *s) {
2783- return isa<MergeInputSection>(s);
2784- });
27852782 }
27862783
27872784 // Two input sections with different output sections should not be folded.
Original file line number Diff line number Diff line change @@ -846,7 +846,11 @@ void LinkerScript::addOrphanSections() {
846846 // to be created before we create relocation output section, so we want
847847 // to create target sections first. We do not want priority handling
848848 // for synthetic sections because them are special.
849+ size_t n = 0 ;
849850 for (InputSectionBase *isec : inputSections) {
851+ if (!isa<MergeInputSection>(isec))
852+ inputSections[n++] = isec;
853+
850854 // In -r links, SHF_LINK_ORDER sections are added while adding their parent
851855 // sections because we need to know the parent's output section before we
852856 // can select an output section for the SHF_LINK_ORDER section.
@@ -863,6 +867,7 @@ void LinkerScript::addOrphanSections() {
863867 if (depSec->flags & SHF_LINK_ORDER)
864868 add (depSec);
865869 }
870+ inputSections.resize (n);
866871
867872 // If no SECTIONS command was given, we should insert sections commands
868873 // before others, so that we can handle scripts which refers them,
You can’t perform that action at this time.
0 commit comments