[lld] r192369 - [ELF] Initial design to handle Linker scripts for ELF.

Shankar Easwaran shankare at codeaurora.org
Thu Oct 10 10:27:50 PDT 2013


Author: shankare
Date: Thu Oct 10 12:27:49 2013
New Revision: 192369

URL: http://llvm.org/viewvc/llvm-project?rev=192369&view=rev
Log:
[ELF] Initial design to handle Linker scripts for ELF.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
    lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
    lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h

Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=192369&r1=192368&r2=192369&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Thu Oct 10 12:27:49 2013
@@ -298,7 +298,7 @@ protected:
       DefinedAtom::ContentPermissions contentPermissions,
       SectionOrder sectionOrder);
 
-private:
+protected:
   llvm::BumpPtrAllocator _allocator;
   SectionMapT _sectionMap;
   MergedSectionMapT _mergedSectionMap;
@@ -315,6 +315,16 @@ private:
   const ELFLinkingContext &_context;
 };
 
+/// \brief Handle linker scripts. TargetLayouts would derive
+/// from this class to override some of the functionalities.
+template<class ELFT>
+class ScriptLayout: public DefaultLayout<ELFT> {
+public:
+  ScriptLayout(const ELFLinkingContext &context)
+    : DefaultLayout<ELFT>(context)
+  {}
+};
+
 template <class ELFT>
 Layout::SectionOrder DefaultLayout<ELFT>::getSectionOrder(
     StringRef name, int32_t contentType, int32_t contentPermissions) {

Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h?rev=192369&r1=192368&r2=192369&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Thu Oct 10 12:27:49 2013
@@ -32,6 +32,7 @@ namespace lld {
 namespace elf {
 
 template <typename ELFT> class DefaultLayout;
+template <typename ELFT> class ScriptLayout;
 
 /// \brief A segment can be divided into segment slices
 ///        depending on how the segments can be split

Modified: lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h?rev=192369&r1=192368&r2=192369&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h Thu Oct 10 12:27:49 2013
@@ -19,10 +19,10 @@ namespace elf {
 /// \brief The target can override certain functions in the DefaultLayout
 /// class so that the order, the name of the section and the segment type could
 /// be changed in the final layout
-template <class ELFT> class TargetLayout : public DefaultLayout<ELFT> {
+template <class ELFT> class TargetLayout : public ScriptLayout<ELFT> {
 public:
   TargetLayout(const ELFLinkingContext &context)
-      : DefaultLayout<ELFT>(context) {}
+      : ScriptLayout<ELFT>(context) {}
 };
 } // end namespace elf
 } // end namespace lld





More information about the llvm-commits mailing list