[lld] r177483 - [ELF] Interp section is only needed in dynamic executables

Michael Spencer bigcheesegs at gmail.com
Wed Mar 20 11:32:08 PDT 2013


On Tue, Mar 19, 2013 at 10:06 PM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> Author: shankare
> Date: Wed Mar 20 00:06:40 2013
> New Revision: 177483
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177483&view=rev
> Log:
> [ELF] Interp section is only needed in dynamic executables
>
> Modified:
>     lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=177483&r1=177482&r2=177483&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h Wed Mar 20 00:06:40
> 2013
> @@ -31,9 +31,10 @@ public:
>
>  private:
>    virtual void addDefaultAtoms();
> -  virtual void addFiles(InputFiles&);
> +  virtual void addFiles(InputFiles &);
>    virtual void finalizeDefaultAtomValues();
> -
> +  virtual void createDefaultSections();
> +  LLD_UNIQUE_BUMP_PTR(InterpSection<ELFT>) _interpSection;
>    CRuntimeFile<ELFT> _runtimeFile;
>  };
>
> @@ -69,10 +70,19 @@ void ExecutableWriter<ELFT>::addFiles(In
>    this->_targetHandler.addFiles(inputFiles);
>  }
>
> +template <class ELFT> void
> ExecutableWriter<ELFT>::createDefaultSections() {
> +  OutputELFWriter<ELFT>::createDefaultSections();
> +  if (this->_targetInfo.isDynamic()) {
> +    _interpSection.reset(new (this->_alloc) InterpSection<ELFT>(
> +        this->_targetInfo, ".interp", DefaultLayout<ELFT>::ORDER_INTERP,
> +        this->_targetInfo.getInterpreter()));
> +    this->_layout->addSection(_interpSection.get());
> +  }
> +}
> +
>  /// Finalize the value of all the absolute symbols that we
>  /// created
> -template<class ELFT>
> -void ExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
> +template <class ELFT> void
> ExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
>    auto bssStartAtomIter = this->_layout->findAbsoluteAtom("__bss_start");
>    auto bssEndAtomIter = this->_layout->findAbsoluteAtom("__bss_end");
>    auto underScoreEndAtomIter = this->_layout->findAbsoluteAtom("_end");
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=177483&r1=177482&r2=177483&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Wed Mar 20 00:06:40
> 2013
> @@ -109,7 +109,6 @@ protected:
>    LLD_UNIQUE_BUMP_PTR(DynamicTable<ELFT>) _dynamicTable;
>    LLD_UNIQUE_BUMP_PTR(DynamicSymbolTable<ELFT>) _dynamicSymbolTable;
>    LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _dynamicStringTable;
> -  LLD_UNIQUE_BUMP_PTR(InterpSection<ELFT>) _interpSection;
>    LLD_UNIQUE_BUMP_PTR(HashSection<ELFT>) _hashTable;
>    llvm::StringSet<> _soNeeded;
>    /// @}
> @@ -226,15 +225,11 @@ void OutputELFWriter<ELFT>::createDefaul
>          true));
>      _dynamicSymbolTable.reset(new (_alloc) DynamicSymbolTable<ELFT>(
>          _targetInfo, ".dynsym",
> DefaultLayout<ELFT>::ORDER_DYNAMIC_SYMBOLS));
> -    _interpSection.reset(new (_alloc) InterpSection<ELFT>(
> -        _targetInfo, ".interp", DefaultLayout<ELFT>::ORDER_INTERP,
> -        _targetInfo.getInterpreter()));
>      _hashTable.reset(new (_alloc) HashSection<ELFT>(
>          _targetInfo, ".hash", DefaultLayout<ELFT>::ORDER_HASH));
>      _layout->addSection(_dynamicTable.get());
>      _layout->addSection(_dynamicStringTable.get());
>      _layout->addSection(_dynamicSymbolTable.get());
> -    _layout->addSection(_interpSection.get());
>      _layout->addSection(_hashTable.get());
>      _dynamicSymbolTable->setStringSection(_dynamicStringTable.get());
>      if (_layout->hasDynamicRelocationTable())
>

Test?

- Michael Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130320/292f99b6/attachment.html>


More information about the llvm-commits mailing list