Change how we iterate over relocations on ELF.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 May 2013 03:05:14 +0000 (03:05 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 30 May 2013 03:05:14 +0000 (03:05 +0000)
For COFF and MachO, sections semantically have relocations that apply to them.
That is not the case on ELF.

In relocatable objects (.o), a section with relocations in ELF has offsets to
another section where the relocations should be applied.

In dynamic objects and executables, relocations don't have an offset, they have
a virtual address. The section sh_info may or may not point to another section,
but that is not actually used for resolving the relocations.

This patch exposes that in the ObjectFile API. It has the following advantages:

* Most (all?) clients can handle this more efficiently. They will normally walk
all relocations, so doing an effort to iterate in a particular order doesn't
save time.

* llvm-readobj now prints relocations in the same way the native readelf does.

* probably most important, relocations that don't point to any section are now
visible. This is the case of relocations in the rela.dyn section. See the
updated relocation-executable.test for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182908 91177308-0d34-0410-b5e6-96231b3b80d8

83 files changed:
include/llvm/Object/ELF.h
include/llvm/Object/ObjectFile.h
lib/DebugInfo/DWARFContext.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/MC/MCObjectSymbolizer.cpp
lib/Object/ObjectFile.cpp
test/CodeGen/AArch64/adrp-relocation.ll
test/CodeGen/AArch64/basic-pic.ll
test/CodeGen/AArch64/elf-extern.ll
test/CodeGen/AArch64/jump-table.ll
test/CodeGen/ARM/2010-11-30-reloc-movt.ll
test/CodeGen/ARM/ehabi-mc-compact-pr0.ll
test/CodeGen/ARM/ehabi-mc-compact-pr1.ll
test/CodeGen/PowerPC/mcm-obj-2.ll
test/CodeGen/PowerPC/mcm-obj.ll
test/CodeGen/PowerPC/tls-gd-obj.ll
test/CodeGen/PowerPC/tls-ie-obj.ll
test/CodeGen/PowerPC/tls-ld-obj.ll
test/MC/AArch64/elf-globaladdress.ll
test/MC/AArch64/elf-reloc-addsubimm.s
test/MC/AArch64/elf-reloc-condbr.s
test/MC/AArch64/elf-reloc-ldrlit.s
test/MC/AArch64/elf-reloc-ldstunsimm.s
test/MC/AArch64/elf-reloc-movw.s
test/MC/AArch64/elf-reloc-pcreladdressing.s
test/MC/AArch64/elf-reloc-tstb.s
test/MC/AArch64/elf-reloc-uncondbrimm.s
test/MC/AArch64/tls-relocs.s
test/MC/ARM/eh-compact-pr0.s
test/MC/ARM/eh-compact-pr1.s
test/MC/ARM/eh-directive-cantunwind.s
test/MC/ARM/eh-directive-handlerdata.s
test/MC/ARM/eh-directive-personality.s
test/MC/ARM/eh-directive-section-multiple-func.s
test/MC/ARM/eh-directive-section.s
test/MC/ARM/eh-directive-text-section-multiple-func.s
test/MC/ARM/eh-directive-text-section.s
test/MC/ARM/elf-movt.s
test/MC/ARM/elf-reloc-01.ll
test/MC/ARM/elf-reloc-02.ll
test/MC/ARM/elf-reloc-03.ll
test/MC/ARM/elf-reloc-condcall.s
test/MC/ARM/elf-thumbfunc-reloc.ll
test/MC/ARM/elf-thumbfunc-reloc.s
test/MC/ELF/alias-reloc.s
test/MC/ELF/basic-elf-32.s
test/MC/ELF/basic-elf-64.s
test/MC/ELF/cfi-adjust-cfa-offset.s
test/MC/ELF/cfi-advance-loc2.s
test/MC/ELF/cfi-def-cfa-offset.s
test/MC/ELF/cfi-def-cfa-register.s
test/MC/ELF/cfi-def-cfa.s
test/MC/ELF/cfi-escape.s
test/MC/ELF/cfi-offset.s
test/MC/ELF/cfi-register.s
test/MC/ELF/cfi-rel-offset.s
test/MC/ELF/cfi-rel-offset2.s
test/MC/ELF/cfi-remember.s
test/MC/ELF/cfi-restore.s
test/MC/ELF/cfi-same-value.s
test/MC/ELF/cfi-undefined.s
test/MC/ELF/cfi-zero-addr-delta.s
test/MC/ELF/cfi.s
test/MC/ELF/gen-dwarf.s
test/MC/ELF/got.s
test/MC/ELF/local-reloc.s
test/MC/ELF/merge.s
test/MC/ELF/relocation-386.s
test/MC/ELF/relocation-pc.s
test/MC/ELF/relocation.s
test/MC/ELF/rename.s
test/MC/ELF/symref.s
test/MC/ELF/weak-relocation.s
test/MC/ELF/x86_64-reloc-sizetest.s
test/MC/Mips/eh-frame.s
test/MC/Mips/elf-gprel-32-64.ll
test/MC/Mips/elf-tls.ll
test/MC/PowerPC/ppc64-initial-cfa.ll
test/MC/PowerPC/ppc64-relocs-01.ll
test/MC/PowerPC/ppc64-tls-relocs-01.ll
test/Object/relocation-executable.test
test/tools/llvm-readobj/relocations.test
test/tools/llvm-readobj/sections-ext.test

index 1c34cf148533de6a460eb8e07c177b9df8c2dfcf..9e8b6fafd89a2ecec5f61cc3d103aeb7aec5d055 100644 (file)
@@ -582,7 +582,6 @@ protected:
 private:
   typedef SmallVector<const Elf_Shdr *, 2> Sections_t;
   typedef DenseMap<unsigned, unsigned> IndexMap_t;
-  typedef DenseMap<const Elf_Shdr*, SmallVector<uint32_t, 1> > RelocMap_t;
 
   const Elf_Ehdr *Header;
   const Elf_Shdr *SectionHeaderTable;
@@ -634,13 +633,9 @@ private:
   void LoadVersionNeeds(const Elf_Shdr *ec) const;
   void LoadVersionMap() const;
 
-  /// @brief Map sections to an array of relocation sections that reference
-  ///        them sorted by section index.
-  RelocMap_t SectionRelocMap;
-
   /// @brief Get the relocation section that contains \a Rel.
   const Elf_Shdr *getRelSection(DataRefImpl Rel) const {
-    return getSection(Rel.w.b);
+    return getSection(Rel.d.a);
   }
 
 public:
@@ -712,6 +707,7 @@ protected:
                                            bool &Result) const;
   virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const;
   virtual relocation_iterator getSectionRelEnd(DataRefImpl Sec) const;
+  virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
 
   virtual error_code getRelocationNext(DataRefImpl Rel,
                                        RelocationRef &Res) const;
@@ -1458,13 +1454,9 @@ template<class ELFT>
 relocation_iterator
 ELFObjectFile<ELFT>::getSectionRelBegin(DataRefImpl Sec) const {
   DataRefImpl RelData;
-  const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
-  typename RelocMap_t::const_iterator ittr = SectionRelocMap.find(sec);
-  if (sec != 0 && ittr != SectionRelocMap.end()) {
-    RelData.w.a = getSection(ittr->second[0])->sh_info;
-    RelData.w.b = ittr->second[0];
-    RelData.w.c = 0;
-  }
+  uintptr_t SHT = reinterpret_cast<uintptr_t>(SectionHeaderTable);
+  RelData.d.a = (Sec.p - SHT) / Header->e_shentsize;
+  RelData.d.b = 0;
   return relocation_iterator(RelocationRef(RelData, this));
 }
 
@@ -1472,44 +1464,41 @@ template<class ELFT>
 relocation_iterator
 ELFObjectFile<ELFT>::getSectionRelEnd(DataRefImpl Sec) const {
   DataRefImpl RelData;
-  const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
-  typename RelocMap_t::const_iterator ittr = SectionRelocMap.find(sec);
-  if (sec != 0 && ittr != SectionRelocMap.end()) {
-    // Get the index of the last relocation section for this section.
-    std::size_t relocsecindex = ittr->second[ittr->second.size() - 1];
-    const Elf_Shdr *relocsec = getSection(relocsecindex);
-    RelData.w.a = relocsec->sh_info;
-    RelData.w.b = relocsecindex;
-    RelData.w.c = relocsec->sh_size / relocsec->sh_entsize;
-  }
+  uintptr_t SHT = reinterpret_cast<uintptr_t>(SectionHeaderTable);
+  const Elf_Shdr *S = reinterpret_cast<const Elf_Shdr *>(Sec.p);
+  RelData.d.a = (Sec.p - SHT) / Header->e_shentsize;
+  if (S->sh_type != ELF::SHT_RELA && S->sh_type != ELF::SHT_REL)
+    RelData.d.b = 0;
+  else
+    RelData.d.b = S->sh_size / S->sh_entsize;
+
   return relocation_iterator(RelocationRef(RelData, this));
 }
 
+template <class ELFT>
+section_iterator
+ELFObjectFile<ELFT>::getRelocatedSection(DataRefImpl Sec) const {
+  if (Header->e_type != ELF::ET_REL)
+    return end_sections();
+
+  const Elf_Shdr *S = reinterpret_cast<const Elf_Shdr *>(Sec.p);
+  unsigned sh_type = S->sh_type;
+  if (sh_type != ELF::SHT_RELA && sh_type != ELF::SHT_REL)
+    return end_sections();
+
+  unsigned SecIndex = S->sh_info;
+  assert(SecIndex != 0);
+  const Elf_Shdr *R = getSection(S->sh_info);
+  DataRefImpl D;
+  D.p = reinterpret_cast<uintptr_t>(R);
+  return section_iterator(SectionRef(D, this));
+}
+
 // Relocations
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationNext(DataRefImpl Rel,
                                                   RelocationRef &Result) const {
-  ++Rel.w.c;
-  const Elf_Shdr *relocsec = getSection(Rel.w.b);
-  if (Rel.w.c >= (relocsec->sh_size / relocsec->sh_entsize)) {
-    // We have reached the end of the relocations for this section. See if there
-    // is another relocation section.
-    typename RelocMap_t::mapped_type relocseclist =
-      SectionRelocMap.lookup(getSection(Rel.w.a));
-
-    // Do a binary search for the current reloc section index (which must be
-    // present). Then get the next one.
-    typename RelocMap_t::mapped_type::const_iterator loc =
-      std::lower_bound(relocseclist.begin(), relocseclist.end(), Rel.w.b);
-    ++loc;
-
-    // If there is no next one, don't do anything. The ++Rel.w.c above sets Rel
-    // to the end iterator.
-    if (loc != relocseclist.end()) {
-      Rel.w.b = *loc;
-      Rel.w.a = 0;
-    }
-  }
+  ++Rel.d.b;
   Result = RelocationRef(Rel, this);
   return object_error::success;
 }
