[llvm-commits] [llvm] r127972 - in /llvm/trunk: lib/MC/ test/CodeGen/ARM/ test/MC/ARM/ test/MC/ELF/

Rafael Espindola rafael.espindola at gmail.com
Sun Mar 20 11:44:20 PDT 2011


Author: rafael
Date: Sun Mar 20 13:44:20 2011
New Revision: 127972

URL: http://llvm.org/viewvc/llvm-project?rev=127972&view=rev
Log:
Write the section table and the section data in the same order that
gun as does. This makes it a lot easier to compare the output of both
as the addresses are now a lot closer.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp
    llvm/trunk/lib/MC/ELFObjectWriter.h
    llvm/trunk/test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
    llvm/trunk/test/MC/ARM/elf-reloc-01.ll
    llvm/trunk/test/MC/ARM/elf-reloc-02.ll
    llvm/trunk/test/MC/ARM/elf-reloc-03.ll
    llvm/trunk/test/MC/ELF/alias-reloc.s
    llvm/trunk/test/MC/ELF/basic-elf-32.s
    llvm/trunk/test/MC/ELF/basic-elf-64.s
    llvm/trunk/test/MC/ELF/cfi-advance-loc2.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa.s
    llvm/trunk/test/MC/ELF/cfi-offset.s
    llvm/trunk/test/MC/ELF/cfi-remember.s
    llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s
    llvm/trunk/test/MC/ELF/cfi.s
    llvm/trunk/test/MC/ELF/comdat.s
    llvm/trunk/test/MC/ELF/common.s
    llvm/trunk/test/MC/ELF/got.s
    llvm/trunk/test/MC/ELF/local-reloc.s
    llvm/trunk/test/MC/ELF/merge.s
    llvm/trunk/test/MC/ELF/pic-diff.s
    llvm/trunk/test/MC/ELF/relocation-386.s
    llvm/trunk/test/MC/ELF/relocation-pc.s
    llvm/trunk/test/MC/ELF/relocation.s
    llvm/trunk/test/MC/ELF/rename.s
    llvm/trunk/test/MC/ELF/symref.s
    llvm/trunk/test/MC/ELF/tls.s
    llvm/trunk/test/MC/ELF/undef2.s
    llvm/trunk/test/MC/ELF/weakref-reloc.s
    llvm/trunk/test/MC/ELF/weakref.s

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Sun Mar 20 13:44:20 2011
@@ -500,7 +500,8 @@
 }
 
 void ELFObjectWriter::ComputeIndexMap(MCAssembler &Asm,
-                                      SectionIndexMapTy &SectionIndexMap) {
+                                      SectionIndexMapTy &SectionIndexMap,
+                                      const RelMapTy &RelMap) {
   unsigned Index = 1;
   for (MCAssembler::iterator it = Asm.begin(),
          ie = Asm.end(); it != ie; ++it) {
@@ -515,15 +516,21 @@
          ie = Asm.end(); it != ie; ++it) {
     const MCSectionELF &Section =
       static_cast<const MCSectionELF &>(it->getSection());
-    if (Section.getType() == ELF::SHT_GROUP)
+    if (Section.getType() == ELF::SHT_GROUP ||
+        Section.getType() == ELF::SHT_REL ||
+        Section.getType() == ELF::SHT_RELA)
       continue;
     SectionIndexMap[&Section] = Index++;
+    const MCSectionELF *RelSection = RelMap.lookup(&Section);
+    if (RelSection)
+      SectionIndexMap[RelSection] = Index++;
   }
 }
 
 void ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm,
                                       const SectionIndexMapTy &SectionIndexMap,
-                                      RevGroupMapTy RevGroupMap) {
+                                         RevGroupMapTy RevGroupMap,
+                                         unsigned NumRegularSections) {
   // FIXME: Is this the correct place to do this?
   if (NeedsGOT) {
     llvm::StringRef Name = "_GLOBAL_OFFSET_TABLE_";
@@ -533,9 +540,6 @@
     MCELF::SetBinding(Data, ELF::STB_GLOBAL);
   }
 
-  // Build section lookup table.
-  int NumRegularSections = Asm.size();
-
   // Index 0 is always the empty string.
   StringMap<uint64_t> StringIndexMap;
   StringTable += '\x00';
@@ -636,11 +640,16 @@
     UndefinedSymbolData[i].SymbolData->setIndex(Index++);
 }
 
-void ELFObjectWriter::WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
-                                      const MCSectionData &SD) {
-  if (!Relocations[&SD].empty()) {
+void ELFObjectWriter::CreateRelocationSections(MCAssembler &Asm,
+                                               MCAsmLayout &Layout,
+                                               RelMapTy &RelMap) {
+  for (MCAssembler::const_iterator it = Asm.begin(),
+         ie = Asm.end(); it != ie; ++it) {
+    const MCSectionData &SD = *it;
+    if (Relocations[&SD].empty())
+      continue;
+
     MCContext &Ctx = Asm.getContext();
-    const MCSectionELF *RelaSection;
     const MCSectionELF &Section =
       static_cast<const MCSectionELF&>(SD.getSection());
 
@@ -654,17 +663,32 @@
     else
       EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel);
 
-    RelaSection = Ctx.getELFSection(RelaSectionName, hasRelocationAddend() ?
-                                    ELF::SHT_RELA : ELF::SHT_REL, 0,
-                                    SectionKind::getReadOnly(),
-                                    EntrySize, "");
+    const MCSectionELF *RelaSection =
+      Ctx.getELFSection(RelaSectionName, hasRelocationAddend() ?
+                        ELF::SHT_RELA : ELF::SHT_REL, 0,
+                        SectionKind::getReadOnly(),
+                        EntrySize, "");
+    RelMap[&Section] = RelaSection;
+    Asm.getOrCreateSectionData(*RelaSection);
+  }
+}
+
+void ELFObjectWriter::WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout,
+                                       const RelMapTy &RelMap) {
+  for (MCAssembler::const_iterator it = Asm.begin(),
+         ie = Asm.end(); it != ie; ++it) {
+    const MCSectionData &SD = *it;
+    const MCSectionELF &Section =
+      static_cast<const MCSectionELF&>(SD.getSection());
 
+    const MCSectionELF *RelaSection = RelMap.lookup(&Section);
+    if (!RelaSection)
+      continue;
     MCSectionData &RelaSD = Asm.getOrCreateSectionData(*RelaSection);
     RelaSD.setAlignment(is64Bit() ? 8 : 4);
 
     MCDataFragment *F = new MCDataFragment(&RelaSD);
-
-    WriteRelocationsFragment(Asm, F, &SD);
+    WriteRelocationsFragment(Asm, F, &*it);
   }
 }
 
@@ -726,7 +750,8 @@
 
 void ELFObjectWriter::CreateMetadataSections(MCAssembler &Asm,
                                              MCAsmLayout &Layout,
-                                    const SectionIndexMapTy &SectionIndexMap) {
+                                             SectionIndexMapTy &SectionIndexMap,
+                                             const RelMapTy &RelMap) {
   MCContext &Ctx = Asm.getContext();
   MCDataFragment *F;
 
@@ -738,7 +763,6 @@
                       SectionKind::getReadOnly());
   MCSectionData &ShstrtabSD = Asm.getOrCreateSectionData(*ShstrtabSection);
   ShstrtabSD.setAlignment(1);
-  ShstrtabIndex = Asm.size();
 
   const MCSectionELF *SymtabSection =
     Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
@@ -746,7 +770,6 @@
                       EntrySize, "");
   MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
   SymtabSD.setAlignment(is64Bit() ? 8 : 4);
-  SymbolTableIndex = Asm.size();
 
   MCSectionData *SymtabShndxSD = NULL;
 
@@ -758,14 +781,17 @@
     SymtabShndxSD->setAlignment(4);
   }
 
