summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2013-10-10 17:27:49 +0000
committerShankar Easwaran <shankare@codeaurora.org>2013-10-10 17:27:49 +0000
commit26594caec4bf6441e82479b45cfe0428a6706da8 (patch)
tree55a6898a293b5def25f90ace5024f364ca5a2969
parent5d859e05f2143be057d9acd525ee5f6f0411f312 (diff)
downloadbcm5719-llvm-26594caec4bf6441e82479b45cfe0428a6706da8.tar.gz
bcm5719-llvm-26594caec4bf6441e82479b45cfe0428a6706da8.zip
[ELF] Initial design to handle Linker scripts for ELF.
llvm-svn: 192369
-rw-r--r--lld/lib/ReaderWriter/ELF/DefaultLayout.h12
-rw-r--r--lld/lib/ReaderWriter/ELF/SegmentChunks.h1
-rw-r--r--lld/lib/ReaderWriter/ELF/TargetLayout.h4
3 files changed, 14 insertions, 3 deletions
diff --git a/lld/lib/ReaderWriter/ELF/DefaultLayout.h b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
index 9d14bcd8b44..e0258e47eaf 100644
--- a/lld/lib/ReaderWriter/ELF/DefaultLayout.h
+++ b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
@@ -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) {
diff --git a/lld/lib/ReaderWriter/ELF/SegmentChunks.h b/lld/lib/ReaderWriter/ELF/SegmentChunks.h
index a93b811f06a..ef1de72c457 100644
--- a/lld/lib/ReaderWriter/ELF/SegmentChunks.h
+++ b/lld/lib/ReaderWriter/ELF/SegmentChunks.h
@@ -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
diff --git a/lld/lib/ReaderWriter/ELF/TargetLayout.h b/lld/lib/ReaderWriter/ELF/TargetLayout.h
index fb94ac7e0a5..60e0df4d6f1 100644
--- a/lld/lib/ReaderWriter/ELF/TargetLayout.h
+++ b/lld/lib/ReaderWriter/ELF/TargetLayout.h
@@ -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
OpenPOWER on IntegriCloud