Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -667,9 +667,8 @@ // '.' is assigned to, but creating these section should not have any bad // consequeces and gives us a section to put the symbol in. uint64_t Flags = SHF_ALLOC; - - for (int I = 0, E = Opt.Commands.size(); I != E; ++I) { - auto *Sec = dyn_cast(Opt.Commands[I]); + for (BaseCommand * Cmd : Opt.Commands) { + auto *Sec = dyn_cast(Cmd); if (!Sec) continue; if (Sec->Live) { @@ -681,7 +680,6 @@ continue; Sec->Live = true; - Sec->SectionIndex = I; Sec->Flags = Flags; } }