From f60c736c64d6c9d683df1cead3631958359c14f1 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 13 May 2010 15:17:26 +0000 Subject: [PATCH] MC: Add section layout order indices to MCSectionData. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103715 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCAssembler.h | 6 ++++++ lib/MC/MCAssembler.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 33fa2953cb0..095b1743ecb 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -392,6 +392,9 @@ private: /// Ordinal - The section index in the assemblers section list. unsigned Ordinal; + /// LayoutOrder - The index of this section in the layout order. + unsigned LayoutOrder; + /// Alignment - The maximum alignment seen in this section. unsigned Alignment; @@ -426,6 +429,9 @@ public: unsigned getOrdinal() const { return Ordinal; } void setOrdinal(unsigned Value) { Ordinal = Value; } + unsigned getLayoutOrder() const { return LayoutOrder; } + void setLayoutOrder(unsigned Value) { LayoutOrder = Value; } + /// @name Fragment Access /// @{ diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index ac91bad8ac8..f41b25f15d3 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -601,6 +601,10 @@ void MCAssembler::Finish() { // Create the layout object. MCAsmLayout Layout(*this); + // Assign layout order indices. + for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) + Layout.getSectionOrder()[i]->setLayoutOrder(i); + // Insert additional align fragments for concrete sections to explicitly pad // the previous section to match their alignment requirements. This is for // 'gas' compatibility, it shouldn't strictly be necessary. -- 2.34.1