Skip to content

Commit 2c1fb41

Browse files
committed
[MC] Remove some getSectionOrder uses
SectionOrder is Mach-O specific to place zerofill sections after non-zerofill sections in the object writer.
1 parent eed9141 commit 2c1fb41

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,9 @@ class HexagonAsmBackend : public MCAsmBackend {
713713
void finishLayout(MCAssembler const &Asm,
714714
MCAsmLayout &Layout) const override {
715715
SmallVector<MCFragment *> Frags;
716-
for (auto *I : Layout.getSectionOrder()) {
716+
for (MCSection &Sec : Asm) {
717717
Frags.clear();
718-
for (MCFragment &F : *I)
718+
for (MCFragment &F : Sec)
719719
Frags.push_back(&F);
720720
for (size_t J = 0, E = Frags.size(); J != E; ++J) {
721721
switch (Frags[J]->getKind()) {
@@ -756,7 +756,7 @@ class HexagonAsmBackend : public MCAsmBackend {
756756
//assert(!Error);
757757
(void)Error;
758758
ReplaceInstruction(Asm.getEmitter(), RF, Inst);
759-
I->setHasLayout(false);
759+
Sec.setHasLayout(false);
760760
Size = 0; // Only look back one instruction
761761
break;
762762
}

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,7 @@ void X86AsmBackend::finishLayout(MCAssembler const &Asm,
971971
}
972972

973973
// The layout is done. Mark every fragment as valid.
974-
for (unsigned int i = 0, n = Layout.getSectionOrder().size(); i != n; ++i) {
975-
MCSection &Section = *Layout.getSectionOrder()[i];
974+
for (MCSection &Section : Asm) {
976975
Asm.getFragmentOffset(*Section.curFragList()->Tail);
977976
Asm.computeFragmentSize(*Section.curFragList()->Tail);
978977
}

0 commit comments

Comments
 (0)