[ARM] Add skeleton implementation of DSO linking

llvm-svn: 237881
This commit is contained in:
Denis Protivensky 2015-05-21 09:28:25 +00:00
parent 39036ac31d
commit 2db1a03b07
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,44 @@
//===- lib/ReaderWriter/ELF/ARM/ARMDynamicLibraryWriter.h -----------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H
#define LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H
#include "DynamicLibraryWriter.h"
#include "ARMLinkingContext.h"
#include "ARMTargetHandler.h"
namespace lld {
namespace elf {
class ARMDynamicLibraryWriter : public DynamicLibraryWriter<ELF32LE> {
public:
ARMDynamicLibraryWriter(ARMLinkingContext &ctx, ARMTargetLayout &layout);
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
private:
ARMLinkingContext &_ctx;
ARMTargetLayout &_armLayout;
};
ARMDynamicLibraryWriter::ARMDynamicLibraryWriter(ARMLinkingContext &ctx,
ARMTargetLayout &layout)
: DynamicLibraryWriter(ctx, layout), _ctx(ctx), _armLayout(layout) {}
void ARMDynamicLibraryWriter::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter::createImplicitFiles(result);
}
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ELF_ARM_ARM_DYNAMIC_LIBRARY_WRITER_H

View File

@ -961,6 +961,8 @@ lld::elf::createARMRelocationPass(const ARMLinkingContext &ctx) {
if (ctx.isDynamic())
return llvm::make_unique<ARMDynamicRelocationPass>(ctx);
return llvm::make_unique<ARMStaticRelocationPass>(ctx);
case llvm::ELF::ET_DYN:
return llvm::make_unique<ARMDynamicRelocationPass>(ctx);
default:
llvm_unreachable("Unhandled output file type");
}

View File

@ -9,6 +9,7 @@
#include "Atoms.h"
#include "ARMExecutableWriter.h"
#include "ARMDynamicLibraryWriter.h"
#include "ARMTargetHandler.h"
#include "ARMLinkingContext.h"
@ -23,6 +24,8 @@ std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
switch (this->_ctx.getOutputELFType()) {
case llvm::ELF::ET_EXEC:
return llvm::make_unique<ARMExecutableWriter>(_ctx, *_targetLayout);
case llvm::ELF::ET_DYN:
return llvm::make_unique<ARMDynamicLibraryWriter>(_ctx, *_targetLayout);
default:
llvm_unreachable("unsupported output type");
}