summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
blob: 1cbbf8cf8c95dbe423ecb6f328ff2826d78938ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//===--------- lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp --------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "Atoms.h"
#include "ARMExecutableWriter.h"
#include "ARMTargetHandler.h"
#include "ARMLinkingContext.h"

using namespace lld;
using namespace elf;

ARMTargetHandler::ARMTargetHandler(ARMLinkingContext &ctx)
    : _ctx(ctx), _targetLayout(new ARMTargetLayout<ELF32LE>(ctx)),
      _relocationHandler(new ARMTargetRelocationHandler(*_targetLayout)) {}

std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
  switch (this->_ctx.getOutputELFType()) {
  case llvm::ELF::ET_EXEC:
    return llvm::make_unique<ARMExecutableWriter<ELF32LE>>(_ctx,
                                                           *_targetLayout);
  default:
    llvm_unreachable("unsupported output type");
  }
}
OpenPOWER on IntegriCloud