forked from OSchip/llvm-project
[ARM] Add skeleton implementation of DSO linking
llvm-svn: 237881
This commit is contained in:
parent
39036ac31d
commit
2db1a03b07
|
@ -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
|
|
@ -961,6 +961,8 @@ lld::elf::createARMRelocationPass(const ARMLinkingContext &ctx) {
|
||||||
if (ctx.isDynamic())
|
if (ctx.isDynamic())
|
||||||
return llvm::make_unique<ARMDynamicRelocationPass>(ctx);
|
return llvm::make_unique<ARMDynamicRelocationPass>(ctx);
|
||||||
return llvm::make_unique<ARMStaticRelocationPass>(ctx);
|
return llvm::make_unique<ARMStaticRelocationPass>(ctx);
|
||||||
|
case llvm::ELF::ET_DYN:
|
||||||
|
return llvm::make_unique<ARMDynamicRelocationPass>(ctx);
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unhandled output file type");
|
llvm_unreachable("Unhandled output file type");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "Atoms.h"
|
#include "Atoms.h"
|
||||||
#include "ARMExecutableWriter.h"
|
#include "ARMExecutableWriter.h"
|
||||||
|
#include "ARMDynamicLibraryWriter.h"
|
||||||
#include "ARMTargetHandler.h"
|
#include "ARMTargetHandler.h"
|
||||||
#include "ARMLinkingContext.h"
|
#include "ARMLinkingContext.h"
|
||||||
|
|
||||||
|
@ -23,6 +24,8 @@ std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
|
||||||
switch (this->_ctx.getOutputELFType()) {
|
switch (this->_ctx.getOutputELFType()) {
|
||||||
case llvm::ELF::ET_EXEC:
|
case llvm::ELF::ET_EXEC:
|
||||||
return llvm::make_unique<ARMExecutableWriter>(_ctx, *_targetLayout);
|
return llvm::make_unique<ARMExecutableWriter>(_ctx, *_targetLayout);
|
||||||
|
case llvm::ELF::ET_DYN:
|
||||||
|
return llvm::make_unique<ARMDynamicLibraryWriter>(_ctx, *_targetLayout);
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("unsupported output type");
|
llvm_unreachable("unsupported output type");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue