summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Writer.cpp')
-rw-r--r--lld/lib/ReaderWriter/ELF/Writer.cpp48
1 files changed, 2 insertions, 46 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Writer.cpp b/lld/lib/ReaderWriter/ELF/Writer.cpp
index 43a6194ee35..94fa1b916ab 100644
--- a/lld/lib/ReaderWriter/ELF/Writer.cpp
+++ b/lld/lib/ReaderWriter/ELF/Writer.cpp
@@ -17,52 +17,8 @@ using namespace llvm;
using namespace llvm::object;
namespace lld {
-std::unique_ptr<Writer> createWriterELF(const ELFLinkingContext &info) {
- using llvm::object::ELFType;
- // Set the default layout to be the static executable layout
- // We would set the layout to a dynamic executable layout
- // if we came across any shared libraries in the process
-
- switch (info.getOutputELFType()) {
- case llvm::ELF::ET_EXEC:
- if (info.is64Bits()) {
- if (info.isLittleEndian())
- return std::unique_ptr<Writer>(new
- elf::ExecutableWriter<ELFType<support::little, 8, true>>(info));
- else
- return std::unique_ptr<Writer>(new
- elf::ExecutableWriter<ELFType<support::big, 8, true>>(info));
- } else {
- if (info.isLittleEndian())
- return std::unique_ptr<Writer>(new
- elf::ExecutableWriter<ELFType<support::little, 4, false>>(info));
- else
- return std::unique_ptr<Writer>(new
- elf::ExecutableWriter<ELFType<support::big, 4, false>>(info));
- }
- break;
- case llvm::ELF::ET_DYN:
- if (info.is64Bits()) {
- if (info.isLittleEndian())
- return std::unique_ptr<Writer>(new
- elf::DynamicLibraryWriter<ELFType<support::little, 8, true>>(info));
- else
- return std::unique_ptr<Writer>(new
- elf::DynamicLibraryWriter<ELFType<support::big, 8, true>>(info));
- } else {
- if (info.isLittleEndian())
- return std::unique_ptr<Writer>(new
- elf::DynamicLibraryWriter<ELFType<support::little, 4, false>>(info));
- else
- return std::unique_ptr<Writer>(new
- elf::DynamicLibraryWriter<ELFType<support::big, 4, false>>(info));
- }
- break;
- case llvm::ELF::ET_REL:
- llvm_unreachable("TODO: support -r mode");
- default:
- llvm_unreachable("unsupported output type");
- }
+std::unique_ptr<Writer> createWriterELF(TargetHandlerBase *handler) {
+ return std::move(handler->getWriter());
}
} // namespace lld
OpenPOWER on IntegriCloud