-  const MCSection *StrtabSection;
+  const MCSectionELF *StrtabSection;
   StrtabSection = Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0,
                                     SectionKind::getReadOnly());
   MCSectionData &StrtabSD = Asm.getOrCreateSectionData(*StrtabSection);
   StrtabSD.setAlignment(1);
-  StringTableIndex = Asm.size();
 
-  WriteRelocations(Asm, Layout);
+  ComputeIndexMap(Asm, SectionIndexMap, RelMap);
+
+  ShstrtabIndex = SectionIndexMap.lookup(ShstrtabSection);
+  SymbolTableIndex = SectionIndexMap.lookup(SymtabSection);
+  StringTableIndex = SectionIndexMap.lookup(StrtabSection);
 
   // Symbol table
   F = new MCDataFragment(&SymtabSD);
@@ -813,7 +839,9 @@
 void ELFObjectWriter::CreateIndexedSections(MCAssembler &Asm,
                                             MCAsmLayout &Layout,
                                             GroupMapTy &GroupMap,
-                                            RevGroupMapTy &RevGroupMap) {
+                                            RevGroupMapTy &RevGroupMap,
+                                            SectionIndexMapTy &SectionIndexMap,
+                                            const RelMapTy &RelMap) {
   // Create the .note.GNU-stack section if needed.
   MCContext &Ctx = Asm.getContext();
   if (Asm.getNoExecStack()) {
@@ -844,11 +872,11 @@
     GroupMap[Group] = SignatureSymbol;
   }
 
+  ComputeIndexMap(Asm, SectionIndexMap, RelMap);
+
   // Add sections to the groups
-  unsigned Index = 1;
-  unsigned NumGroups = RevGroupMap.size();
   for (MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end();
-       it != ie; ++it, ++Index) {
+       it != ie; ++it) {
     const MCSectionELF &Section =
       static_cast<const MCSectionELF&>(it->getSection());
     if (!(Section.getFlags() & ELF::SHF_GROUP))
@@ -857,7 +885,8 @@
     MCSectionData &Data = Asm.getOrCreateSectionData(*Group);
     // FIXME: we could use the previous fragment
     MCDataFragment *F = new MCDataFragment(&Data);
-    String32(*F, NumGroups + Index);
+    unsigned Index = SectionIndexMap.lookup(&Section);
+    String32(*F, Index);
   }
 }
 
@@ -966,13 +995,98 @@
   return Layout.getSectionAddressSize(&SD);
 }
 
-void ELFObjectWriter::WriteDataSectionData(ELFObjectWriter *W,
-                                           const MCSectionData &SD) {
-  for (MCSectionData::const_iterator i = SD.begin(), e = SD.end(); i != e;
-       ++i) {
-    const MCFragment &F = *i;
-    assert(F.getKind() == MCFragment::FT_Data);
-    W->WriteBytes(cast<MCDataFragment>(F).getContents().str());
+void ELFObjectWriter::WriteDataSectionData(MCAssembler &Asm,
+                                           const MCAsmLayout &Layout,
+                                           const MCSectionELF &Section) {
+  uint64_t FileOff = OS.tell();
+  const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
+
+  uint64_t Padding = OffsetToAlignment(FileOff, SD.getAlignment());
+  WriteZeros(Padding);
+  FileOff += Padding;
+
+  FileOff += GetSectionFileSize(Layout, SD);
+
+  if (IsELFMetaDataSection(SD)) {
+    for (MCSectionData::const_iterator i = SD.begin(), e = SD.end(); i != e;
+         ++i) {
+      const MCFragment &F = *i;
+      assert(F.getKind() == MCFragment::FT_Data);
+      WriteBytes(cast<MCDataFragment>(F).getContents().str());
+    }
+  } else {
+    Asm.WriteSectionData(&SD, Layout);
+  }
+}
+
+void ELFObjectWriter::WriteSectionHeader(MCAssembler &Asm,
+                                         const GroupMapTy &GroupMap,
+                                         const MCAsmLayout &Layout,
+                                      const SectionIndexMapTy &SectionIndexMap,
+                                   const SectionOffsetMapTy &SectionOffsetMap) {
+  const unsigned NumSections = Asm.size() + 1;
+
+  std::vector<const MCSectionELF*> Sections;
+  Sections.resize(NumSections - 1);
+
+  for (SectionIndexMapTy::const_iterator i=
+         SectionIndexMap.begin(), e = SectionIndexMap.end(); i != e; ++i) {
+    const std::pair<const MCSectionELF*, uint32_t> &p = *i;
+    Sections[p.second - 1] = p.first;
+  }
+
+  // Null section first.
+  uint64_t FirstSectionSize =
+    NumSections >= ELF::SHN_LORESERVE ? NumSections : 0;
+  uint32_t FirstSectionLink =
+    ShstrtabIndex >= ELF::SHN_LORESERVE ? ShstrtabIndex : 0;
+  WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, FirstSectionLink, 0, 0, 0);
+
+  for (unsigned i = 0; i < NumSections - 1; ++i) {
+    const MCSectionELF &Section = *Sections[i];
+    const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
+    uint32_t GroupSymbolIndex;
+    if (Section.getType() != ELF::SHT_GROUP)
+      GroupSymbolIndex = 0;
+    else
+      GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm,
+                                                     GroupMap.lookup(&Section));
+
+    uint64_t Size = GetSectionAddressSize(Layout, SD);
+
+    WriteSection(Asm, SectionIndexMap, GroupSymbolIndex,
+                 SectionOffsetMap.lookup(&Section), Size,
+                 SD.getAlignment(), Section);
+  }
+}
+
+void ELFObjectWriter::ComputeSectionOrder(MCAssembler &Asm,
+                                  std::vector<const MCSectionELF*> &Sections) {
+  for (MCAssembler::iterator it = Asm.begin(),
+         ie = Asm.end(); it != ie; ++it) {
+    const MCSectionELF &Section =
+      static_cast<const MCSectionELF &>(it->getSection());
+    if (Section.getType() == ELF::SHT_GROUP)
+      Sections.push_back(&Section);
+  }
+
+  for (MCAssembler::iterator it = Asm.begin(),
+         ie = Asm.end(); it != ie; ++it) {
+    const MCSectionELF &Section =
+      static_cast<const MCSectionELF &>(it->getSection());
+    if (Section.getType() != ELF::SHT_GROUP &&
+        Section.getType() != ELF::SHT_REL &&
+        Section.getType() != ELF::SHT_RELA)
+      Sections.push_back(&Section);
+  }
+
+  for (MCAssembler::iterator it = Asm.begin(),
+         ie = Asm.end(); it != ie; ++it) {
+    const MCSectionELF &Section =
+      static_cast<const MCSectionELF &>(it->getSection());
+    if (Section.getType() == ELF::SHT_REL ||
+        Section.getType() == ELF::SHT_RELA)
+      Sections.push_back(&Section);
   }
 }
 
@@ -980,107 +1094,96 @@
                                   const MCAsmLayout &Layout) {
   GroupMapTy GroupMap;
   RevGroupMapTy RevGroupMap;
-  CreateIndexedSections(Asm, const_cast<MCAsmLayout&>(Layout), GroupMap,
-                        RevGroupMap);
-
   SectionIndexMapTy SectionIndexMap;
 
-  ComputeIndexMap(Asm, SectionIndexMap);
+  unsigned NumUserSections = Asm.size();
+
+  DenseMap<const MCSectionELF*, const MCSectionELF*> RelMap;
+  CreateRelocationSections(Asm, const_cast<MCAsmLayout&>(Layout), RelMap);
+
+  const unsigned NumUserAndRelocSections = Asm.size();
+  CreateIndexedSections(Asm, const_cast<MCAsmLayout&>(Layout), GroupMap,
+                        RevGroupMap, SectionIndexMap, RelMap);
+  const unsigned AllSections = Asm.size();
+  const unsigned NumIndexedSections = AllSections - NumUserAndRelocSections;
+
+  unsigned NumRegularSections = NumUserSections + NumIndexedSections;
 
   // Compute symbol table information.
-  ComputeSymbolTable(Asm, SectionIndexMap, RevGroupMap);
+  ComputeSymbolTable(Asm, SectionIndexMap, RevGroupMap, NumRegularSections);
+
+
+  WriteRelocations(Asm, const_cast<MCAsmLayout&>(Layout), RelMap);
 
   CreateMetadataSections(const_cast<MCAssembler&>(Asm),
                          const_cast<MCAsmLayout&>(Layout),
-                         SectionIndexMap);
+                         SectionIndexMap,
+                         RelMap);
 
