diff options
| author | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 01:02:03 +0000 |
|---|---|---|
| committer | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 01:02:03 +0000 |
| commit | e7b831ad354c74ef9fb12b8501e4c5de676a2bc6 (patch) | |
| tree | dd5307b45131ff4c4f907f7ec3417f80208e6ee6 /lld/lib/ReaderWriter/ELF/Reader.cpp | |
| parent | 51577b66ce478fafc3cbd7614255742ceff65237 (diff) | |
| download | bcm5719-llvm-e7b831ad354c74ef9fb12b8501e4c5de676a2bc6.tar.gz bcm5719-llvm-e7b831ad354c74ef9fb12b8501e4c5de676a2bc6.zip | |
[ELF] Add Target specific Readers.
No change in functionality.
llvm-svn: 200175
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Reader.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Reader.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Reader.cpp b/lld/lib/ReaderWriter/ELF/Reader.cpp index 17bc546459b..96eb4b05d36 100644 --- a/lld/lib/ReaderWriter/ELF/Reader.cpp +++ b/lld/lib/ReaderWriter/ELF/Reader.cpp @@ -39,16 +39,14 @@ struct ELFFileCreateELFTraits { template <class ELFT> static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb, - bool atomizeStrings, TargetHandlerBase *handler) { - return lld::elf::ELFFile<ELFT>::create(std::move(mb), atomizeStrings, - handler); + bool atomizeStrings) { + return lld::elf::ELFFile<ELFT>::create(std::move(mb), atomizeStrings); } }; class ELFObjectReader : public Reader { public: - ELFObjectReader(bool atomizeStrings, TargetHandlerBase *handler) - : _atomizeStrings(atomizeStrings), _handler(handler) {} + ELFObjectReader(bool atomizeStrings) : _atomizeStrings(atomizeStrings) {} virtual bool canParse(file_magic magic, StringRef, const MemoryBuffer &) const { @@ -61,9 +59,8 @@ public: error_code ec; std::size_t maxAlignment = 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart())); - auto f = createELF<ELFFileCreateELFTraits>(getElfArchType(&*mb), - maxAlignment, std::move(mb), - _atomizeStrings, _handler); + auto f = createELF<ELFFileCreateELFTraits>( + getElfArchType(&*mb), maxAlignment, std::move(mb), _atomizeStrings); if (error_code ec = f.getError()) return ec; result.push_back(std::move(*f)); @@ -72,7 +69,6 @@ public: private: bool _atomizeStrings; - TargetHandlerBase *_handler; }; class ELFDSOReader : public Reader { @@ -111,15 +107,16 @@ void Registry::addSupportELFObjects(bool atomizeStrings, TargetHandlerBase *handler) { // Tell registry about the ELF object file parser. - add(std::unique_ptr<Reader>( - new elf::ELFObjectReader(atomizeStrings, handler))); + add(std::move(handler->getObjReader(atomizeStrings))); // Tell registry about the relocation name to number mapping for this arch. handler->registerRelocationNames(*this); } -void Registry::addSupportELFDynamicSharedObjects(bool useShlibUndefines) { - add(std::unique_ptr<Reader>(new elf::ELFDSOReader(useShlibUndefines))); +void Registry::addSupportELFDynamicSharedObjects(bool useShlibUndefines, + TargetHandlerBase *handler) { + // Tell registry about the ELF dynamic shared library file parser. + add(handler->getDSOReader(useShlibUndefines)); } } // end namespace lld |

