<div dir="ltr">On Tue, Mar 19, 2013 at 10:06 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: shankare<br>
Date: Wed Mar 20 00:06:40 2013<br>
New Revision: 177483<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=177483&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=177483&view=rev</a><br>
Log:<br>
[ELF] Interp section is only needed in dynamic executables<br>
<br>
Modified:<br>
    lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h<br>
    lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=177483&r1=177482&r2=177483&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=177483&r1=177482&r2=177483&view=diff</a><br>

==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h Wed Mar 20 00:06:40 2013<br>
@@ -31,9 +31,10 @@ public:<br>
<br>
 private:<br>
   virtual void addDefaultAtoms();<br>
-  virtual void addFiles(InputFiles&);<br>
+  virtual void addFiles(InputFiles &);<br>
   virtual void finalizeDefaultAtomValues();<br>
-<br>
+  virtual void createDefaultSections();<br>
+  LLD_UNIQUE_BUMP_PTR(InterpSection<ELFT>) _interpSection;<br>
   CRuntimeFile<ELFT> _runtimeFile;<br>
 };<br>
<br>
@@ -69,10 +70,19 @@ void ExecutableWriter<ELFT>::addFiles(In<br>
   this->_targetHandler.addFiles(inputFiles);<br>
 }<br>
<br>
+template <class ELFT> void ExecutableWriter<ELFT>::createDefaultSections() {<br>
+  OutputELFWriter<ELFT>::createDefaultSections();<br>
+  if (this->_targetInfo.isDynamic()) {<br>
+    _interpSection.reset(new (this->_alloc) InterpSection<ELFT>(<br>
+        this->_targetInfo, ".interp", DefaultLayout<ELFT>::ORDER_INTERP,<br>
+        this->_targetInfo.getInterpreter()));<br>
+    this->_layout->addSection(_interpSection.get());<br>
+  }<br>
+}<br>
+<br>
 /// Finalize the value of all the absolute symbols that we<br>
 /// created<br>
-template<class ELFT><br>
-void ExecutableWriter<ELFT>::finalizeDefaultAtomValues() {<br>
+template <class ELFT> void ExecutableWriter<ELFT>::finalizeDefaultAtomValues() {<br>
   auto bssStartAtomIter = this->_layout->findAbsoluteAtom("__bss_start");<br>
   auto bssEndAtomIter = this->_layout->findAbsoluteAtom("__bss_end");<br>
   auto underScoreEndAtomIter = this->_layout->findAbsoluteAtom("_end");<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=177483&r1=177482&r2=177483&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=177483&r1=177482&r2=177483&view=diff</a><br>

==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Wed Mar 20 00:06:40 2013<br>
@@ -109,7 +109,6 @@ protected:<br>
   LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) _dynamicTable;<br>
   LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>) _dynamicSymbolTable;<br>
   LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _dynamicStringTable;<br>
-  LLD_UNIQUE_BUMP_PTR(InterpSection<ELFT>) _interpSection;<br>
   LLD_UNIQUE_BUMP_PTR(HashSection<ELFT>) _hashTable;<br>
   llvm::StringSet<> _soNeeded;<br>
   /// @}<br>
@@ -226,15 +225,11 @@ void OutputELFWriter<ELFT>::createDefaul<br>
         true));<br>
     _dynamicSymbolTable.reset(new (_alloc) DynamicSymbolTable<ELFT>(<br>
         _targetInfo, ".dynsym", DefaultLayout<ELFT>::ORDER_DYNAMIC_SYMBOLS));<br>
-    _interpSection.reset(new (_alloc) InterpSection<ELFT>(<br>
-        _targetInfo, ".interp", DefaultLayout<ELFT>::ORDER_INTERP,<br>
-        _targetInfo.getInterpreter()));<br>
     _hashTable.reset(new (_alloc) HashSection<ELFT>(<br>
         _targetInfo, ".hash", DefaultLayout<ELFT>::ORDER_HASH));<br>
     _layout->addSection(_dynamicTable.get());<br>
     _layout->addSection(_dynamicStringTable.get());<br>
     _layout->addSection(_dynamicSymbolTable.get());<br>
-    _layout->addSection(_interpSection.get());<br>
     _layout->addSection(_hashTable.get());<br>
     _dynamicSymbolTable->setStringSection(_dynamicStringTable.get());<br>
     if (_layout->hasDynamicRelocationTable())<br></blockquote><div><br></div><div>Test?</div><div><br></div><div>- Michael Spencer<br></div><div>  </div></div></div></div>