HexagonMCLinker.cpp revision 6f75755c9204b1d8817ae5a65a2f7e5af0ec3f70
1//===- HexagonMCLinker.cpp ------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#include "Hexagon.h"
10#include "HexagonELFMCLinker.h"
11#include <mcld/Module.h>
12#include <mcld/Support/TargetRegistry.h>
13#include <llvm/ADT/Triple.h>
14
15using namespace mcld;
16
17namespace mcld {
18
19/// createHexagonMCLinker - the help funtion to create corresponding
20/// HexagonMCLinker
21MCLinker* createHexagonMCLinker(const std::string &pTriple,
22                                LinkerConfig& pConfig,
23                                mcld::Module& pModule,
24                                MemoryArea& pOutput)
25{
26  Triple theTriple(pTriple);
27  if (theTriple.isOSDarwin()) {
28    assert(0 && "MachO linker has not supported yet");
29    return NULL;
30  }
31  if (theTriple.isOSWindows()) {
32    assert(0 && "COFF linker has not supported yet");
33    return NULL;
34  }
35
36  if (theTriple.isArch32Bit())
37    return new HexagonELFMCLinker(pConfig, pModule, pOutput);
38
39  assert(0 && "Hexagon_64 has not supported yet");
40  return NULL;
41}
42
43} // namespace of mcld
44
45//===----------------------------------------------------------------------===//
46// HexagonMCLinker
47//===----------------------------------------------------------------------===//
48extern "C" void MCLDInitializeHexagonMCLinker() {
49  // Register the linker frontend
50  mcld::TargetRegistry::RegisterMCLinker(TheHexagonTarget,
51                                         createHexagonMCLinker);
52}
53
54