-  // Update to include the metadata sections.
-  ComputeIndexMap(Asm, SectionIndexMap);
-
-  // Add 1 for the null section.
-  unsigned NumSections = Asm.size() + 1;
   uint64_t NaturalAlignment = is64Bit() ? 8 : 4;
   uint64_t HeaderSize = is64Bit() ? sizeof(ELF::Elf64_Ehdr) :
                                     sizeof(ELF::Elf32_Ehdr);
   uint64_t FileOff = HeaderSize;
 
   std::vector<const MCSectionELF*> Sections;
-  Sections.resize(NumSections);
-
-  for (SectionIndexMapTy::const_iterator i=
-         SectionIndexMap.begin(), e = SectionIndexMap.end(); i != e; ++i) {
-    const std::pair<const MCSectionELF*, uint32_t> &p = *i;
-    Sections[p.second] = p.first;
-  }
-
-  for (unsigned i = 1; i < NumSections; ++i) {
+  ComputeSectionOrder(Asm, Sections);
+  unsigned NumSections = Sections.size();
+  SectionOffsetMapTy SectionOffsetMap;
+  for (unsigned i = 0; i < NumRegularSections + 1; ++i) {
     const MCSectionELF &Section = *Sections[i];
     const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
 
     FileOff = RoundUpToAlignment(FileOff, SD.getAlignment());
 
+    // Remember the offset into the file for this section.
+    SectionOffsetMap[&Section] = FileOff;
+
     // Get the size of the section in the output file (including padding).
     FileOff += GetSectionFileSize(Layout, SD);
   }
 
   FileOff = RoundUpToAlignment(FileOff, NaturalAlignment);
 
-  // Write out the ELF header ...
-  WriteHeader(FileOff - HeaderSize, NumSections);
-
-  FileOff = HeaderSize;
+  const unsigned SectionHeaderOffset = FileOff - HeaderSize;
 
-  // ... then all of the sections ...
-  DenseMap<const MCSection*, uint64_t> SectionOffsetMap;
+  uint64_t SectionHeaderEntrySize = is64Bit() ?
+    sizeof(ELF::Elf64_Shdr) : sizeof(ELF::Elf32_Shdr);
+  FileOff += (NumSections + 1) * SectionHeaderEntrySize;
 
-  for (unsigned i = 1; i < NumSections; ++i) {
+  for (unsigned i = NumRegularSections + 1; i < NumSections; ++i) {
     const MCSectionELF &Section = *Sections[i];
     const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
 
-    uint64_t Padding = OffsetToAlignment(FileOff, SD.getAlignment());
-    WriteZeros(Padding);
-    FileOff += Padding;
+    FileOff = RoundUpToAlignment(FileOff, SD.getAlignment());
 
     // Remember the offset into the file for this section.
     SectionOffsetMap[&Section] = FileOff;
 
+    // Get the size of the section in the output file (including padding).
     FileOff += GetSectionFileSize(Layout, SD);
-
-    if (IsELFMetaDataSection(SD))
-      WriteDataSectionData(this, SD);
-    else
-      Asm.WriteSectionData(&SD, Layout);
   }
 
-  uint64_t Padding = OffsetToAlignment(FileOff, NaturalAlignment);
-  WriteZeros(Padding);
-  FileOff += Padding;
-
-  // ... and then the section header table.
-  // Should we align the section header table?
-  //
-  // Null section first.
-  uint64_t FirstSectionSize =
-    NumSections >= ELF::SHN_LORESERVE ? NumSections : 0;
-  uint32_t FirstSectionLink =
-    ShstrtabIndex >= ELF::SHN_LORESERVE ? ShstrtabIndex : 0;
-  WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, FirstSectionLink, 0, 0, 0);
+  // Write out the ELF header ...
+  WriteHeader(SectionHeaderOffset, NumSections + 1);
 
-  for (unsigned i = 1; i < NumSections; ++i) {
-    const MCSectionELF &Section = *Sections[i];
-    const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
-    uint32_t GroupSymbolIndex;
-    if (Section.getType() != ELF::SHT_GROUP)
-      GroupSymbolIndex = 0;
-    else
-      GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm, GroupMap[&Section]);
+  // ... then the regular sections ...
+  // + because of .shstrtab
+  for (unsigned i = 0; i < NumRegularSections + 1; ++i)
+    WriteDataSectionData(Asm, Layout, *Sections[i]);
 
-    uint64_t Size = GetSectionAddressSize(Layout, SD);
+  FileOff = OS.tell();
+  uint64_t Padding = OffsetToAlignment(FileOff, NaturalAlignment);
+  WriteZeros(Padding);
 
-    WriteSection(Asm, SectionIndexMap, GroupSymbolIndex,
-                 SectionOffsetMap[&Section], Size,
-                 SD.getAlignment(), Section);
-  }
+  // ... then the section header table ...
+  WriteSectionHeader(Asm, GroupMap, Layout, SectionIndexMap,
+                     SectionOffsetMap);
+
+  FileOff = OS.tell();
+
+  // ... and then the remainting sections ...
+  for (unsigned i = NumRegularSections + 1; i < NumSections; ++i)
+    WriteDataSectionData(Asm, Layout, *Sections[i]);
 }
 
 bool

Modified: llvm/trunk/lib/MC/ELFObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.h?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.h (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.h Sun Mar 20 13:44:20 2011
@@ -50,8 +50,10 @@
                                        const MCSectionData &SD);
     static uint64_t GetSectionAddressSize(const MCAsmLayout &Layout,
                                           const MCSectionData &SD);
