diff options
| author | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 01:21:02 +0000 |
|---|---|---|
| committer | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 01:21:02 +0000 |
| commit | b11964707ca24b4bfc4c39f3c6c42ef9c2ef800b (patch) | |
| tree | 84862e61f7c57f4025951ca97e65a6eb0ab73e8c /lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp | |
| parent | af7fbd8cf426f74239bd6d30b52beda7524f46c1 (diff) | |
| download | bcm5719-llvm-b11964707ca24b4bfc4c39f3c6c42ef9c2ef800b.tar.gz bcm5719-llvm-b11964707ca24b4bfc4c39f3c6c42ef9c2ef800b.zip | |
[ELF] Make changes to all the targets supported currently
X86_64,X86,PPC,Hexagon,Mips
No change in functionality.
llvm-svn: 200177
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp index 6edd214f0c5..a7481a871d0 100644 --- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp +++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include "HexagonExecutableWriter.h" +#include "HexagonDynamicLibraryWriter.h" #include "HexagonTargetHandler.h" #include "HexagonLinkingContext.h" @@ -17,11 +19,28 @@ using namespace llvm::ELF; using llvm::makeArrayRef; HexagonTargetHandler::HexagonTargetHandler(HexagonLinkingContext &context) - : DefaultTargetHandler(context), _targetLayout(context), - _relocationHandler(context, *this, _targetLayout), - _hexagonRuntimeFile(new HexagonRuntimeFile<HexagonELFType>(context)) {} - -namespace { + : DefaultTargetHandler(context), _hexagonLinkingContext(context), + _hexagonRuntimeFile(new HexagonRuntimeFile<HexagonELFType>(context)), + _hexagonTargetLayout(new HexagonTargetLayout<HexagonELFType>(context)), + _hexagonRelocationHandler(new HexagonTargetRelocationHandler( + context, *_hexagonTargetLayout.get())) {} + +std::unique_ptr<Writer> HexagonTargetHandler::getWriter() { + switch (_hexagonLinkingContext.getOutputELFType()) { + case llvm::ELF::ET_EXEC: + return std::unique_ptr<Writer>( + new elf::HexagonExecutableWriter<HexagonELFType>( + _hexagonLinkingContext, *_hexagonTargetLayout.get())); + case llvm::ELF::ET_DYN: + return std::unique_ptr<Writer>( + new elf::HexagonDynamicLibraryWriter<HexagonELFType>( + _hexagonLinkingContext, *_hexagonTargetLayout.get())); + case llvm::ELF::ET_REL: + llvm_unreachable("TODO: support -r mode"); + default: + llvm_unreachable("unsupported output type"); + } +} using namespace llvm::ELF; @@ -297,7 +316,6 @@ public: return error_code::success(); } }; -} // end anonymous namespace void elf::HexagonLinkingContext::addPasses(PassManager &pm) { if (isDynamic()) |

