[lld] r173968 - [ELF] Fix circular initialization bug.

Michael J. Spencer bigcheesegs at gmail.com
Wed Jan 30 12:36:56 PST 2013


Author: mspencer
Date: Wed Jan 30 14:36:56 2013
New Revision: 173968

URL: http://llvm.org/viewvc/llvm-project?rev=173968&view=rev
Log:
[ELF] Fix circular initialization bug.

Modified:
    lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h
    lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h

Modified: lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h?rev=173968&r1=173967&r2=173968&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFTargetInfo.h Wed Jan 30 14:36:56 2013
@@ -48,6 +48,7 @@ public:
 
   template <typename ELFT>
   lld::elf::TargetHandler<ELFT> &getTargetHandler() const {
+    assert(_targetHandler && "Got null TargetHandler!");
     return static_cast<lld::elf::TargetHandler<ELFT> &>(*_targetHandler.get());
   }
 

Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=173968&r1=173967&r2=173968&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Wed Jan 30 14:36:56 2013
@@ -142,7 +142,7 @@ public:
   typedef typename std::vector<AtomLayout *>::iterator AbsoluteAtomIterT;
 
   DefaultLayout(const ELFTargetInfo &ti)
-      : _targetInfo(ti), _targetHandler(ti.getTargetHandler<ELFT>()) {
+      : _targetInfo(ti) {
   }
 
   /// \brief Return the section order for a input section
@@ -258,7 +258,6 @@ private:
   std::vector<AtomLayout *> _absoluteAtoms;
   llvm::BumpPtrAllocator _allocator;
   const ELFTargetInfo &_targetInfo;
-  TargetHandler<ELFT> &_targetHandler;
 };
 
 template <class ELFT>





More information about the llvm-commits mailing list