-    static void WriteDataSectionData(ELFObjectWriter *W,
-                                     const MCSectionData &SD);
+
+    void WriteDataSectionData(MCAssembler &Asm,
+                              const MCAsmLayout &Layout,
+                              const MCSectionELF &Section);
 
     /*static bool isFixupKindX86RIPRel(unsigned Kind) {
       return Kind == X86::reloc_riprel_4byte ||
@@ -267,6 +269,10 @@
     typedef DenseMap<const MCSectionELF*, const MCSymbol*> GroupMapTy;
     // Map from a signature symbol to the group section
     typedef DenseMap<const MCSymbol*, const MCSectionELF*> RevGroupMapTy;
+    // Map from a section to the section with the relocations
+    typedef DenseMap<const MCSectionELF*, const MCSectionELF*> RelMapTy;
+    // Map from a section to its offset
+    typedef DenseMap<const MCSectionELF*, uint64_t> SectionOffsetMapTy;
 
     /// ComputeSymbolTable - Compute the symbol table data
     ///
@@ -275,33 +281,42 @@
     /// string table.
     virtual void ComputeSymbolTable(MCAssembler &Asm,
                             const SectionIndexMapTy &SectionIndexMap,
-                            RevGroupMapTy RevGroupMap);
+                                    RevGroupMapTy RevGroupMap,
+                                    unsigned NumRegularSections);
 
     virtual void ComputeIndexMap(MCAssembler &Asm,
-                         SectionIndexMapTy &SectionIndexMap);
+                                 SectionIndexMapTy &SectionIndexMap,
+                                 const RelMapTy &RelMap);
 
-    virtual void WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
-                         const MCSectionData &SD);
+    void CreateRelocationSections(MCAssembler &Asm, MCAsmLayout &Layout,
+                                  RelMapTy &RelMap);
 
-    virtual void WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout) {
-      for (MCAssembler::const_iterator it = Asm.begin(),
-             ie = Asm.end(); it != ie; ++it) {
-        WriteRelocation(Asm, Layout, *it);
-      }
-    }
+    void WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout,
+                          const RelMapTy &RelMap);
 
     virtual void CreateMetadataSections(MCAssembler &Asm, MCAsmLayout &Layout,
-                                const SectionIndexMapTy &SectionIndexMap);
+                                        SectionIndexMapTy &SectionIndexMap,
+                                        const RelMapTy &RelMap);
 
     // Create the sections that show up in the symbol table. Currently
     // those are the .note.GNU-stack section and the group sections.
     virtual void CreateIndexedSections(MCAssembler &Asm, MCAsmLayout &Layout,
                                        GroupMapTy &GroupMap,
-                                       RevGroupMapTy &RevGroupMap);
+                                       RevGroupMapTy &RevGroupMap,
+                                       SectionIndexMapTy &SectionIndexMap,
+                                       const RelMapTy &RelMap);
 
     virtual void ExecutePostLayoutBinding(MCAssembler &Asm,
                                           const MCAsmLayout &Layout);
 
+    void WriteSectionHeader(MCAssembler &Asm, const GroupMapTy &GroupMap,
+                            const MCAsmLayout &Layout,
+                            const SectionIndexMapTy &SectionIndexMap,
+                            const SectionOffsetMapTy &SectionOffsetMap);
+
+    void ComputeSectionOrder(MCAssembler &Asm,
+                             std::vector<const MCSectionELF*> &Sections);
+
     virtual void WriteSecHdrEntry(uint32_t Name, uint32_t Type, uint64_t Flags,
                           uint64_t Address, uint64_t Offset,
                           uint64_t Size, uint32_t Link, uint32_t Info,

Modified: llvm/trunk/test/CodeGen/ARM/2010-12-15-elf-lcomm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-12-15-elf-lcomm.ll?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2010-12-15-elf-lcomm.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2010-12-15-elf-lcomm.ll Sun Mar 20 13:44:20 2011
@@ -15,7 +15,7 @@
 
 
 
-; OBJ:          Section 0x00000003
+; OBJ:          Section 0x00000004
 ; OBJ-NEXT:     '.bss'
 
 ; OBJ:          'array00'
@@ -24,7 +24,7 @@
 ; OBJ-NEXT:     'st_bind', 0x00000000
 ; OBJ-NEXT:     'st_type', 0x00000001
 ; OBJ-NEXT:     'st_other', 0x00000000
-; OBJ-NEXT:     'st_shndx', 0x00000003
+; OBJ-NEXT:     'st_shndx', 0x00000004
 
 define i32 @main(i32 %argc) nounwind {
   %1 = load i32* @sum, align 4

Modified: llvm/trunk/test/MC/ARM/elf-reloc-01.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-01.ll?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/elf-reloc-01.ll (original)
+++ llvm/trunk/test/MC/ARM/elf-reloc-01.ll Sun Mar 20 13:44:20 2011
@@ -60,12 +60,11 @@
 
 declare void @exit(i32) noreturn nounwind
 
-
-;; OBJ:         Symbol 0x00000002
-;; OBJ-NEXT:    '_MergedGlobals'
-;; OBJ-NEXT:    'st_value', 0x00000010
-
 ;; OBJ:          Relocation 0x00000001
 ;; OBJ-NEXT:     'r_offset', 
 ;; OBJ-NEXT:     'r_sym', 0x00000002
 ;; OBJ-NEXT:     'r_type', 0x0000002b
+
+;; OBJ:         Symbol 0x00000002
+;; OBJ-NEXT:    '_MergedGlobals'
+;; OBJ-NEXT:    'st_value', 0x00000010

Modified: llvm/trunk/test/MC/ARM/elf-reloc-02.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-02.ll?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/elf-reloc-02.ll (original)
+++ llvm/trunk/test/MC/ARM/elf-reloc-02.ll Sun Mar 20 13:44:20 2011
@@ -41,11 +41,10 @@
 
 declare void @exit(i32) noreturn nounwind
 
-
-;; OBJ:          Symbol 0x00000002
-;; OBJ-NEXT:    '.L.str'
-
 ;; OBJ:        Relocation 0x00000000
 ;; OBJ-NEXT:    'r_offset', 
 ;; OBJ-NEXT:    'r_sym', 0x00000002
 ;; OBJ-NEXT:    'r_type', 0x0000002b
+
+;; OBJ:          Symbol 0x00000002
+;; OBJ-NEXT:    '.L.str'

Modified: llvm/trunk/test/MC/ARM/elf-reloc-03.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/elf-reloc-03.ll?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/elf-reloc-03.ll (original)
+++ llvm/trunk/test/MC/ARM/elf-reloc-03.ll Sun Mar 20 13:44:20 2011
@@ -88,11 +88,10 @@
 
 declare void @exit(i32) noreturn nounwind
 
-
-;; OBJ:      Symbol 0x0000000c
-;; OBJ-NEXT:    'vtable'
-
 ;; OBJ:           Relocation 0x00000001
 ;; OBJ-NEXT:     'r_offset', 
 ;; OBJ-NEXT:     'r_sym', 0x0000000c
 ;; OBJ-NEXT:     'r_type', 0x0000002b
+
+;; OBJ:      Symbol 0x0000000c
+;; OBJ-NEXT:    'vtable'

Modified: llvm/trunk/test/MC/ELF/alias-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/alias-reloc.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/alias-reloc.s (original)
+++ llvm/trunk/test/MC/ELF/alias-reloc.s Sun Mar 20 13:44:20 2011
@@ -17,6 +17,20 @@
     .set    bar2,foo2
     .quad    bar2
 
+// CHECK:       # Relocation 0x00000000
+// CHECK-NEXT:  (('r_offset', 0x00000001)
+// CHECK-NEXT:   ('r_sym', 0x00000001)
+// CHECK-NEXT:   ('r_type', 0x00000004)
+// CHECK-NEXT:   ('r_addend', 0xfffffffc)
+// CHECK-NEXT:  ),
+
+// CHECK:      # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000005)
+// CHECK-NEXT:  ('r_sym', 0x00000006)
+// CHECK-NEXT:  ('r_type', 0x00000001)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+
 // CHECK:       # Symbol 0x00000001
 // CHECK-NEXT:  (('st_name', 0x00000005) # 'bar'
 // CHECK-NEXT:   ('st_bind', 0x00000000)
@@ -36,17 +50,3 @@
 // CHECK-NEXT:  ('st_value', 0x0000000000000005)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),
-
-// CHECK:       # Relocation 0x00000000
-// CHECK-NEXT:  (('r_offset', 0x00000001)
-// CHECK-NEXT:   ('r_sym', 0x00000001)
-// CHECK-NEXT:   ('r_type', 0x00000004)
-// CHECK-NEXT:   ('r_addend', 0xfffffffc)
-// CHECK-NEXT:  ),
-
-// CHECK:      # Relocation 0x00000001
-// CHECK-NEXT: (('r_offset', 0x00000005)
-// CHECK-NEXT:  ('r_sym', 0x00000006)
-// CHECK-NEXT:  ('r_type', 0x00000001)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),

Modified: llvm/trunk/test/MC/ELF/basic-elf-32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/basic-elf-32.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/basic-elf-32.s (original)
+++ llvm/trunk/test/MC/ELF/basic-elf-32.s Sun Mar 20 13:44:20 2011
@@ -39,23 +39,6 @@
 
 // CHECK:   # '.text'
 
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK:   # 'main'
-// CHECK:   ('st_bind', 0x00000001)
-// CHECK-NEXT: ('st_type', 0x00000002)
-
-// CHECK:   # 'puts'
-// CHECK:   ('st_bind', 0x00000001)
-// CHECK-NEXT: ('st_type', 0x00000000)
-
 // CHECK:   # '.rel.text'
 
 // CHECK:   ('_relocations', [
@@ -76,3 +59,20 @@
 // CHECK:      ('r_type', 0x00000002)
 // CHECK:     ),
 // CHECK:   ])
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK:   # 'main'
+// CHECK:   ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000002)
+
+// CHECK:   # 'puts'
+// CHECK:   ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)

Modified: llvm/trunk/test/MC/ELF/basic-elf-64.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/basic-elf-64.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/basic-elf-64.s (original)
+++ llvm/trunk/test/MC/ELF/basic-elf-64.s Sun Mar 20 13:44:20 2011
@@ -39,23 +39,6 @@
 
 // CHECK:   # '.text'
 
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK: ('st_bind', 0x00000000)
-// CHECK: ('st_type', 0x00000003)
-
-// CHECK:   # 'main'
-// CHECK-NEXT: ('st_bind', 0x00000001)
-// CHECK-NEXT: ('st_type', 0x00000002)
-
-// CHECK:   # 'puts'
-// CHECK-NEXT: ('st_bind', 0x00000001)
-// CHECK-NEXT: ('st_type', 0x00000000)
-
 // CHECK:   # '.rela.text'
 
 // CHECK:   ('_relocations', [
@@ -80,3 +63,20 @@
 // CHECK:      ('r_addend', 0xfffffffc)
 // CHECK:     ),
 // CHECK:   ])
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK:   # 'main'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000002)
+
+// CHECK:   # 'puts'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)

Modified: llvm/trunk/test/MC/ELF/cfi-advance-loc2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-advance-loc2.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-advance-loc2.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-advance-loc2.s Sun Mar 20 13:44:20 2011
@@ -24,13 +24,13 @@
 // CHECK-NEXT: ),
 
 
-// CHECK:      (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000258)
+// CHECK-NEXT:  ('sh_offset', 0x00000498)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s Sun Mar 20 13:44:20 2011
@@ -24,14 +24,14 @@
 // CHECK-NEXT:  ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 0a000000 00440e10 450e0800')
 // CHECK-NEXT: ),
 
-// CHECK:       # Section 0x00000008
-// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:       # Section 0x00000005
+// CHECK-NEXT: (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000160)
+// CHECK-NEXT:  ('sh_offset', 0x000003a0)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s Sun Mar 20 13:44:20 2011
@@ -20,13 +20,13 @@
 // CHECK-NEXT:  ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 02000000 00410d06 00000000')
 // CHECK-NEXT: ),
 
-// CHECK:      (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000158)
+// CHECK-NEXT:  ('sh_offset', 0x00000398)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa.s Sun Mar 20 13:44:20 2011
@@ -21,13 +21,13 @@
 // CHECK-NEXT: ),
 
 
-// CHECK:      (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000158)
+// CHECK-NEXT:  ('sh_offset', 0x00000398)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-offset.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-offset.s Sun Mar 20 13:44:20 2011
@@ -21,13 +21,13 @@
 // CHECK-NEXT: ),
 
 
-// CHECK:      (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000158)
+// CHECK-NEXT:  ('sh_offset', 0x00000398)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-remember.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-remember.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-remember.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-remember.s Sun Mar 20 13:44:20 2011
@@ -23,14 +23,14 @@
 // CHECK-NEXT:  ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 03000000 00410a41 0b000000')
 // CHECK-NEXT: ),
 
-// CHECK:      # Section 0x00000008
-// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      # Section 0x00000005
+// CHECK-NEXT: (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000158)
+// CHECK-NEXT:  ('sh_offset', 0x00000398)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s Sun Mar 20 13:44:20 2011
@@ -27,13 +27,13 @@
 // CHECK-NEXT:  ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 1c000000 1c000000 00000000 04000000 00410e10 410a0e08 410b0000 00000000')
 // CHECK-NEXT: ),
 
-// CHECK:      (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:      (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000160)
+// CHECK-NEXT:  ('sh_offset', 0x000003a0)
 // CHECK-NEXT:  ('sh_size', 0x00000018)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/cfi.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi.s (original)
+++ llvm/trunk/test/MC/ELF/cfi.s Sun Mar 20 13:44:20 2011
@@ -226,14 +226,14 @@
 // CHECK-NEXT:  ('_section_data', '14000000 00000000 017a4c52 00017810 02031b0c 07089001 14000000 1c000000 00000000 01000000 04000000 00000000 20000000 00000000 017a504c 52000178 100b0000 00000000 00000003 1b0c0708 90010000 14000000 28000000 00000000 01000000 04000000 00000000 14000000 70000000 00000000 01000000 04000000 00000000 20000000 00000000 017a504c 52000178 100b0000 00000000 00000002 1b0c0708 90010000 10000000 28000000 00000000 01000000 02000000 18000000 00000000 017a5052 00017810 04020000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06030000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a040000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 040a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 060b0000 00001b0c 07089001 10000000 20000000 00000000 
 01000000 00000000 1c000000 00000000 017a5052 00017810 0a0c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a080000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a100000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04120000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06130000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a140000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 041a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 061b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a1c0000 00000000 00001b0c 07089001
  10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a180000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a800000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04820000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06830000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a840000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 048a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 068b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a8c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a88000
 0 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a900000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04920000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06930000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a940000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 049a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 069b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a9c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a980000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000')
 // CHECK-NEXT: ),
 
-// CHECK:        # Section 0x00000008
-// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK:        # Section 0x00000005
+// CHECK-NEXT: (('sh_name', 0x0000001c) # '.rela.eh_frame'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x00000bf8)
+// CHECK-NEXT:  ('sh_offset', 0x00000e38)
 // CHECK-NEXT:  ('sh_size', 0x000006c0)
-// CHECK-NEXT:  ('sh_link', 0x00000006)
+// CHECK-NEXT:  ('sh_link', 0x00000007)
 // CHECK-NEXT:  ('sh_info', 0x00000004)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/comdat.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/comdat.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/comdat.s (original)
+++ llvm/trunk/test/MC/ELF/comdat.s Sun Mar 20 13:44:20 2011
@@ -4,37 +4,37 @@
 // of the file.
 
 // CHECK:       # Section 0x00000001
-// CHECK-NEXT:  (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT:  (('sh_name', 0x00000030) # '.group'
 // CHECK-NEXT:   ('sh_type', 0x00000011)
 // CHECK-NEXT:   ('sh_flags', 0x00000000)
 // CHECK-NEXT:   ('sh_addr', 0x00000000)
 // CHECK-NEXT:   ('sh_offset', 0x00000040)
 // CHECK-NEXT:   ('sh_size', 0x0000000c)
-// CHECK-NEXT:   ('sh_link', 0x0000000c)
+// CHECK-NEXT:   ('sh_link', 0x0000000d)
 // CHECK-NEXT:   ('sh_info', 0x00000001)
 // CHECK-NEXT:   ('sh_addralign', 0x00000004)
 // CHECK-NEXT:   ('sh_entsize', 0x00000004)
 // CHECK-NEXT:  ),
 // CHECK-NEXT:  # Section 0x00000002
-// CHECK-NEXT:  (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT:  (('sh_name', 0x00000030) # '.group'
 // CHECK-NEXT:   ('sh_type', 0x00000011)
 // CHECK-NEXT:   ('sh_flags', 0x00000000)
 // CHECK-NEXT:   ('sh_addr', 0x00000000)
 // CHECK-NEXT:   ('sh_offset', 0x0000004c)
 // CHECK-NEXT:   ('sh_size', 0x00000008)
-// CHECK-NEXT:   ('sh_link', 0x0000000c)
+// CHECK-NEXT:   ('sh_link', 0x0000000d)
 // CHECK-NEXT:   ('sh_info', 0x00000002)
 // CHECK-NEXT:   ('sh_addralign', 0x00000004)
 // CHECK-NEXT:   ('sh_entsize', 0x00000004)
 // CHECK-NEXT:  ),
 // CHECK-NEXT:  # Section 0x00000003
-// CHECK-NEXT:  (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT:  (('sh_name', 0x00000030) # '.group'
 // CHECK-NEXT:   ('sh_type', 0x00000011)
 // CHECK-NEXT:   ('sh_flags', 0x00000000)
 // CHECK-NEXT:   ('sh_addr', 0x00000000)
 // CHECK-NEXT:   ('sh_offset', 0x00000054)
 // CHECK-NEXT:   ('sh_size', 0x00000008)
-// CHECK-NEXT:   ('sh_link', 0x0000000c)
+// CHECK-NEXT:   ('sh_link', 0x0000000d)
 // CHECK-NEXT:   ('sh_info', 0x0000000d)
 // CHECK-NEXT:   ('sh_addralign', 0x00000004)
 // CHECK-NEXT:   ('sh_entsize', 0x00000004)

Modified: llvm/trunk/test/MC/ELF/common.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/common.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/common.s (original)
+++ llvm/trunk/test/MC/ELF/common.s Sun Mar 20 13:44:20 2011
@@ -38,7 +38,7 @@
 // CHECK-NEXT:  ('st_bind', 0x00000000)
 // CHECK-NEXT:  ('st_type', 0x00000001)
 // CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000003)
+// CHECK-NEXT:  ('st_shndx', 0x00000004)
 // CHECK-NEXT:  ('st_value', 0x0000000000000010)
 // CHECK-NEXT:  ('st_size', 0x0000000000000008)
 // CHECK-NEXT: ),

Modified: llvm/trunk/test/MC/ELF/got.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/got.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/got.s (original)
+++ llvm/trunk/test/MC/ELF/got.s Sun Mar 20 13:44:20 2011
@@ -6,9 +6,6 @@
         movl	foo at GOT, %eax
         movl	foo at GOTPCREL(%rip), %eax
 
-// CHECK:     (('st_name', 0x00000005) # '_GLOBAL_OFFSET_TABLE_'
-// CHECK-NEXT: ('st_bind', 0x00000001)
-
 // CHECK:      ('_relocations', [
 // CHECK-NEXT:   # Relocation 0x00000000
 // CHECK-NEXT:    (('r_offset',
@@ -23,3 +20,6 @@
 // CHECK-NEXT:     ('r_addend',
 // CHECK-NEXT:    ),
 // CHECK-NEXT:   ])
+
+// CHECK:     (('st_name', 0x00000005) # '_GLOBAL_OFFSET_TABLE_'
+// CHECK-NEXT: ('st_bind', 0x00000001)

Modified: llvm/trunk/test/MC/ELF/local-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/local-reloc.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/local-reloc.s (original)
+++ llvm/trunk/test/MC/ELF/local-reloc.s Sun Mar 20 13:44:20 2011
@@ -10,16 +10,6 @@
 // CHECK:        # Section 0x00000001
 // CHECK-next:  (('sh_name', 0x00000001) # '.text'
 
-// Symbol number 2 is section number 1
-// CHECK:    # Symbol 0x00000002
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_bind', 0x00000000)
-// CHECK-NEXT:     ('st_type', 0x00000003)
-// CHECK-NEXT:     ('st_other', 0x00000000)
-// CHECK-NEXT:     ('st_shndx', 0x00000001)
-// CHECK-NEXT:     ('st_value', 0x0000000000000000)
-// CHECK-NEXT:     ('st_size', 0x0000000000000000)
-
 // Relocation refers to symbol number 2
 // CHECK:      ('_relocations', [
 // CHECK-NEXT:  # Relocation 0x00000000
@@ -29,3 +19,13 @@
 // CHECK-NEXT:    ('r_addend',
 // CHECK-NEXT:   ),
 // CHECK-NEXT:  ])
+
+// Symbol number 2 is section number 1
+// CHECK:    # Symbol 0x00000002
+// CHECK-NEXT:    (('st_name', 0x00000000) # ''
+// CHECK-NEXT:     ('st_bind', 0x00000000)
+// CHECK-NEXT:     ('st_type', 0x00000003)
+// CHECK-NEXT:     ('st_other', 0x00000000)
+// CHECK-NEXT:     ('st_shndx', 0x00000001)
+// CHECK-NEXT:     ('st_value', 0x0000000000000000)
+// CHECK-NEXT:     ('st_size', 0x0000000000000000)

Modified: llvm/trunk/test/MC/ELF/merge.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/merge.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/merge.s (original)
+++ llvm/trunk/test/MC/ELF/merge.s Sun Mar 20 13:44:20 2011
@@ -22,30 +22,6 @@
         .section	bar,"ax", at progbits
 foo:
 
-// Section 4 is "sec1"
-// CHECK: # Section 0x00000004
-// CHECK-NEXT:  (('sh_name', 0x00000012) # '.sec1'
-
-// Symbol number 1 is .Lfoo
-// CHECK:      # Symbol 0x00000001
-// CHECK-NEXT: (('st_name', 0x00000001) # '.Lfoo'
-
-// Symbol number 2 is foo
-// CHECK:      # Symbol 0x00000002
-// CHECK-NEXT: (('st_name', 0x00000007) # 'foo'
-
-// Symbol number 6 is section 4
-// CHECK:        # Symbol 0x00000006
-// CHECK-NEXT:    (('st_name', 0x00000000) # ''
-// CHECK-NEXT:     ('st_bind', 0x00000000)
-// CHECK-NEXT:     ('st_type', 0x00000003)
-// CHECK-NEXT:     ('st_other', 0x00000000)
-// CHECK-NEXT:     ('st_shndx', 0x00000004)
-
-// Symbol number 8 is zed
-// CHECK:        # Symbol 0x00000008
-// CHECK-NEXT:    (('st_name', 0x0000000b) # 'zed'
-
 // Relocation 0 refers to symbol 1
 // CHECK:       ('_relocations', [
 // CHECK-NEXT:   # Relocation 0
@@ -95,3 +71,27 @@
 // CHECK-NEXT:    ('r_addend', 0x00000000)
 // CHECK-NEXT:   ),
 // CHECK-NEXT:  ])
+
+// Section 5 is "sec1"
+// CHECK: # Section 0x00000005
+// CHECK-NEXT:  (('sh_name', 0x00000012) # '.sec1'
+
+// Symbol number 1 is .Lfoo
+// CHECK:      # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000001) # '.Lfoo'
+
+// Symbol number 2 is foo
+// CHECK:      # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000007) # 'foo'
+
+// Symbol number 6 is section 5
+// CHECK:        # Symbol 0x00000006
+// CHECK-NEXT:    (('st_name', 0x00000000) # ''
+// CHECK-NEXT:     ('st_bind', 0x00000000)
+// CHECK-NEXT:     ('st_type', 0x00000003)
+// CHECK-NEXT:     ('st_other', 0x00000000)
+// CHECK-NEXT:     ('st_shndx', 0x00000005)
+
+// Symbol number 8 is zed
+// CHECK:        # Symbol 0x00000008
+// CHECK-NEXT:    (('st_name', 0x0000000b) # 'zed'

Modified: llvm/trunk/test/MC/ELF/pic-diff.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/pic-diff.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/pic-diff.s (original)
+++ llvm/trunk/test/MC/ELF/pic-diff.s Sun Mar 20 13:44:20 2011
@@ -1,5 +1,14 @@
 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump  | FileCheck %s
 
+// CHECK:       ('_relocations', [
+// CHECK-NEXT:    # Relocation 0x00000000
+// CHECK-NEXT:    (('r_offset', 0x0000000c)
+// CHECK-NEXT:     ('r_sym', 0x00000005)
+// CHECK-NEXT:     ('r_type', 0x00000002)
+// CHECK-NEXT:     ('r_addend', 0x00000008)
+// CHECK-NEXT:    ),
+// CHECK-NEXT:   ])
+
 // CHECK:         # Symbol 0x00000005
 // CHECK-NEXT:    (('st_name', 0x00000005) # 'baz'
 // CHECK-NEXT:     ('st_bind', 0x00000001)
@@ -10,15 +19,6 @@
 // CHECK-NEXT:     ('st_size', 0x0000000000000000)
 // CHECK-NEXT:    ),
 
-// CHECK:       ('_relocations', [
-// CHECK-NEXT:    # Relocation 0x00000000
-// CHECK-NEXT:    (('r_offset', 0x0000000c)
-// CHECK-NEXT:     ('r_sym', 0x00000005)
-// CHECK-NEXT:     ('r_type', 0x00000002)
-// CHECK-NEXT:     ('r_addend', 0x00000008)
-// CHECK-NEXT:    ),
-// CHECK-NEXT:   ])
-
 .zero 4
 .data
 

Modified: llvm/trunk/test/MC/ELF/relocation-386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-386.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-386.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-386.s Sun Mar 20 13:44:20 2011
@@ -3,33 +3,6 @@
 // Test that we produce the correct relocation types and that the relocations
 // correctly point to the section or the symbol.
 
-// Section 3 is bss
-// CHECK:      # Section 0x00000003
-// CHECK-NEXT: (('sh_name', 0x0000000d) # '.bss'
-
-// CHECK:      # Symbol 0x00000001
-// CHECK-NEXT: (('st_name', 0x00000005) # '.Lfoo'
-
-// Symbol 4 is zed
-// CHECK:      # Symbol 0x00000004
-// CHECK-NEXT: (('st_name', 0x00000035) # 'zed'
-// CHECK-NEXT:  ('st_value', 0x00000000)
-// CHECK-NEXT:  ('st_size', 0x00000000)
-// CHECK-NEXT:  ('st_bind', 0x00000000)
-// CHECK-NEXT:  ('st_type', 0x00000006)
-// CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000004)
-
-// Symbol 7 is section 3
-// CHECK:      # Symbol 0x00000007
-// CHECK-NEXT: (('st_name', 0x00000000) # ''
-// CHECK-NEXT:  ('st_value', 0x00000000)
-// CHECK-NEXT:  ('st_size', 0x00000000)
-// CHECK-NEXT:  ('st_bind', 0x00000000)
-// CHECK-NEXT:  ('st_type', 0x00000003)
-// CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000003)
-
 // CHECK:      # Relocation 0x00000000
 // CHECK-NEXT: (('r_offset', 0x00000002)
 // CHECK-NEXT:  ('r_sym', 0x00000001)
@@ -181,6 +154,34 @@
 // CHECK-NEXT:  ('r_type', 0x00000001)
 // CHECK-NEXT: ),
 
+// Section 4 is bss
+// CHECK:      # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x0000000d) # '.bss'
+
+// CHECK:      # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000005) # '.Lfoo'
+
+// Symbol 4 is zed
+// CHECK:      # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000035) # 'zed'
+// CHECK-NEXT:  ('st_value', 0x00000000)
+// CHECK-NEXT:  ('st_size', 0x00000000)
+// CHECK-NEXT:  ('st_bind', 0x00000000)
+// CHECK-NEXT:  ('st_type', 0x00000006)
+// CHECK-NEXT:  ('st_other', 0x00000000)
+// CHECK-NEXT:  ('st_shndx', 0x00000005)
+
+// Symbol 7 is section 4
+// CHECK:      # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT:  ('st_value', 0x00000000)
+// CHECK-NEXT:  ('st_size', 0x00000000)
+// CHECK-NEXT:  ('st_bind', 0x00000000)
+// CHECK-NEXT:  ('st_type', 0x00000003)
+// CHECK-NEXT:  ('st_other', 0x00000000)
+// CHECK-NEXT:  ('st_shndx', 0x00000004)
+
+
         .text
 bar:
 	leal	.Lfoo at GOTOFF(%ebx), %eax

Modified: llvm/trunk/test/MC/ELF/relocation-pc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-pc.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-pc.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-pc.s Sun Mar 20 13:44:20 2011
@@ -5,14 +5,14 @@
 	loope	0                 # R_X86_64_PC8
 	jmp	-256              # R_X86_64_PC32
 
-// CHECK:      # Section 0x00000007
-// CHECK-NEXT: (('sh_name', 0x0000002c) # '.rela.text'
+// CHECK:      # Section 0x00000002
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.rela.text'
 // CHECK-NEXT:  ('sh_type', 0x00000004)
 // CHECK-NEXT:  ('sh_flags', 0x00000000)
 // CHECK-NEXT:  ('sh_addr', 0x00000000)
-// CHECK-NEXT:  ('sh_offset', 0x000000e8)
+// CHECK-NEXT:  ('sh_offset', 0x000002e8)
 // CHECK-NEXT:  ('sh_size', 0x00000030)
-// CHECK-NEXT:  ('sh_link', 0x00000005)
+// CHECK-NEXT:  ('sh_link', 0x00000006)
 // CHECK-NEXT:  ('sh_info', 0x00000001)
 // CHECK-NEXT:  ('sh_addralign', 0x00000008)
 // CHECK-NEXT:  ('sh_entsize', 0x00000018)

Modified: llvm/trunk/test/MC/ELF/relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation.s (original)
+++ llvm/trunk/test/MC/ELF/relocation.s Sun Mar 20 13:44:20 2011
@@ -22,13 +22,6 @@
 // CHECK:  # Section 0x00000001
 // CHECK: (('sh_name', 0x00000001) # '.text'
 
-// CHECK:   # Symbol 0x00000002
-// CHECK: (('st_name', 0x00000000) # ''
-// CHECK:  ('st_bind', 0x00000000)
-// CHECK:  ('st_type', 0x00000003)
-// CHECK:  ('st_other', 0x00000000)
-// CHECK:  ('st_shndx', 0x00000001)
-
 // CHECK: # Relocation 0x00000000
 // CHECK-NEXT:  (('r_offset', 0x00000001)
 // CHECK-NEXT:   ('r_sym', 0x00000002)
@@ -112,3 +105,10 @@
 // CHECK-NEXT:  ('r_sym', 0x00000006)
 // CHECK-NEXT:  ('r_type', 0x00000002)
 // CHECK-NEXT:  ('r_addend', 0x0000005c)
+
+// CHECK:   # Symbol 0x00000002
+// CHECK: (('st_name', 0x00000000) # ''
+// CHECK:  ('st_bind', 0x00000000)
+// CHECK:  ('st_type', 0x00000003)
+// CHECK:  ('st_other', 0x00000000)
+// CHECK:  ('st_shndx', 0x00000001)

Modified: llvm/trunk/test/MC/ELF/rename.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/rename.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/rename.s (original)
+++ llvm/trunk/test/MC/ELF/rename.s Sun Mar 20 13:44:20 2011
@@ -28,6 +28,13 @@
 // CHECK-NEXT:  ('sh_addralign', 0x00000004)
 // CHECK-NEXT:  ('sh_entsize', 0x00000000)
 
+// The relocation uses symbol 2
+// CHECK:      # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000000)
+// CHECK-NEXT:  ('r_sym', 0x00000002)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+
 // Symbol 2 is section 1
 // CHECK:      # Symbol 0x00000002
 // CHECK-NEXT: (('st_name', 0x00000000) # ''
@@ -37,10 +44,3 @@
 // CHECK-NEXT:  ('st_shndx', 0x00000001)
 // CHECK-NEXT:  ('st_value', 0x0000000000000000)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
-
-// The relocation uses symbol 2
-// CHECK:      # Relocation 0x00000000
-// CHECK-NEXT: (('r_offset', 0x00000000)
-// CHECK-NEXT:  ('r_sym', 0x00000002)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)

Modified: llvm/trunk/test/MC/ELF/symref.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/symref.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/symref.s (original)
+++ llvm/trunk/test/MC/ELF/symref.s Sun Mar 20 13:44:20 2011
@@ -22,6 +22,38 @@
 global1:
 
 
+// CHECK:      # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000000)
+// CHECK-NEXT:  ('r_sym', 0x00000006)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000004)
+// CHECK-NEXT:  ('r_sym', 0x0000000b)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset', 0x00000008)
+// CHECK-NEXT:  ('r_sym', 0x00000006)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset', 0x0000000c)
+// CHECK-NEXT:  ('r_sym', 0x00000006)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset', 0x00000010)
+// CHECK-NEXT:  ('r_sym', 0x0000000c)
+// CHECK-NEXT:  ('r_type', 0x0000000a)
+// CHECK-NEXT:  ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT:])
+
 // CHECK:      # Symbol 0x00000001
 // CHECK-NEXT: (('st_name', 0x00000013) # 'bar1 at zed'
 // CHECK-NEXT:  ('st_bind', 0x00000000)
@@ -81,7 +113,7 @@
 // CHECK-NEXT:  ('st_bind', 0x00000000)
 // CHECK-NEXT:  ('st_type', 0x00000003)
 // CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000002)
+// CHECK-NEXT:  ('st_shndx', 0x00000003)
 // CHECK-NEXT:  ('st_value', 0x0000000000000000)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),
@@ -90,7 +122,7 @@
 // CHECK-NEXT:  ('st_bind', 0x00000000)
 // CHECK-NEXT:  ('st_type', 0x00000003)
 // CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000003)
+// CHECK-NEXT:  ('st_shndx', 0x00000004)
 // CHECK-NEXT:  ('st_value', 0x0000000000000000)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),
@@ -131,35 +163,3 @@
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),
 // CHECK-NEXT:])
-
-// CHECK:      # Relocation 0x00000000
-// CHECK-NEXT: (('r_offset', 0x00000000)
-// CHECK-NEXT:  ('r_sym', 0x00000006)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),
-// CHECK-NEXT: # Relocation 0x00000001
-// CHECK-NEXT: (('r_offset', 0x00000004)
-// CHECK-NEXT:  ('r_sym', 0x0000000b)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),
-// CHECK-NEXT: # Relocation 0x00000002
-// CHECK-NEXT: (('r_offset', 0x00000008)
-// CHECK-NEXT:  ('r_sym', 0x00000006)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),
-// CHECK-NEXT: # Relocation 0x00000003
-// CHECK-NEXT: (('r_offset', 0x0000000c)
-// CHECK-NEXT:  ('r_sym', 0x00000006)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),
-// CHECK-NEXT: # Relocation 0x00000004
-// CHECK-NEXT: (('r_offset', 0x00000010)
-// CHECK-NEXT:  ('r_sym', 0x0000000c)
-// CHECK-NEXT:  ('r_type', 0x0000000a)
-// CHECK-NEXT:  ('r_addend', 0x00000000)
-// CHECK-NEXT: ),
-// CHECK-NEXT:])

Modified: llvm/trunk/test/MC/ELF/tls.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/tls.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/tls.s (original)
+++ llvm/trunk/test/MC/ELF/tls.s Sun Mar 20 13:44:20 2011
@@ -14,7 +14,7 @@
 // CHECK-NEXT:  ('st_bind', 0x00000000)
 // CHECK-NEXT:  ('st_type', 0x00000006)
 // CHECK-NEXT:  ('st_other', 0x00000000)
-// CHECK-NEXT:  ('st_shndx', 0x00000004)
+// CHECK-NEXT:  ('st_shndx', 0x00000005)
 // CHECK-NEXT:  ('st_value', 0x0000000000000000)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),

Modified: llvm/trunk/test/MC/ELF/undef2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/undef2.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/undef2.s (original)
+++ llvm/trunk/test/MC/ELF/undef2.s Sun Mar 20 13:44:20 2011
@@ -7,4 +7,4 @@
 // CHECK: ('_symbols', [
 // CHECK:      (('st_name', 0x00000001) # '.Lfoo'
 // CHECK-NEXT:  ('st_bind', 0x00000001)
-// CHECK: (('sh_name', 0x00000024) # '.strtab'
+// CHECK: (('sh_name', 0x0000002f) # '.strtab'

Modified: llvm/trunk/test/MC/ELF/weakref-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/weakref-reloc.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/weakref-reloc.s (original)
+++ llvm/trunk/test/MC/ELF/weakref-reloc.s Sun Mar 20 13:44:20 2011
@@ -7,6 +7,19 @@
         call    zed at PLT
 	call	bar
 
+// CHECK:      # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT:  ('r_sym', 0x00000006)
+// CHECK-NEXT:  ('r_type', 0x00000004)
+// CHECK-NEXT:  ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000006)
+// CHECK-NEXT:  ('r_sym', 0x00000005)
+// CHECK-NEXT:  ('r_type', 0x00000002)
+// CHECK-NEXT:  ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
+
 // CHECK:      # Symbol 0x00000004
 // CHECK-NEXT: (('st_name', 0x00000009) # '_GLOBAL_OFFSET_TABLE_'
 // CHECK-NEXT:  ('st_bind', 0x00000001)
@@ -34,16 +47,3 @@
 // CHECK-NEXT:  ('st_value', 0x0000000000000000)
 // CHECK-NEXT:  ('st_size', 0x0000000000000000)
 // CHECK-NEXT: ),
-
-// CHECK:      # Relocation 0x00000000
-// CHECK-NEXT: (('r_offset', 0x00000001)
-// CHECK-NEXT:  ('r_sym', 0x00000006)
-// CHECK-NEXT:  ('r_type', 0x00000004)
-// CHECK-NEXT:  ('r_addend', 0xfffffffc)
-// CHECK-NEXT: ),
-// CHECK-NEXT: # Relocation 0x00000001
-// CHECK-NEXT: (('r_offset', 0x00000006)
-// CHECK-NEXT:  ('r_sym', 0x00000005)
-// CHECK-NEXT:  ('r_type', 0x00000002)
-// CHECK-NEXT:  ('r_addend', 0xfffffffc)
-// CHECK-NEXT: ),

Modified: llvm/trunk/test/MC/ELF/weakref.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/weakref.s?rev=127972&r1=127971&r2=127972&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/weakref.s (original)
+++ llvm/trunk/test/MC/ELF/weakref.s Sun Mar 20 13:44:20 2011
@@ -128,7 +128,7 @@
 // CHECK-NEXT:   ('st_bind', 0x00000000)
 // CHECK-NEXT:   ('st_type', 0x00000003)
 // CHECK-NEXT:   ('st_other', 0x00000000)
-// CHECK-NEXT:   ('st_shndx', 0x00000002)
+// CHECK-NEXT:   ('st_shndx', 0x00000003)
 // CHECK-NEXT:   ('st_value', 0x0000000000000000)
 // CHECK-NEXT:   ('st_size', 0x0000000000000000)
 // CHECK-NEXT:  ),
@@ -137,7 +137,7 @@
 // CHECK-NEXT:   ('st_bind', 0x00000000)
 // CHECK-NEXT:   ('st_type', 0x00000003)
 // CHECK-NEXT:   ('st_other', 0x00000000)
-// CHECK-NEXT:   ('st_shndx', 0x00000003)
+// CHECK-NEXT:   ('st_shndx', 0x00000004)
 // CHECK-NEXT:   ('st_value', 0x0000000000000000)
 // CHECK-NEXT:   ('st_size', 0x0000000000000000)
 // CHECK-NEXT:  ),





More information about the llvm-commits mailing list