@@ -1518,7 +1507,7 @@ template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationSymbol(DataRefImpl Rel,
                                                     SymbolRef &Result) const {
   uint32_t symbolIdx;
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   switch (sec->sh_type) {
     default :
       report_fatal_error("Invalid section type in Rel!");
@@ -1561,7 +1550,7 @@ error_code ELFObjectFile<ELFT>::getRelocationOffset(DataRefImpl Rel,
 
 template<class ELFT>
 uint64_t ELFObjectFile<ELFT>::getROffset(DataRefImpl Rel) const {
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   switch (sec->sh_type) {
   default:
     report_fatal_error("Invalid section type in Rel!");
@@ -1575,7 +1564,7 @@ uint64_t ELFObjectFile<ELFT>::getROffset(DataRefImpl Rel) const {
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationType(DataRefImpl Rel,
                                                   uint64_t &Result) const {
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   switch (sec->sh_type) {
     default :
       report_fatal_error("Invalid section type in Rel!");
@@ -2192,7 +2181,7 @@ StringRef ELFObjectFile<ELFT>::getRelocationTypeName(uint32_t Type) const {
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationTypeName(
     DataRefImpl Rel, SmallVectorImpl<char> &Result) const {
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   uint32_t type;
   switch (sec->sh_type) {
     default :
@@ -2234,7 +2223,7 @@ error_code ELFObjectFile<ELFT>::getRelocationTypeName(
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationAddend(
     DataRefImpl Rel, int64_t &Result) const {
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   switch (sec->sh_type) {
     default :
       report_fatal_error("Invalid section type in Rel!");
@@ -2252,7 +2241,7 @@ error_code ELFObjectFile<ELFT>::getRelocationAddend(
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getRelocationValueString(
     DataRefImpl Rel, SmallVectorImpl<char> &Result) const {
-  const Elf_Shdr *sec = getSection(Rel.w.b);
+  const Elf_Shdr *sec = getRelSection(Rel);
   uint8_t type;
   StringRef res;
   int64_t addend = 0;
@@ -2402,10 +2391,8 @@ ELFObjectFile<ELFT>::ELFObjectFile(MemoryBuffer *Object, error_code &ec)
       break;
     }
     case ELF::SHT_REL:
-    case ELF::SHT_RELA: {
-      SectionRelocMap[getSection(sh->sh_info)].push_back(i);
+    case ELF::SHT_RELA:
       break;
-    }
     case ELF::SHT_DYNAMIC: {
       if (dot_dynamic_sec != NULL)
         // FIXME: Proper error handling.
@@ -2438,12 +2425,6 @@ ELFObjectFile<ELFT>::ELFObjectFile(MemoryBuffer *Object, error_code &ec)
     ++sh;
   }
 
-  // Sort section relocation lists by index.
-  for (typename RelocMap_t::iterator i = SectionRelocMap.begin(),
-                                     e = SectionRelocMap.end(); i != e; ++i) {
-    std::sort(i->second.begin(), i->second.end());
-  }
-
   // Get string table sections.
   dot_shstrtab_sec = getSection(getStringTableIndex());
   if (dot_shstrtab_sec) {
@@ -2795,13 +2776,13 @@ ELFObjectFile<ELFT>::getSymbol(DataRefImpl Symb) const {
 template<class ELFT>
 const typename ELFObjectFile<ELFT>::Elf_Rel *
 ELFObjectFile<ELFT>::getRel(DataRefImpl Rel) const {
-  return getEntry<Elf_Rel>(Rel.w.b, Rel.w.c);
+  return getEntry<Elf_Rel>(Rel.d.a, Rel.d.b);
 }
 
 template<class ELFT>
 const typename ELFObjectFile<ELFT>::Elf_Rela *
 ELFObjectFile<ELFT>::getRela(DataRefImpl Rela) const {
-  return getEntry<Elf_Rela>(Rela.w.b, Rela.w.c);
+  return getEntry<Elf_Rela>(Rela.d.a, Rela.d.b);
 }
 
 template<class ELFT>
index c73a568c1cad4c4dccc7f6e4b065d9e69cde22dd..ba1bb6945b0be9f9f3e6e937ffdfcc0c44722ba8 100644 (file)
@@ -28,12 +28,8 @@ namespace object {
 class ObjectFile;
 
 union DataRefImpl {
-  struct {
-    // ELF needs this for relocations. This entire union should probably be a
-    // char[max(8, sizeof(uintptr_t))] and require the impl to cast.
-    uint16_t a, b;
-    uint32_t c;
-  } w;
+  // This entire union should probably be a
+  // char[max(8, sizeof(uintptr_t))] and require the impl to cast.
   struct {
     uint32_t a, b;
   } d;
@@ -133,6 +129,8 @@ typedef content_iterator<RelocationRef> relocation_iterator;
 
 /// SectionRef - This is a value type class that represents a single section in
 /// the list of sections in the object file.
+class SectionRef;
+typedef content_iterator<SectionRef> section_iterator;
 class SectionRef {
   friend class SymbolRef;
   DataRefImpl SectionPimpl;
@@ -169,10 +167,10 @@ public:
 
   relocation_iterator begin_relocations() const;
   relocation_iterator end_relocations() const;
+  section_iterator getRelocatedSection() const;
 
   DataRefImpl getRawDataRefImpl() const;
 };
-typedef content_iterator<SectionRef> section_iterator;
 
 /// SymbolRef - This is a value type class that represents a single symbol in
 /// the list of symbols in the object file.
@@ -326,7 +324,7 @@ protected:
                                            bool &Result) const = 0;
   virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const = 0;
   virtual relocation_iterator getSectionRelEnd(DataRefImpl Sec) const = 0;
-
+  virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
 
   // Same as above for RelocationRef.
   friend class RelocationRef;
@@ -538,6 +536,10 @@ inline relocation_iterator SectionRef::end_relocations() const {
   return OwningObject->getSectionRelEnd(SectionPimpl);
 }
 
+inline section_iterator SectionRef::getRelocatedSection() const {
+  return OwningObject->getRelocatedSection(SectionPimpl);
+}
+
 inline DataRefImpl SectionRef::getRawDataRefImpl() const {
   return SectionPimpl;
 }
index 9f521330c34f4b3b25b3a15bbed79c7c15df6167..7e4132f059b37d799607ec14954f842e9d38ab0d 100644 (file)
@@ -19,6 +19,7 @@
 #include <algorithm>
 using namespace llvm;
 using namespace dwarf;
+using namespace object;
 
 typedef DWARFDebugLine::LineTable DWARFLineTable;
 
@@ -554,17 +555,26 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
         .Case("debug_addr", &AddrSection)
         // Any more debug info sections go here.
         .Default(0);
-    if (!Section)
-      continue;
-    *Section = data;
-    if (name == "debug_ranges") {
-      // FIXME: Use the other dwo range section when we emit it.
-      RangeDWOSection = data;
+    if (Section) {
+      *Section = data;
+      if (name == "debug_ranges") {
+        // FIXME: Use the other dwo range section when we emit it.
+        RangeDWOSection = data;
+      }
     }
 
+    section_iterator RelocatedSection = i->getRelocatedSection();
+    if (RelocatedSection == Obj->end_sections())
+      continue;
+
+    StringRef RelSecName;
+    RelocatedSection->getName(RelSecName);
+    RelSecName = RelSecName.substr(
+        RelSecName.find_first_not_of("._")); // Skip . and _ prefixes.
+
     // TODO: Add support for relocations in other sections as needed.
     // Record relocations for the debug_info and debug_line sections.
-    RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(name)
+    RelocAddrMap *Map = StringSwitch<RelocAddrMap*>(RelSecName)
         .Case("debug_info", &InfoRelocMap)
         .Case("debug_info.dwo", &InfoDWORelocMap)
         .Case("debug_line", &LineRelocMap)
@@ -574,7 +584,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
 
     if (i->begin_relocations() != i->end_relocations()) {
       uint64_t SectionSize;
-      i->getSize(SectionSize);
+      RelocatedSection->getSize(SectionSize);
       for (object::relocation_iterator reloc_i = i->begin_relocations(),
              reloc_e = i->end_relocations();
            reloc_i != reloc_e; reloc_i.increment(ec)) {
index 844f1c2931cb8cc20dca89a2c02626ee34cc7153..cee18c69adf7305f1f41d9baaa985f3141c765e1 100644 (file)
@@ -19,6 +19,7 @@
 #include "RuntimeDyldMachO.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Object/ELF.h"
 
 using namespace llvm;
 using namespace llvm::object;
@@ -146,6 +147,7 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
     bool isFirstRelocation = true;
     unsigned SectionID = 0;
     StubMap Stubs;
+    section_iterator RelocatedSection = si->getRelocatedSection();
 
     for (relocation_iterator i = si->begin_relocations(),
          e = si->end_relocations(); i != e; i.increment(err)) {
@@ -153,7 +155,8 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
 
       // If it's the first relocation in this section, find its SectionID
       if (isFirstRelocation) {
-        SectionID = findOrEmitSection(*obj, *si, true, LocalSections);
+        SectionID =
+            findOrEmitSection(*obj, *RelocatedSection, true, LocalSections);
         DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n");
         isFirstRelocation = false;
       }
@@ -214,11 +217,25 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj,
   unsigned StubBufSize = 0,
            StubSize = getMaxStubSize();
   error_code err;
+  const ObjectFile *ObjFile = Obj.getObjectFile();
+  // FIXME: this is an inefficient way to handle this. We should computed the
+  // necessary section allocation size in loadObject by walking all the sections
+  // once.
   if (StubSize > 0) {
-    for (relocation_iterator i = Section.begin_relocations(),
-         e = Section.end_relocations(); i != e; i.increment(err), Check(err))
-      StubBufSize += StubSize;
+    for (section_iterator SI = ObjFile->begin_sections(),
+           SE = ObjFile->end_sections();
+         SI != SE; SI.increment(err), Check(err)) {
+      section_iterator RelSecI = SI->getRelocatedSection();
+      if (!(RelSecI == Section))
+        continue;
+
+      for (relocation_iterator I = SI->begin_relocations(),
+             E = SI->end_relocations(); I != E; I.increment(err), Check(err)) {
+        StubBufSize += StubSize;
+      }
+    }
   }
+
   StringRef data;
   uint64_t Alignment64;
   Check(Section.getContents(data));
index e1d504ec8e913388d7742600cb6ad4696fa35d47..1803498991e75a98a05002b19734ad932131eac9 100644 (file)
@@ -71,10 +71,14 @@ MCObjectSymbolizer::MCObjectSymbolizer(MCContext &Ctx,
                         SI != SE;
                         SI.increment(ec)) {
     if (ec) break;
-    uint64_t StartAddr; SI->getAddress(StartAddr);
-    uint64_t Size; SI->getSize(Size);
-    StringRef SecName; SI->getName(SecName);
-    bool RequiredForExec; SI->isRequiredForExecution(RequiredForExec);
+
+    section_iterator RelSecI = SI->getRelocatedSection();
+    if (RelSecI == Obj->end_sections())
+      continue;
+
+    uint64_t StartAddr; RelSecI->getAddress(StartAddr);
+    uint64_t Size; RelSecI->getSize(Size);
+    bool RequiredForExec; RelSecI->isRequiredForExecution(RequiredForExec);
     if (RequiredForExec == false || Size == 0)
       continue;
     AddrToSection.insert(StartAddr, StartAddr + Size - 1,
index 77fd995cf0e4f997d9f78cb490480141a0be78b5..5b3165db94ffa7e78ff107ed3c3563ea8b5a3a2a 100644 (file)
@@ -33,6 +33,10 @@ error_code ObjectFile::getSymbolAlignment(DataRefImpl DRI,
   return object_error::success;
 }
 
+section_iterator ObjectFile::getRelocatedSection(DataRefImpl Sec) const {
+  return section_iterator(SectionRef(Sec, this));
+}
+
 ObjectFile *ObjectFile::createObjectFile(MemoryBuffer *Object) {
   if (!Object || Object->getBufferSize() < 64)
     return 0;
index cf411166a3a04d21175e78188b00e84cabe63c5f..1e12d69b76fa1adbaf84587a8f3c84b1ce5b5fc3 100644 (file)
@@ -20,7 +20,7 @@ entry:
 ; object file's .text section gets relocated in memory.
 
 ; CHECK:      Relocations [
-; CHECK-NEXT:   Section (1) .text {
+; CHECK-NEXT:   Section (2) .rela.text {
 ; CHECK-NEXT:     0x10 R_AARCH64_ADR_PREL_PG_HI21 testfn 0x0
 ; CHECK-NEXT:     0x14 R_AARCH64_ADD_ABS_LO12_NC testfn 0x0
 ; CHECK-NEXT:   }
index da94041c95ffce0dbdc00e5580e836db9dfbbe08..5343cc793ec0562eced7ca15d9fef30cb4e4cc0a 100644 (file)
@@ -3,7 +3,7 @@
 
 @var = global i32 0
 
-; CHECK-ELF: RELOCATION RECORDS FOR [.text]
+; CHECK-ELF: RELOCATION RECORDS FOR [.rela.text]
 
 define i32 @get_globalvar() {
 ; CHECK: get_globalvar:
index 8bf1b2ff4fa9b234aa35c506b1c7bf71b6b09e83..e09aa127ca2b2e40c91e46c7cf3210cf86da66ce 100644 (file)
@@ -11,7 +11,7 @@ define i32 @check_extern() {
 }
 
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rela.text {
 ; CHECK:     0x{{[0-9,A-F]+}} R_AARCH64_CALL26 memcpy
 ; CHECK:   }
 ; CHECK: ]
index 3c7f5f9ec1b07594205a592b339b1a1f665276e1..0f1e760a36750f0490a0bb08525f589ab00252e4 100644 (file)
@@ -54,13 +54,13 @@ lbl4:
 ; First make sure we get a page/lo12 pair in .text to pick up the jump-table
 
 ; CHECK-ELF:      Relocations [
-; CHECK-ELF:        Section ({{[0-9]+}}) .text {
+; CHECK-ELF:        Section ({{[0-9]+}}) .rela.text {
 ; CHECK-ELF-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 .rodata
 ; CHECK-ELF-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ADD_ABS_LO12_NC .rodata
 ; CHECK-ELF:        }
 
 ; Also check the targets in .rodata are relocated
-; CHECK-ELF:        Section ({{[0-9]+}}) .rodata {
+; CHECK-ELF:        Section ({{[0-9]+}}) .rela.rodata {
 ; CHECK-ELF-NEXT:     0x{{[0-9,A-F]+}} R_AARCH64_ABS64 .text
 ; CHECK-ELF:        }
 ; CHECK-ELF:      ]
index 9eecd045bfa06904b66c4aab7eb95ead4ecfaf16..6bea7b88e8ede3394f481027904210306e2274f7 100644 (file)
@@ -11,15 +11,15 @@ entry:
   ret i32 %0
 ; OBJ:        Section {
 ; OBJ:          Name: .text
+; OBJ:          SectionData (
+; OBJ-NEXT:       0000: 00482DE9 000000E3 000040E3 FEFFFFEB
+; OBJ-NEXT:       0010: 0088BDE8
+; OBJ-NEXT:     )
 ; OBJ:          Relocations [
 ; OBJ-NEXT:       0x4 R_ARM_MOVW_ABS_NC a
 ; OBJ-NEXT:       0x8 R_ARM_MOVT_ABS
 ; OBJ-NEXT:       0xC R_ARM_CALL foo
 ; OBJ-NEXT:     ]
-; OBJ-NEXT:     SectionData (
-; OBJ-NEXT:       0000: 00482DE9 000000E3 000040E3 FEFFFFEB
-; OBJ-NEXT:       0010: 0088BDE8
-; OBJ-NEXT:     )
 
 }
 
index 11f3e6db0fe55b849120f5710ad561f14b1c22e8..637a989240eb634077ee479e8526665819b6bc97 100644 (file)
@@ -44,6 +44,6 @@ declare void @_Z15throw_exceptionv()
 ; CHECK-FP-ELIM-NEXT: 0000 00000000 b0808480
 ; CHECK-FP-ELIM-NOT: section .ARM.extab
 
-; CHECK-RELOC: RELOCATION RECORDS FOR [.ARM.exidx]
+; CHECK-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
 ; CHECK-RELOC-NEXT: 0 R_ARM_PREL31 .text
 ; CHECK-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr0
index 79dba084c0447577c7e946aefb859a3b320498a0..5a54889d6a375ecfc091c010b7b0acdcba0b9673 100644 (file)
@@ -53,10 +53,10 @@ declare void @_Z15throw_exceptioni(i32)
 ; CHECK-FP-ELIM-NEXT: 0000 00000000 b0838480
 ; CHECK-FP-ELIM-NOT: section .ARM.extab
 
-; CHECK-RELOC: RELOCATION RECORDS FOR [.ARM.exidx]
+; CHECK-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
 ; CHECK-RELOC-NEXT: 0 R_ARM_PREL31 .text
 ; CHECK-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr1
 
-; CHECK-FP-ELIM-RELOC: RELOCATION RECORDS FOR [.ARM.exidx]
+; CHECK-FP-ELIM-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
 ; CHECK-FP-ELIM-RELOC-NEXT: 0 R_ARM_PREL31 .text
 ; CHECK-FP-ELIM-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr0
index bc60b3baf2bb09e81d78f57d3ed5ec1ae6232db8..a6e985545164d683451781eba509b9d09401e2b9 100644 (file)
@@ -20,7 +20,7 @@ entry:
 ; accessing function-scoped variable si.
 ;
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rela.text {
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM2:[^ ]+]]
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM2]]
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM2]]
index 720c5fb6dd65ffa9d8aaf56c4daf71f0c2cd115f..4550c39f151ecb4cd6e31848c759e194c7ce5db5 100644 (file)
@@ -22,12 +22,12 @@ entry:
 ; accessing external variable ei.
 ;
 ; MEDIUM:      Relocations [
-; MEDIUM:        Section (1) .text {
+; MEDIUM:        Section (2) .rela.text {
 ; MEDIUM-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM1:[^ ]+]]
 ; MEDIUM-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM1]]
 ;
 ; LARGE:       Relocations [
-; LARGE:         Section (1) .text {
+; LARGE:         Section (2) .rela.text {
 ; LARGE-NEXT:      0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM1:[^ ]+]]
 ; LARGE-NEXT:      0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM1]]
 
index ffc0db0d14cb99814e36b39ec6ff1813ae75d4dc..26cb6f28efc2a4d9a0f853ee78e287ca15c4ef89 100644 (file)
@@ -22,7 +22,7 @@ entry:
 ; for the call to __tls_get_addr.
 ;
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rela.text {
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_HA a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_LO a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLSGD          a
index 0f7a35295234b0220ad67b8bccc92acb847f71e7..f24a94bdb057f43e639eba463b3e362865b7f3db 100644 (file)
@@ -21,7 +21,7 @@ entry:
 ; accessing external variable a.
 ;
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rela.text {
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_HA    a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_LO_DS a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLS               a
index 29ee8768455281cb717af88de7bdb789b08ffaf9..4a7d7b3f918fbcf8de551dbfffa45ca95f73d86f 100644 (file)
@@ -23,7 +23,7 @@ entry:
 ; __tls_get_addr.
 ;
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rela.text {
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_HA a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_LO a
 ; CHECK:     0x{{[0-9,A-F]+}} R_PPC64_TLSLD          a
index 942920be4de238f0f0063180c6450b7b556ff957..bc43113fee03719d5ded588997ad7ee3890955ed 100644 (file)
@@ -40,7 +40,7 @@ define void @address() {
 ; OBJ: }
 
 ; OBJ: Relocations [
-; OBJ:   Section (1) .text {
+; OBJ:   Section (2) .rela.text {
 ; OBJ:     0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21   var8
 ; OBJ:     0x{{[0-9,A-F]+}} R_AARCH64_LDST8_ABS_LO12_NC  var8
 ; OBJ:     0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21   var16
index 0321dda332c22a1e12d6b7b9ddb032d00642d5d2..e37991bfba1c734027a89f0e2fe11a0e6020f089 100644 (file)
@@ -4,7 +4,7 @@
         add x2, x3, #:lo12:some_label
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0 R_AARCH64_ADD_ABS_LO12_NC some_label 0x0
 // OBJ-NEXT:   }
 // OBJ-NEXT: ]
index 684e75a33cb7369b5c44adb22f247fe53e9d7145..b70dfa70fb8ebd32470a2402526db5c1ced748c6 100644 (file)
@@ -4,7 +4,7 @@
         b.eq somewhere
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0 R_AARCH64_CONDBR19 somewhere 0x0
 // OBJ-NEXT:   }
 // OBJ-NEXT: ]
index de43c4feac9834a054d6b5838f0b6bc44b75f491..d4c3a4eb50d0e52829ad7aa16a1def2e4810059f 100644 (file)
@@ -7,7 +7,7 @@
         prfm pldl3keep, some_label
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0 R_AARCH64_LD_PREL_LO19 some_label 0x0
 // OBJ-NEXT:     0x4 R_AARCH64_LD_PREL_LO19 some_label 0x0
 // OBJ-NEXT:     0x8 R_AARCH64_LD_PREL_LO19 some_label 0x0
index e1f841bd20f75dfc29f51fda73dbc5c07304dcff..64bf63aa978e7a3b5d91a53cbfad5d854a932035 100644 (file)
@@ -8,7 +8,7 @@
         str q0, [sp, #:lo12:some_label]
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0  R_AARCH64_LDST8_ABS_LO12_NC   some_label 0x0
 // OBJ-NEXT:     0x4  R_AARCH64_LDST16_ABS_LO12_NC  some_label 0x0
 // OBJ-NEXT:     0x8  R_AARCH64_LDST32_ABS_LO12_NC  some_label 0x0
index 8a7e532cdd2315b176d6f4e1c4c174eb8f2d479f..333159562c0f42a219271b4aa421a59eb07a80e3 100644 (file)
@@ -23,7 +23,7 @@
         movn x19, #:abs_g2_s:some_label
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0  R_AARCH64_MOVW_UABS_G0    some_label 0x0
 // OBJ-NEXT:     0x4  R_AARCH64_MOVW_UABS_G0_NC some_label 0x0
 // OBJ-NEXT:     0x8  R_AARCH64_MOVW_UABS_G1    some_label 0x0
index b5f072712fd716be5c96bbc3521b625e7d936427..093891d931aa067db03cc0f97339463bd47a62df 100644 (file)
@@ -8,7 +8,7 @@
         ldr x0, [x5, #:got_lo12:some_label]
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0 R_AARCH64_ADR_PREL_LO21    some_label 0x0
 // OBJ-NEXT:     0x4 R_AARCH64_ADR_PREL_PG_HI21 some_label 0x0
 // OBJ-NEXT:     0x8 R_AARCH64_ADR_GOT_PAGE     some_label 0x0
index 037e89632e824462686a2cb2ddb629af7aeb3f96..25c98163b58465c98a041aac43d5ae0214087dfd 100644 (file)
@@ -5,7 +5,7 @@
         tbnz w3, #15, somewhere
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0  R_AARCH64_TSTBR14 somewhere 0x0
 // OBJ-NEXT:     0x4  R_AARCH64_TSTBR14 somewhere 0x0
 // OBJ-NEXT:   }
index bead07c12d2c45ea9af98808facd2154e03faaf0..9ac66bd876a7e2ded0e352a300b5119fa129a8f9 100644 (file)
@@ -5,7 +5,7 @@
         bl somewhere
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rela.text {
 // OBJ-NEXT:     0x0 R_AARCH64_JUMP26 somewhere 0x0
 // OBJ-NEXT:     0x4 R_AARCH64_CALL26 somewhere 0x0
 // OBJ-NEXT:   }
index d0e336ecaf23acaf172206d49c2611aa046cfa87..5cbd794ac942ac9ccd2a15b9be9bf43d8216d9dd 100644 (file)
@@ -17,7 +17,7 @@
 // CHECK-NEXT:                                 //   fixup A - offset: 0, value: :dtprel_g2:var, kind: fixup_a64_movw_dtprel_g2
 
 // CHECK-ELF:      Relocations [
-// CHECK-ELF-NEXT:   Section (1) .text {
+// CHECK-ELF-NEXT:   Section (2) .rela.text {
 // CHECK-ELF-NEXT:     0x0 R_AARCH64_TLSLD_MOVW_DTPREL_G2 [[VARSYM:[^ ]+]]
 // CHECK-ELF-NEXT:     0x4 R_AARCH64_TLSLD_MOVW_DTPREL_G2 [[VARSYM]]
 // CHECK-ELF-NEXT:     0x8 R_AARCH64_TLSLD_MOVW_DTPREL_G2 [[VARSYM]]
index 6b866d5538d706021ed9065e032504920ac346dc..1d825bf3ddc115227cd5dc8841982d3b4f06a478 100644 (file)
@@ -50,15 +50,6 @@ func2:
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.exidx.TEST1
 @-------------------------------------------------------------------------------
-@ The first word should be relocated to .TEST1 section.  Besides, there is
-@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
-@ will keep __aeabi_unwind_cpp_pr0.
-@-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .TEST1 0x0
-@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
-@ CHECK:     ]
-@-------------------------------------------------------------------------------
 @ 0x80   = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
 @ 0x9B   = $sp can be found in $r11
 @ 0x8480 = pop {r11, r14}
@@ -67,6 +58,15 @@ func2:
 @ CHECK:       0000: 00000000 80849B80                    |........|
 @ CHECK:     )
 @ CHECK:   }
+@-------------------------------------------------------------------------------
+@ The first word should be relocated to .TEST1 section.  Besides, there is
+@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
+@ will keep __aeabi_unwind_cpp_pr0.
+@-------------------------------------------------------------------------------
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .TEST1 0x0
+@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
@@ -84,15 +84,6 @@ func2:
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.exidx.TEST2
 @-------------------------------------------------------------------------------
-@ The first word should be relocated to .TEST2 section.  Besides, there is
-@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
-@ will keep __aeabi_unwind_cpp_pr0.
-@-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .TEST2 0x0
-@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
-@ CHECK:     ]
-@-------------------------------------------------------------------------------
 @ 0x80   = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
 @ 0x8480 = pop {r11, r14}
 @ 0xB0   = finish
@@ -102,3 +93,12 @@ func2:
 @ CHECK:     )
 @ CHECK:   }
 @ CHECK: ]
+@-------------------------------------------------------------------------------
+@ The first word should be relocated to .TEST2 section.  Besides, there is
+@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
+@ will keep __aeabi_unwind_cpp_pr0.
+@-------------------------------------------------------------------------------
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .TEST2 0x0
+@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
+@ CHECK:     ]
index 0fac3e210098cbd5e9267473be8c7fac768b7fdb..41971d0c4438ededf360c86fa0d7ec5922732469 100644 (file)
@@ -56,6 +56,11 @@ func1:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.exidx.TEST1
+@ CHECK:     SectionData (
+@ CHECK:       0000: 00000000 00000000                    |........|
+@ CHECK:     )
+@ CHECK:   }
+@ CHECK: ]
 @-------------------------------------------------------------------------------
 @ The first word should be relocated to .TEST1 section, and the second word
 @ should be relocated to .ARM.extab.TEST1 section.  Besides, there is
@@ -67,8 +72,3 @@ func1:
 @ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr1 0x0
 @ CHECK:       0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
 @ CHECK:     ]
-@ CHECK:     SectionData (
-@ CHECK:       0000: 00000000 00000000                    |........|
-@ CHECK:     )
-@ CHECK:   }
-@ CHECK: ]
index 0545f6d3c8ded49d3bc332e9ca1401168d3fbf17..499c2c44dfc33a3fff8fafacc7cc4e330c87565d 100644 (file)
@@ -37,9 +37,6 @@ func1:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.exidx
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
-@ CHECK:     ]
 @-------------------------------------------------------------------------------
 @ The first word should be the offset to .text.
 @ The second word should be EXIDX_CANTUNWIND (01000000).
@@ -49,3 +46,6 @@ func1:
 @ CHECK:     )
 @ CHECK:   }
 @ CHECK: ]
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
+@ CHECK:     ]
index 45f22ddb6304bae6736d11168326151837d87299..793d357bac76c49eac69e63d761536a7a6a10801 100644 (file)
@@ -35,6 +35,10 @@ func1:
 
 @ CHECK:Section {
 @ CHECK:  Name: .ARM.exidx.TEST1
+@ CHECK:  SectionData (
+@ CHECK:    0000: 00000000 00000000                    |........|
+@ CHECK:  )
+@ CHECK:}
 @-------------------------------------------------------------------------------
 @ We should see a relocation entry to __aeabi_unwind_cpp_pr0, so that the
 @ linker can keep __aeabi_unwind_cpp_pr0.
@@ -44,11 +48,6 @@ func1:
 @ CHECK:    0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
 @ CHECK:    0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
 @ CHECK:  ]
-@ CHECK:  SectionData (
-@ CHECK:    0000: 00000000 00000000                    |........|
-@ CHECK:  )
-@ CHECK:}
-
 
 
 
@@ -93,6 +92,10 @@ func2:
 
 @ CHECK:Section {
 @ CHECK:  Name: .ARM.exidx.TEST2
+@ CHECK:  SectionData (
+@ CHECK:    0000: 00000000 00000000                    |........|
+@ CHECK:  )
+@ CHECK:}
 @-------------------------------------------------------------------------------
 @ We should see a relocation entry to __aeabi_unwind_cpp_pr0, so that the
 @ linker can keep __aeabi_unwind_cpp_pr0.
@@ -102,7 +105,3 @@ func2:
 @ CHECK:    0x0 R_ARM_NONE __aeabi_unwind_cpp_pr1 0x0
 @ CHECK:    0x4 R_ARM_PREL31 .ARM.extab.TEST2 0x0
 @ CHECK:  ]
-@ CHECK:  SectionData (
-@ CHECK:    0000: 00000000 00000000                    |........|
-@ CHECK:  )
-@ CHECK:}
index 2267108b2864595e39b09b690dca312fef7af39c..f49372295748d07830c2547d9836e1d0e7a133b5 100644 (file)
@@ -28,24 +28,23 @@ func1:
 @ CHECK: }
 @ CHECK: Section {
 @ CHECK:   Name: .ARM.extab.TEST1
-@ CHECK:   Relocations [
-@ CHECK:     0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:   ]
 @ CHECK:   SectionData (
 @ CHECK:     0000: 00000000 B0B0B000                    |........|
 @ CHECK:   )
 @ CHECK: }
-@ CHECK: Section {
-@ CHECK:   Name: .ARM.exidx.TEST1
 @ CHECK:   Relocations [
-@ CHECK:     0x0 R_ARM_PREL31 .TEST1 0x0
-@ CHECK:     0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
+@ CHECK:     0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
 @ CHECK:   ]
+@ CHECK: Section {
+@ CHECK:   Name: .ARM.exidx.TEST1
 @ CHECK:   SectionData (
 @ CHECK:     0000: 00000000 00000000                    |........|
 @ CHECK:   )
 @ CHECK: }
-
+@ CHECK:   Relocations [
+@ CHECK:     0x0 R_ARM_PREL31 .TEST1 0x0
+@ CHECK:     0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
+@ CHECK:   ]
 
 
 @-------------------------------------------------------------------------------
@@ -71,20 +70,20 @@ func2:
 @ CHECK: }
 @ CHECK: Section {
 @ CHECK:   Name: .ARM.extab.TEST2
-@ CHECK:   Relocations [
-@ CHECK:     0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:   ]
 @ CHECK:   SectionData (
 @ CHECK:     0000: 00000000 B0B0B000                    |........|
 @ CHECK:   )
 @ CHECK: }
-@ CHECK: Section {
-@ CHECK:   Name: .ARM.exidx.TEST2
 @ CHECK:   Relocations [
-@ CHECK:     0x0 R_ARM_PREL31 .TEST2 0x0
-@ CHECK:     0x4 R_ARM_PREL31 .ARM.extab.TEST2 0x0
+@ CHECK:     0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
 @ CHECK:   ]
+@ CHECK: Section {
+@ CHECK:   Name: .ARM.exidx.TEST2
 @ CHECK:   SectionData (
 @ CHECK:     0000: 00000000 00000000                    |........|
 @ CHECK:   )
 @ CHECK: }
+@ CHECK:   Relocations [
+@ CHECK:     0x0 R_ARM_PREL31 .TEST2 0x0
+@ CHECK:     0x4 R_ARM_PREL31 .ARM.extab.TEST2 0x0
+@ CHECK:   ]
index 444099f8f648c2adb004575ce7af0477f74f532e..9f632b8b89a6d36dab14be4ae8e7ec58bda85e0d 100644 (file)
@@ -65,14 +65,14 @@ func2:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.extab.TEST1
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:       0x8 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @ CHECK:       0000: 00000000 B0B0B000 00000000 B0B0B000  |................|
 @ CHECK:     )
 @ CHECK:   }
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK:       0x8 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
@@ -82,6 +82,15 @@ func2:
 @ CHECK:     Name: .ARM.exidx.TEST1
 @ CHECK:     Link: 4
 @-------------------------------------------------------------------------------
+@ The first word should be the offset to .TEST1.
+@ The second word should be the offset to .ARM.extab.TEST1
+@-------------------------------------------------------------------------------
+@ CHECK:     SectionData (
+@ CHECK:       0000: 00000000 00000000 04000000 08000000  |................|
+@ CHECK:     )
+@ CHECK:   }
+@ CHECK: ]
+@-------------------------------------------------------------------------------
 @ The first word of each entry should be relocated to .TEST1 section.
 @ The second word of each entry should be relocated to
 @ .ARM.extab.TESET1 section.
@@ -92,16 +101,6 @@ func2:
 @ CHECK:       0x8 R_ARM_PREL31 .TEST1 0x0
 @ CHECK:       0xC R_ARM_PREL31 .ARM.extab.TEST1 0x0
 @ CHECK:     ]
-@-------------------------------------------------------------------------------
-@ The first word should be the offset to .TEST1.
-@ The second word should be the offset to .ARM.extab.TEST1
-@-------------------------------------------------------------------------------
-@ CHECK:     SectionData (
-@ CHECK:       0000: 00000000 00000000 04000000 08000000  |................|
-@ CHECK:     )
-@ CHECK:   }
-@ CHECK: ]
-
 
 
 @-------------------------------------------------------------------------------
index 5f5d1252f858b19d52796b1f4ec20856d2503617..7c1f32ee39d4e202c80cc0d613801dd3f6c4b5e5 100644 (file)
@@ -60,13 +60,13 @@ func2:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.extab.TEST1
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @ CHECK:       0000: 00000000 B0B0B000                    |........|
 @ CHECK:     )
 @ CHECK:   }
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
@@ -85,15 +85,14 @@ func2:
 @ The second word should be relocated to the EHTAB entry in .ARM.extab.TEST1
 @ section.
 @-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .TEST1 0x0
