1 //===--------- lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp --------------===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 #include "ARMExecutableWriter.h"
12 #include "ARMTargetHandler.h"
13 #include "ARMLinkingContext.h"
18 ARMTargetHandler::ARMTargetHandler(ARMLinkingContext &context)
19 : _context(context), _armTargetLayout(
20 new ARMTargetLayout<ARMELFType>(context)),
21 _armRelocationHandler(new ARMTargetRelocationHandler(
22 *_armTargetLayout.get())) {}
24 void ARMTargetHandler::registerRelocationNames(Registry ®istry) {
25 registry.addKindTable(Reference::KindNamespace::ELF, Reference::KindArch::ARM,
29 std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
30 switch (this->_context.getOutputELFType()) {
31 case llvm::ELF::ET_EXEC:
32 return std::unique_ptr<Writer>(
33 new ARMExecutableWriter<ARMELFType>(_context, *_armTargetLayout.get()));
35 llvm_unreachable("unsupported output type");
39 #define ELF_RELOC(name, value) LLD_KIND_STRING_ENTRY(name),
41 const Registry::KindStrings ARMTargetHandler::kindStrings[] = {
42 #include "llvm/Support/ELFRelocs/ARM.def"