-@ CHECK:       0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @ CHECK:       0000: 00000000 00000000                    |........|
 @ CHECK:     )
 @ CHECK:   }
-
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .TEST1 0x0
+@ CHECK:       0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
@@ -112,13 +111,13 @@ func2:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.extabTEST2
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @ CHECK:       0000: 00000000 B0B0B000                    |........|
 @ CHECK:     )
 @ CHECK:   }
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
@@ -137,15 +136,15 @@ func2:
 @ The second word should be relocated to the EHTAB entry in .ARM.extabTEST2
 @ section.
 @-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 TEST2 0x0
-@ CHECK:       0x4 R_ARM_PREL31 .ARM.extabTEST2 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @ CHECK:       0000: 00000000 00000000                    |........|
 @ CHECK:     )
 @ CHECK:   }
 @ CHECK: ]
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 TEST2 0x0
+@ CHECK:       0x4 R_ARM_PREL31 .ARM.extabTEST2 0x0
+@ CHECK:     ]
 
 
 
index c9412763a8031b0358cc7f41c54e6ca61f4d88e7..50e09f5f11b74b1746868975ae98a4212ae20332 100644 (file)
@@ -45,14 +45,6 @@ func2:
 @-------------------------------------------------------------------------------
 @ CHECK:   Section {
 @ CHECK:     Name: .ARM.exidx
-@-------------------------------------------------------------------------------
-@ The first word of each entry should be relocated to .text section.
-@-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
-@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
-@ CHECK:       0x8 R_ARM_PREL31 .text 0x0
-@ CHECK:     ]
 @ CHECK:     SectionData (
 @-------------------------------------------------------------------------------
 @ The first word should be the offset to .text.  The second word should be
@@ -64,6 +56,14 @@ func2:
 @ CHECK:   }
 @ CHECK: ]
 
+@-------------------------------------------------------------------------------
+@ The first word of each entry should be relocated to .text section.
+@-------------------------------------------------------------------------------
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
+@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
+@ CHECK:       0x8 R_ARM_PREL31 .text 0x0
+@ CHECK:     ]
 
 
 @-------------------------------------------------------------------------------
index 5ab1baa592f5653864d0bdf9bcff7c6f3f9b3451..4a073aa81151ddf6ae396e6c80d59c1cba0dabd6 100644 (file)
@@ -60,16 +60,6 @@ func1:
 @-------------------------------------------------------------------------------
 @ CHECK:     Link: 1
 
-@-------------------------------------------------------------------------------
-@ The first word should be relocated to the code address in .text section.
-@ Besides, since this function is using compact model 0, thus we have to
-@ add an relocation to __aeabi_unwind_cpp_pr0.
-@-------------------------------------------------------------------------------
-@ CHECK:     Relocations [
-@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
-@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
-@ CHECK:     ]
-
 @-------------------------------------------------------------------------------
 @ The first word should be the offset to .text.  The second word should be
 @ 0xB0B0B080, which means compact model 0 is used (0x80) and the rest of the
@@ -80,3 +70,13 @@ func1:
 @ CHECK:     )
 @ CHECK:   }
 @ CHECK: ]
+
+@-------------------------------------------------------------------------------
+@ The first word should be relocated to the code address in .text section.
+@ Besides, since this function is using compact model 0, thus we have to
+@ add an relocation to __aeabi_unwind_cpp_pr0.
+@-------------------------------------------------------------------------------
+@ CHECK:     Relocations [
+@ CHECK:       0x0 R_ARM_PREL31 .text 0x0
+@ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
+@ CHECK:     ]
index 74b3c9f2f53be2af4ae4d0efc9c0d61a5a010841..0080db4ac8a04e231f0b070d01094dfa06c8b976 100644 (file)
@@ -30,9 +30,29 @@ barf:                                   @ @barf
 @ OBJ-NEXT:     AddressAlignment: 4
 @ OBJ-NEXT:     EntrySize: 0
 @ OBJ-NEXT:     Relocations [
-@ OBJ-NEXT:       0x0 R_ARM_MOVW_PREL_NC
-@ OBJ-NEXT:       0x4 R_ARM_MOVT_PREL
 @ OBJ-NEXT:     ]
 @ OBJ-NEXT:     SectionData (
 @ OBJ-NEXT:       0000: F00F0FE3 F40F4FE3
 @ OBJ-NEXT:     )
+@ OBJ-NEXT:   }
+@ OBJ-NEXT:   Section {
+@ OBJ-NEXT:     Index: 2
+@ OBJ-NEXT:     Name: .rel.text (1)
+@ OBJ-NEXT:     Type: SHT_REL (0x9)
+@ OBJ-NEXT:     Flags [ (0x0)
+@ OBJ-NEXT:     ]
+@ OBJ-NEXT:     Address: 0x0
+@ OBJ-NEXT:     Offset: 0x22C
+@ OBJ-NEXT:     Size: 16
+@ OBJ-NEXT:     Link: 6
+@ OBJ-NEXT:     Info: 1
+@ OBJ-NEXT:     AddressAlignment: 4
+@ OBJ-NEXT:     EntrySize: 8
+@ OBJ-NEXT:     Relocations [
+@ OBJ-NEXT:       0x0 R_ARM_MOVW_PREL_NC
+@ OBJ-NEXT:       0x4 R_ARM_MOVT_PREL
+@ OBJ-NEXT:   ]
+@ OBJ-NEXT:     SectionData (
+@ OBJ-NEXT:       0000: 00000000 2D060000 04000000 2E060000  |....-...........|
+@ OBJ-NEXT:     )
+@ OBJ-NEXT:   }
index 9b5dbd9e99dd9e06165f9079a5727ad56605b9da..28be85b7db121bc943645d4a705c7643e219c7ed 100644 (file)
@@ -61,7 +61,7 @@ bb3:                                              ; preds = %bb, %entry
 declare void @exit(i32) noreturn nounwind
 
 ; OBJ: Relocations [
-; OBJ:   Section (1) .text {
+; OBJ:   Section (2) .rel.text {
 ; OBJ:     0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC _MergedGlobals
 ; OBJ:   }
 ; OBJ: ]
index f0217644cad952d55bac4f42ec65539de69632bb..7eb49cc5510ffd800456cbfd4b9df30ce9ee4beb 100644 (file)
@@ -42,7 +42,7 @@ declare i32 @write(...)
 declare void @exit(i32) noreturn nounwind
 
 ;; OBJ:      Relocations [
-;; OBJ:        Section (1) .text {
+;; OBJ:        Section (2) .rel.text {
 ;; OBJ-NEXT:     0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC .L.str
 ;; OBJ:        }
 ;; OBJ:      ]
index ac46e697c18ab9ecef001b16dc99caa0f765aa9f..ee5e59eb340cde199635b90cc4c1dfec25dab61e 100644 (file)
@@ -89,7 +89,7 @@ entry:
 declare void @exit(i32) noreturn nounwind
 
 ;; OBJ: Relocations [
-;; OBJ:   Section (1) .text {
+;; OBJ:   Section (2) .rel.text {
 ;; OBJ:     0x{{[0-9,A-F]+}} R_ARM_MOVW_ABS_NC vtable
 ;; OBJ:   }
 ;; OBJ: ]
index 612942f2c59504ade6da71d54a8e3961ed54e872..a0402bdc3814e1f621ca63f8f2058f5b50cbabcd 100644 (file)
@@ -8,7 +8,7 @@
         b some_label
 
 // OBJ:      Relocations [
-// OBJ-NEXT:   Section (1) .text {
+// OBJ-NEXT:   Section (2) .rel.text {
 // OBJ-NEXT:     0x0  R_ARM_JUMP24 some_label 0x0
 // OBJ-NEXT:     0x4  R_ARM_CALL   some_label 0x0
 // OBJ-NEXT:     0x8  R_ARM_CALL   some_label 0x0
index e7d2c340d44d7cc04c498872a7a1b81eb0394c96..9fd360e1a01395b7925a16a541e8567e17593504 100644 (file)
@@ -29,7 +29,7 @@ entry:
 ; CHECK: ]
 
 ; CHECK:      Relocations [
-; CHECK-NEXT:   Section (1) .text {
+; CHECK-NEXT:   Section (2) .rel.text {
 ; CHECK-NEXT:     0x8 R_ARM_THM_CALL foo 0x0
 ; CHECK-NEXT:   }
 ; CHECK-NEXT: ]
index 87a26d8df84e802546bec54c44a1b1d9cc6de2a9..de3594e1ce174182b656acd504112c4690f51c0b 100644 (file)
@@ -18,7 +18,7 @@ f:
 
 @@ make sure an R_ARM_THM_CALL relocation is generated for the call to g
 @CHECK:      Relocations [
-@CHECK-NEXT:   Section (1) .text {
+@CHECK-NEXT:   Section (2) .rel.text {
 @CHECK-NEXT:     0x4 R_ARM_THM_CALL g 0x0
 @CHECK-NEXT:   }
 @CHECK-NEXT: ]
index c25c25932f09434642617e11bb8033212922e9ae..f5448e5ffb53a3b5b63837c888f462221fab7bd7 100644 (file)
@@ -18,7 +18,7 @@ foo2:
     .quad    bar2
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{[0-9]+}}) zed {
+// CHECK-NEXT:   Section ({{[0-9]+}}) .relazed {
 // CHECK-NEXT:     0x1 R_X86_64_PLT32 bar 0xFFFFFFFFFFFFFFFC
 // CHECK-NEXT:     0x5 R_X86_64_64 bar2 0x0
 // CHECK-NEXT:   }
index 3ddb53981a9ff15c9e08423c4bbae8175e4ee2b2..1f618e1bb6c6683ae97860b83ab179660a986fbf 100644 (file)
@@ -45,7 +45,7 @@ main:                                   # @main
 // CHECK:     Name: .rel.text
 
 // CHECK: Relocations [
-// CHECK:   Section (1) .text {
+// CHECK:   Section (2) .rel.text {
 // CHECK:     0x6  R_386_32   .rodata.str1.1
 // CHECK:     0xB  R_386_PC32 puts
 // CHECK:     0x12 R_386_32   .rodata.str1.1
index f98623ad1e3c9c31cd4b73ff4f79dd62f6cc7a4b..a77f3e63e09315e0efea81bf85bfc97649008f78 100644 (file)
@@ -45,7 +45,7 @@ main:                                   # @main
 // CHECK:     Name: .rela.text
 
 // CHECK: Relocations [
-// CHECK:   Section (1) .text {
+// CHECK:   Section (2) .rela.text {
 // CHECK:     0x5  R_X86_64_32   .rodata.str1.1 0x0
 // CHECK:     0xA  R_X86_64_PC32 puts           0xFFFFFFFFFFFFFFFC
 // CHECK:     0xF  R_X86_64_32   .rodata.str1.1 0x6
index 137b8b6f84906fdbc6352a35543cd3176d363907..b3768cb9834cbf966bd6920dac3e6b294301dc7c 100644 (file)
@@ -26,7 +26,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -49,5 +48,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 1cad32507cde8b70ea70d5cd24fd8017913db878..d7a53c462b704273700c316551acc2539721111e 100644 (file)
@@ -24,7 +24,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -46,5 +45,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index f1a54a810e0a2756c708767e3aee96b6c4c7b658..eac2c731fa93fb93bd5ae9ae667560581ff7bed0 100644 (file)
@@ -25,7 +25,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -48,5 +47,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index b1e74ea098c262f58c35b467d10d1fea77df2c7f..00d8b99af9d63509a3e163cf849236cf502febe6 100644 (file)
@@ -21,7 +21,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -43,5 +42,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index abde0de4fad076db5a3ca6bd94b743a112f9cb5c..36e147f5a4da75c31b790ccd9667fb34537b195f 100644 (file)
@@ -21,7 +21,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -43,5 +42,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index a910faba64cc50c027de67b5e78a9b04a7d16bf8..839d6717debc3e7ecf1836b6aa810174b2993ee8 100644 (file)
@@ -22,7 +22,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -44,5 +43,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index f7f95fbc5f2daf3dd6e5b39b0b65f980a537c81d..951a6001e5193a9bbc350f88a3937215fd640bf2 100644 (file)
@@ -21,7 +21,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -43,5 +42,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index f7a07e45d8b5d88d7024a7a1fdab90fb9705a9d6..4abbb53b8fc90af26c917eb10c8033b42bc91736 100644 (file)
@@ -22,7 +22,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -44,5 +43,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 35a73efb0f4ae3285e4d6ae118e8de62f9177a7f..34254c862a467474f4320d1d3a63fac38986d5c0 100644 (file)
@@ -29,7 +29,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -52,5 +51,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 5817d1f4af7fb0ce705671080ebb94da3e3c4d17..3de769f39fa037e818387c4324ff5ca68bed4d9a 100644 (file)
@@ -21,7 +21,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -43,5 +42,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 932a1828eb2966372c3840253d9620b07c452dbc..98c759d4fffcbbeabcd583e898061f4ee95020d2 100644 (file)
@@ -24,7 +24,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -46,5 +45,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 6c25d5b47195f59bf8757d4f7e91e901a39b86f8..d25b5ff2e93fb75add3b92d6a68ec8eb1602b7d1 100644 (file)
@@ -22,7 +22,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -44,5 +43,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 075c6b9b84354a621d1f3783efa25b174f494403..9f5ae4be9ed466e27876ff8f81d2d5e212d84a6e 100644 (file)
@@ -22,7 +22,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -44,5 +43,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index c83b47c142b48053cf64e9b974d064cfdc980c42..9773a36a3b03376b27f59fc36d8f0d18a3cac7a2 100644 (file)
@@ -22,7 +22,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -44,5 +43,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK:        }
index 4ac0e34f10c343dea5884385201e9abf9c273504..05cb0ae35bd28a42c316a24b7bc28cc29a39ed0d 100644 (file)
@@ -28,7 +28,6 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A5200 01781001
@@ -51,4 +50,5 @@ f:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20 R_X86_64_PC32 .text 0x0
 // CHECK-NEXT:     ]
index 98f4fa9c62e6ac38dc05b50e233c81b7e099a4f4..b8b6e6b52af16aea0db50085db695060ee994d9f 100644 (file)
@@ -227,78 +227,6 @@ f36:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
-// CHECK-NEXT:       0x20  R_X86_64_PC32 .text 0x0
-// CHECK-NEXT:       0x29  R_X86_64_32   bar   0x0
-// CHECK-NEXT:       0x43  R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x5C  R_X86_64_PC32 .text 0x1
-// CHECK-NEXT:       0x65  R_X86_64_32   bar   0x0
-// CHECK-NEXT:       0x74  R_X86_64_PC32 .text 0x2
-// CHECK-NEXT:       0x7D  R_X86_64_32   bar   0x0
-// CHECK-NEXT:       0x97  R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0xB0  R_X86_64_PC32 .text 0x3
-// CHECK-NEXT:       0xB9  R_X86_64_16   bar   0x0
-// CHECK-NEXT:       0xCE  R_X86_64_16   foo   0x0
-// CHECK-NEXT:       0xE0  R_X86_64_PC32 .text 0x4
-// CHECK-NEXT:       0xFE  R_X86_64_32   foo   0x0
-// CHECK-NEXT:       0x110 R_X86_64_PC32 .text 0x5
-// CHECK-NEXT:       0x12E R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x144 R_X86_64_PC32 .text 0x6
-// CHECK-NEXT:       0x162 R_X86_64_16   foo   0x0
-// CHECK-NEXT:       0x174 R_X86_64_PC32 .text 0x7
-// CHECK-NEXT:       0x192 R_X86_64_32   foo   0x0
-// CHECK-NEXT:       0x1A4 R_X86_64_PC32 .text 0x8
-// CHECK-NEXT:       0x1C2 R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x1D8 R_X86_64_PC32 .text 0x9
-// CHECK-NEXT:       0x1F6 R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x20C R_X86_64_PC32 .text 0xA
-// CHECK-NEXT:       0x22A R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x240 R_X86_64_PC32 .text 0xB
-// CHECK-NEXT:       0x25E R_X86_64_PC16 foo   0x0
-// CHECK-NEXT:       0x270 R_X86_64_PC32 .text 0xC
-// CHECK-NEXT:       0x28E R_X86_64_PC32 foo   0x0
-// CHECK-NEXT:       0x2A0 R_X86_64_PC32 .text 0xD
-// CHECK-NEXT:       0x2BE R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x2D4 R_X86_64_PC32 .text 0xE
-// CHECK-NEXT:       0x2F2 R_X86_64_PC16 foo   0x0
-// CHECK-NEXT:       0x304 R_X86_64_PC32 .text 0xF
-// CHECK-NEXT:       0x322 R_X86_64_PC32 foo   0x0
-// CHECK-NEXT:       0x334 R_X86_64_PC32 .text 0x10
-// CHECK-NEXT:       0x352 R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x368 R_X86_64_PC32 .text 0x11
-// CHECK-NEXT:       0x386 R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x39C R_X86_64_PC32 .text 0x12
-// CHECK-NEXT:       0x3BA R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x3D0 R_X86_64_PC32 .text 0x13
-// CHECK-NEXT:       0x3EE R_X86_64_16   foo   0x0
-// CHECK-NEXT:       0x400 R_X86_64_PC32 .text 0x14
-// CHECK-NEXT:       0x41E R_X86_64_32   foo   0x0
-// CHECK-NEXT:       0x430 R_X86_64_PC32 .text 0x15
-// CHECK-NEXT:       0x44E R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x464 R_X86_64_PC32 .text 0x16
-// CHECK-NEXT:       0x482 R_X86_64_16   foo   0x0
-// CHECK-NEXT:       0x494 R_X86_64_PC32 .text 0x17
-// CHECK-NEXT:       0x4B2 R_X86_64_32   foo   0x0
-// CHECK-NEXT:       0x4C4 R_X86_64_PC32 .text 0x18
-// CHECK-NEXT:       0x4E2 R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x4F8 R_X86_64_PC32 .text 0x19
-// CHECK-NEXT:       0x516 R_X86_64_64   foo   0x0
-// CHECK-NEXT:       0x52C R_X86_64_PC32 .text 0x1A
-// CHECK-NEXT:       0x54A R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x560 R_X86_64_PC32 .text 0x1B
-// CHECK-NEXT:       0x57E R_X86_64_PC16 foo   0x0
-// CHECK-NEXT:       0x590 R_X86_64_PC32 .text 0x1C
-// CHECK-NEXT:       0x5AE R_X86_64_PC32 foo   0x0
-// CHECK-NEXT:       0x5C0 R_X86_64_PC32 .text 0x1D
-// CHECK-NEXT:       0x5DE R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x5F4 R_X86_64_PC32 .text 0x1E
-// CHECK-NEXT:       0x612 R_X86_64_PC16 foo   0x0
-// CHECK-NEXT:       0x624 R_X86_64_PC32 .text 0x1F
-// CHECK-NEXT:       0x642 R_X86_64_PC32 foo   0x0
-// CHECK-NEXT:       0x654 R_X86_64_PC32 .text 0x20
-// CHECK-NEXT:       0x672 R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x688 R_X86_64_PC32 .text 0x21
-// CHECK-NEXT:       0x6A6 R_X86_64_PC64 foo   0x0
-// CHECK-NEXT:       0x6BC R_X86_64_PC32 .text 0x22
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     SectionData (
 // CHECK-NEXT:       0000: 14000000 00000000 017A4C52 00017810
@@ -427,5 +355,77 @@ f36:
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x20  R_X86_64_PC32 .text 0x0
+// CHECK-NEXT:       0x29  R_X86_64_32   bar   0x0
+// CHECK-NEXT:       0x43  R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x5C  R_X86_64_PC32 .text 0x1
+// CHECK-NEXT:       0x65  R_X86_64_32   bar   0x0
+// CHECK-NEXT:       0x74  R_X86_64_PC32 .text 0x2
+// CHECK-NEXT:       0x7D  R_X86_64_32   bar   0x0
+// CHECK-NEXT:       0x97  R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0xB0  R_X86_64_PC32 .text 0x3
+// CHECK-NEXT:       0xB9  R_X86_64_16   bar   0x0
+// CHECK-NEXT:       0xCE  R_X86_64_16   foo   0x0
+// CHECK-NEXT:       0xE0  R_X86_64_PC32 .text 0x4
+// CHECK-NEXT:       0xFE  R_X86_64_32   foo   0x0
+// CHECK-NEXT:       0x110 R_X86_64_PC32 .text 0x5
+// CHECK-NEXT:       0x12E R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x144 R_X86_64_PC32 .text 0x6
+// CHECK-NEXT:       0x162 R_X86_64_16   foo   0x0
+// CHECK-NEXT:       0x174 R_X86_64_PC32 .text 0x7
+// CHECK-NEXT:       0x192 R_X86_64_32   foo   0x0
+// CHECK-NEXT:       0x1A4 R_X86_64_PC32 .text 0x8
+// CHECK-NEXT:       0x1C2 R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x1D8 R_X86_64_PC32 .text 0x9
+// CHECK-NEXT:       0x1F6 R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x20C R_X86_64_PC32 .text 0xA
+// CHECK-NEXT:       0x22A R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x240 R_X86_64_PC32 .text 0xB
+// CHECK-NEXT:       0x25E R_X86_64_PC16 foo   0x0
+// CHECK-NEXT:       0x270 R_X86_64_PC32 .text 0xC
+// CHECK-NEXT:       0x28E R_X86_64_PC32 foo   0x0
+// CHECK-NEXT:       0x2A0 R_X86_64_PC32 .text 0xD
+// CHECK-NEXT:       0x2BE R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x2D4 R_X86_64_PC32 .text 0xE
+// CHECK-NEXT:       0x2F2 R_X86_64_PC16 foo   0x0
+// CHECK-NEXT:       0x304 R_X86_64_PC32 .text 0xF
+// CHECK-NEXT:       0x322 R_X86_64_PC32 foo   0x0
+// CHECK-NEXT:       0x334 R_X86_64_PC32 .text 0x10
+// CHECK-NEXT:       0x352 R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x368 R_X86_64_PC32 .text 0x11
+// CHECK-NEXT:       0x386 R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x39C R_X86_64_PC32 .text 0x12
+// CHECK-NEXT:       0x3BA R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x3D0 R_X86_64_PC32 .text 0x13
+// CHECK-NEXT:       0x3EE R_X86_64_16   foo   0x0
+// CHECK-NEXT:       0x400 R_X86_64_PC32 .text 0x14
+// CHECK-NEXT:       0x41E R_X86_64_32   foo   0x0
+// CHECK-NEXT:       0x430 R_X86_64_PC32 .text 0x15
+// CHECK-NEXT:       0x44E R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x464 R_X86_64_PC32 .text 0x16
+// CHECK-NEXT:       0x482 R_X86_64_16   foo   0x0
+// CHECK-NEXT:       0x494 R_X86_64_PC32 .text 0x17
+// CHECK-NEXT:       0x4B2 R_X86_64_32   foo   0x0
+// CHECK-NEXT:       0x4C4 R_X86_64_PC32 .text 0x18
+// CHECK-NEXT:       0x4E2 R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x4F8 R_X86_64_PC32 .text 0x19
+// CHECK-NEXT:       0x516 R_X86_64_64   foo   0x0
+// CHECK-NEXT:       0x52C R_X86_64_PC32 .text 0x1A
+// CHECK-NEXT:       0x54A R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x560 R_X86_64_PC32 .text 0x1B
+// CHECK-NEXT:       0x57E R_X86_64_PC16 foo   0x0
+// CHECK-NEXT:       0x590 R_X86_64_PC32 .text 0x1C
+// CHECK-NEXT:       0x5AE R_X86_64_PC32 foo   0x0
+// CHECK-NEXT:       0x5C0 R_X86_64_PC32 .text 0x1D
+// CHECK-NEXT:       0x5DE R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x5F4 R_X86_64_PC32 .text 0x1E
+// CHECK-NEXT:       0x612 R_X86_64_PC16 foo   0x0
+// CHECK-NEXT:       0x624 R_X86_64_PC32 .text 0x1F
+// CHECK-NEXT:       0x642 R_X86_64_PC32 foo   0x0
+// CHECK-NEXT:       0x654 R_X86_64_PC32 .text 0x20
+// CHECK-NEXT:       0x672 R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x688 R_X86_64_PC32 .text 0x21
+// CHECK-NEXT:       0x6A6 R_X86_64_PC64 foo   0x0
+// CHECK-NEXT:       0x6BC R_X86_64_PC32 .text 0x22
 // CHECK-NEXT:     ]
 // CHECK:        }
index 907bf424f4706431aa84b42636699924197b8d97..a702bc8610c80be55b9e08f4597a7b0f59fbd740 100644 (file)
@@ -15,11 +15,11 @@ foo:
     .size foo, .-foo
 
 // CHECK:      Relocations [
-// CHECK:        Section ({{[^ ]+}}) .debug_info {
+// CHECK:        Section ({{[^ ]+}}) .rel.debug_info {
 // CHECK-NEXT:     0x6 R_386_32 .debug_abbrev 0x0
 // CHECK-NEXT:     0xC R_386_32 .debug_line 0x0
 // CHECK:        }
-// CHECK-NEXT:   Section ({{[^ ]+}}) .debug_aranges {
+// CHECK-NEXT:   Section ({{[^ ]+}}) .rel.debug_aranges {
 // CHECK-NEXT:     0x6 R_386_32 .debug_info 0x0
 // CHECK-NEXT:     0x10 R_386_32 .text 0x0
 // CHECK-NEXT:   }
index 60dea6d3b172dff1f93d534cbd66e24d69a0cec3..30114b75d84daf60c22e127715283f2b8e408233 100644 (file)
@@ -7,7 +7,7 @@
         movl   foo@GOTPCREL(%rip), %eax
 
 // CHECK:      Relocations [
-// CHECK:        Section ({{[^ ]+}}) .text {
+// CHECK:        Section ({{[^ ]+}}) .rela.text {
 // CHECK-NEXT:       0x{{[^ ]+}} R_X86_64_GOT32 foo 0x{{[^ ]+}}
 // CHECK-NEXT:       0x{{[^ ]+}} R_X86_64_GOTPCREL foo 0x{{[^ ]+}}
 // CHECK-NEXT:   }
index 4241ba5af4101bcf62821d0a00157f8aadd43b6f..0c745197c81405b8060b6bc838da5104e65cb76d 100644 (file)
@@ -7,7 +7,7 @@
 foo:
 
 // CHECKT:     Relocations [
-// CHECK:        Section (1) .text {
+// CHECK:        Section (2) .rela.text {
 // CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32S .text 0x{{[^ ]+}}
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
index d34635a6710aac02fcac89b53b4c8752e60fb2fa..0e92583192d4fd2fed39ff813efc1579ad2d428e 100644 (file)
@@ -23,7 +23,7 @@ zed:
 foo:
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section (1) .text {
+// CHECK-NEXT:   Section (2) .rela.text {
 // CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_PC32    .Lfoo 0x{{[^ ]+}}
 // CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32      .sec1 0x{{[^ ]+}}
 // CHECK-NEXT:     0x{{[^ ]+}} R_X86_64_32      .Lfoo 0x{{[^ ]+}}
index 24d0172e724e47c9996d0c45fd929594746e74db..9bc831056ae30980269a15bd929dce9f5f7cffea 100644 (file)
@@ -4,7 +4,7 @@
 // correctly point to the section or the symbol.
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section (1) .text {
+// CHECK-NEXT:   Section (2) .rel.text {
 // CHECK-NEXT:     0x2          R_386_GOTOFF     .Lfoo 0x0
 // CHECK-NEXT:     0x{{[^ ]+}}  R_386_PLT32      bar2 0x0
 // CHECK-NEXT:     0x{{[^ ]+}}  R_386_GOTPC      _GLOBAL_OFFSET_TABLE_ 0x0
index 551f5ff378ef371ee8329ca711393557c9cc4a19..fc7420c39898c401df8a12a0abb9592ae81af398 100644 (file)
@@ -9,8 +9,6 @@
 // CHECK:          Index: 1
 // CHECK-NEXT:     Name: .text
 // CHECK:          Relocations [
-// CHECK-NEXT:       0x1 R_X86_64_PC8 - 0x0
-// CHECK-NEXT:       0x3 R_X86_64_PC32 - 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:   }
 
@@ -28,5 +26,7 @@
 // CHECK-NEXT:     AddressAlignment: 8
 // CHECK-NEXT:     EntrySize: 24
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:       0x1 R_X86_64_PC8 - 0x0
+// CHECK-NEXT:       0x3 R_X86_64_PC32 - 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:   }
index 19bcc18d8f881c66d28d42216e7fa388c3e9ec86..18d43dab7635e80f3185ce6ac3a286a661c814cf 100644 (file)
@@ -21,7 +21,7 @@ bar:
 
 
 // CHECK:        Section {
-// CHECK:          Name: .text
+// CHECK:          Name: .rela.text
 // CHECK:          Relocations [
 // CHECK-NEXT:       0x1 R_X86_64_32        .text
 // CHECK-NEXT:       0x8 R_X86_64_32S       .text
index c50910b41ec053f1979cea852de956d129be483e..5364dde9f4609190e12723b7e21ba008ec5c6f44 100644 (file)
@@ -32,10 +32,27 @@ defined3:
 // CHECK-NEXT:     AddressAlignment: 4
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     Relocations [
+// CHECK-NEXT:     ]
+// CHECK-NEXT:   }
+// CHECK-NEXT:   Section {
+// CHECK-NEXT:     Index: 2
+// CHECK-NEXT:     Name: .rela.text (1)
+// CHECK-NEXT:     Type: SHT_RELA (0x4)
+// CHECK-NEXT:     Flags [ (0x0)
+// CHECK-NEXT:     ]
+// CHECK-NEXT:     Address: 0x0
+// CHECK-NEXT:     Offset: 0x320
+// CHECK-NEXT:     Size: 24
+// CHECK-NEXT:     Link: 6
+// CHECK-NEXT:     Info: 1
+// CHECK-NEXT:     AddressAlignment: 8
+// CHECK-NEXT:     EntrySize: 24
+// CHECK-NEXT:     Relocations [
 // CHECK-NEXT:       0x0 R_X86_64_32 .text 0x0
 // CHECK-NEXT:     ]
 // CHECK-NEXT:   }
 
+
 // Symbol 2 is section 1
 // CHECK:        Symbol {
 // CHECK:          Name: .text (0)
index 9a71a81930ee1c24ecb75d87822c7d512785323d..c8015b96a3168f6cf72a472b98cefb0b46d28d1e 100644 (file)
@@ -22,7 +22,7 @@ defined3:
 global1:
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section (1) .text {
+// CHECK-NEXT:   Section (2) .rela.text {
 // CHECK-NEXT:     0x0 R_X86_64_32 .text 0x0
 // CHECK-NEXT:     0x4 R_X86_64_32 bar2@zed 0x0
 // CHECK-NEXT:     0x8 R_X86_64_32 .text 0x0
index 0f5bba2383d71ca4f056092fc667466429a8d30d..19153aa50daa3d0aa90c8fc9569db296f17e2062 100644 (file)
@@ -8,7 +8,7 @@ bar:
         call    foo
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{[0-9]+}}) .text {
+// CHECK-NEXT:   Section ({{[0-9]+}}) .rela.text {
 // CHECK-NEXT:     0x1 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
index bd67ee0f9de81104c366aa9b6bcd29129b2bbf49..10c13123e6507fe42d739e8ca4bce79e4a8a6331 100644 (file)
@@ -7,7 +7,7 @@ L: movq $(L + 2147483648),%rax
 
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{[0-9]+}}) .text {
+// CHECK-NEXT:   Section ({{[0-9]+}}) .rela.text {
 // CHECK-NEXT:     0x3 R_X86_64_32S {{[^ ]+}} 0x80000000
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
index 93ff0b8bd277559fd6ce21c977a55c9bc61d3938..167159885d72170ce2a4933ab59677969b7594e6 100644 (file)
@@ -19,7 +19,7 @@ func:
        .cfi_startproc
        .cfi_endproc
 
-// MIPS32: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS32: RELOCATION RECORDS FOR [.rel.eh_frame]:
 // MIPS32-NEXT: R_MIPS_32
 // MIPS32: Contents of section .eh_frame:
 // MIPS32-NEXT: 0000
@@ -55,7 +55,7 @@ func:
 // MIPS32: 0b
 // FIXME: The instructions are different from the ones produces by gas.
 
-// MIPS32EL: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS32EL: RELOCATION RECORDS FOR [.rel.eh_frame]:
 // MIPS32EL-NEXT: R_MIPS_32
 // MIPS32EL: Contents of section .eh_frame:
 // MIPS32EL-NEXT: 0000
@@ -91,7 +91,7 @@ func:
 // MIPS32EL: 0b
 // FIXME: The instructions are different from the ones produces by gas.
 
-// MIPS64: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS64: RELOCATION RECORDS FOR [.rela.eh_frame]:
 // MIPS64-NEXT: R_MIPS_64
 // MIPS64: Contents of section .eh_frame:
 // MIPS64-NEXT: 0000
@@ -129,7 +129,7 @@ func:
 // FIXME: The instructions are different from the ones produces by gas.
 
 
-// MIPS64EL: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS64EL: RELOCATION RECORDS FOR [.rela.eh_frame]:
 // MIPS64EL-NEXT: R_MIPS_64
 // MIPS64EL: Contents of section .eh_frame:
 // MIPS64EL-NEXT: 0000
index 47003fa1e75278b783588c46862ba83dc54c41eb..4057eb823a5ae98c4296e13460a36a1df8309005 100644 (file)
@@ -31,7 +31,7 @@ return:
 
 ; R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
 ; CHECK:      Relocations [
-; CHECK:        Section ({{[a-z0-9]+}}) .rodata {
+; CHECK:        Section ({{[a-z0-9]+}}) .rela.rodata {
 ; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
 ; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
 ; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
index 9f604e00a0a8f47afd1438f602cb6994ca7c3286..bcce3d515e7d3147cca333f67a57eec2e47bf207 100644 (file)
@@ -3,7 +3,7 @@
 ; Check that the appropriate relocations were created.
 
 ; CHECK: Relocations [
-; CHECK:   Section (1) .text {
+; CHECK:   Section (2) .rel.text {
 ; CHECK:     R_MIPS_TLS_LDM
 ; CHECK:     R_MIPS_TLS_DTPREL_HI16
 ; CHECK:     R_MIPS_TLS_DTPREL_LO16
index 23a77384ecd0968e1f06c4ec4660b89682c93845..490244d5afb91617c74261fba03d84fba29699d9 100644 (file)
@@ -24,7 +24,6 @@ entry:
 ; STATIC-NEXT:   AddressAlignment: 8
 ; STATIC-NEXT:   EntrySize: 
 ; STATIC-NEXT:   Relocations [
-; STATIC-NEXT:     0x1C R_PPC64_REL32 .text 0x0
 ; STATIC-NEXT:   ]
 ; STATIC-NEXT:   SectionData (
 ; STATIC-NEXT:     0000: 00000010 00000000 017A5200 01784101
@@ -45,7 +44,9 @@ entry:
 ; STATIC-NEXT:   Info:
 ; STATIC-NEXT:   AddressAlignment: 8
 ; STATIC-NEXT:   EntrySize: 24
-
+; STATIC-NEXT:   Relocations [
+; STATIC-NEXT:     0x1C R_PPC64_REL32 .text 0x0
+; STATIC-NEXT:   ]
 
 ; PIC:      Section {
 ; PIC:        Name: .eh_frame
@@ -61,7 +62,6 @@ entry:
 ; PIC-NEXT:   AddressAlignment: 8
 ; PIC-NEXT:   EntrySize: 0
 ; PIC-NEXT:   Relocations [
-; PIC-NEXT:     0x1C R_PPC64_REL32 .text 0x0
 ; PIC-NEXT:   ]
 ; PIC-NEXT:   SectionData (
 ; PIC-NEXT:     0000: 00000010 00000000 017A5200 01784101
@@ -82,3 +82,6 @@ entry:
 ; PIC-NEXT:   Info:
 ; PIC-NEXT:   AddressAlignment: 8
 ; PIC-NEXT:   EntrySize: 24
+; PIC-NEXT:   Relocations [
+; PIC-NEXT:     0x1C R_PPC64_REL32 .text 0x0
+; PIC-NEXT:   ]
index ac8d303dd4cfb6b7b1e35b34c489b8c59282741e..f4aa347e6c3b74f8cfa5c9d7b00e58f6e236b811 100644 (file)
@@ -27,7 +27,7 @@ entry:
 ;; The relocations in .rela.text are the 'number64' load using a
 ;; R_PPC64_TOC16_DS against the .toc and the 'sin' external function
 ;; address using a R_PPC64_REL24
-;; CHECK:        Section ({{[0-9]+}}) .text {
+;; CHECK:        Section ({{[0-9]+}}) .rela.text {
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TOC16_DS .toc
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_REL24    sin
 ;; CHECK-NEXT:   }
@@ -37,12 +37,12 @@ entry:
 ;    address itself);
 ;; 2. And a R_PPC64_TOC against no symbol (the linker will replace for the
 ;;    module's TOC base).
-;; CHECK:        Section ({{[0-9]+}}) .opd {
+;; CHECK:        Section ({{[0-9]+}}) .rela.opd {
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_ADDR64 .text 0x0
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TOC - 0x0
 
 ;; Finally the TOC creates the relocation for the 'number64'.
-;; CHECK:        Section ({{[0-9]+}}) .toc {
+;; CHECK:        Section ({{[0-9]+}}) .rela.toc {
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_ADDR64 number64 0x0
 ;; CHECK-NEXT:   }
 
index 4e901e816a681cdebea67bd2a1a09652e7121012..ae32fa7b89980b0d7ff5c4d0b010e40122387cdc 100644 (file)
@@ -13,7 +13,7 @@ entry:
 ;; Check for a pair of R_PPC64_TPREL16_HA / R_PPC64_TPREL16_LO relocs
 ;; against the thread-local symbol 't'.
 ;; CHECK:      Relocations [
-;; CHECK:        Section ({{[0-9]+}}) .text {
+;; CHECK:        Section ({{[0-9]+}}) .rela.text {
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TPREL16_HA t
 ;; CHECK-NEXT:     0x{{[0-9,A-F]+}} R_PPC64_TPREL16_LO t
 ;; CHECK-NEXT:   }
index 7625ec20af690f4a5d187424e4c95f3ad15bcf7f..1236035d9f6834b149b1dd67e84b1dab4b1f2266 100644 (file)
@@ -2,7 +2,15 @@ RUN: llvm-readobj -r -expand-relocs %p/Inputs/hello-world.elf-x86-64 \
 RUN:   | FileCheck %s
 
 // CHECK:     Relocations [
-// CHECK:       Section (11) .plt {
+// CHECK-NEXT:  Section (8) .rela.dyn {
+// CHECK-NEXT:    Relocation {
+// CHECK-NEXT:      Offset: 0x4018D8
+// CHECK-NEXT:      Type: R_X86_64_GLOB_DAT (6)
+// CHECK-NEXT:      Symbol: __gmon_start__
+// CHECK-NEXT:      Addend: 0x0
+// CHECK-NEXT:    }
+// CHECK-NEXT:  }
+// CHECK-NEXT:  Section (9) .rela.plt {
 // CHECK-NEXT:    Relocation {
 // CHECK-NEXT:      Offset: 0x4018F8
 // CHECK-NEXT:      Type: R_X86_64_JUMP_SLOT (7)
index dec7f862982c1b3943b686bc834535f312545074..3a87ff548e399de0c019ca72d6c9e3937ea29fa7 100644 (file)
@@ -22,7 +22,7 @@ COFF-NEXT:   }
 COFF-NEXT: ]
 
 ELF:      Relocations [
-ELF-NEXT:   Section (1) .text {
+ELF-NEXT:   Section (2) .rel.text {
 ELF-NEXT:     0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
 ELF-NEXT:     0x12 R_386_GOTOFF .L.str 0x0
 ELF-NEXT:     0x1A R_386_PLT32 puts 0x0
index 327f040854f9a9590ffbea6f765f17c7969b1339..e3a40c3eb1927d07ee492e0e5ff8424b0ba792a4 100644 (file)
@@ -108,10 +108,6 @@ ELF-NEXT:     Info: 0
 ELF-NEXT:     AddressAlignment: 16
 ELF-NEXT:     EntrySize: 0
 ELF-NEXT:     Relocations [
-ELF-NEXT:       0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
-ELF-NEXT:       0x12 R_386_GOTOFF .L.str 0x0
-ELF-NEXT:       0x1A R_386_PLT32 puts 0x0
-ELF-NEXT:       0x1F R_386_PLT32 SomeOtherFunction 0x0
 ELF-NEXT:     ]
 ELF-NEXT:     Symbols [
 ELF-NEXT:       Symbol {
@@ -139,6 +135,32 @@ ELF-NEXT:       0010: 8D830000 00008904 24E8FCFF FFFFE8FC  |........$.......|
 ELF-NEXT:       0020: FFFFFF31 C083C408 5BC3               |...1....[.|
 ELF-NEXT:     )
 ELF-NEXT:   }
+ELF-NEXT:   Section {
+ELF-NEXT:     Index: 2
+ELF-NEXT:     Name: .rel.text (1)
+ELF-NEXT:     Type: SHT_REL (0x9)
+ELF-NEXT:     Flags [ (0x0)
+ELF-NEXT:     ]
+ELF-NEXT:     Address: 0x0
+ELF-NEXT:     Offset: 0x360
+ELF-NEXT:     Size: 32
+ELF-NEXT:     Link: 8
+ELF-NEXT:     Info: 1
+ELF-NEXT:     AddressAlignment: 4
+ELF-NEXT:     EntrySize: 8
+ELF-NEXT:     Relocations [
+ELF-NEXT:       0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
+ELF-NEXT:       0x12 R_386_GOTOFF .L.str 0x0
+ELF-NEXT:       0x1A R_386_PLT32 puts 0x0
+ELF-NEXT:       0x1F R_386_PLT32 SomeOtherFunction 0x0
+ELF-NEXT:     ]
+ELF-NEXT:     Symbols [
+ELF-NEXT:     ]
+ELF-NEXT:     SectionData (
+ELF-NEXT:       0000: 0C000000 0A0A0000 12000000 09020000  |................|
+ELF-NEXT:       0010: 1A000000 040B0000 1F000000 04090000  |................|
+ELF-NEXT:     )
+ELF-NEXT:   }
 
 MACHO-I386:      Sections [
 MACHO-I386-NEXT:   Section {