1//===- MipsMCLinker.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 "MipsELFMCLinker.h"
10
11#include "Mips.h"
12#include <llvm/ADT/Triple.h>
13#include <mcld/Module.h>
14#include <mcld/Support/TargetRegistry.h>
15
16using namespace mcld;
17
18namespace mcld {
19//===----------------------------------------------------------------------===//
20/// createMipsMCLinker - the help funtion to create
21//===----------------------------------------------------------------------===//
22/// corresponding MipsMCLinker
23///
24MCLinker* createMipsMCLinker(const std::string &pTriple,
25                             LinkerConfig& pConfig,
26                             mcld::Module& pModule,
27                             MemoryArea& pOutput)
28{
29  llvm::Triple theTriple(pTriple);
30  if (theTriple.isOSDarwin()) {
31    assert(0 && "MachO linker has not supported yet");
32    return NULL;
33  }
34  if (theTriple.isOSWindows()) {
35    assert(0 && "COFF linker has not supported yet");
36    return NULL;
37  }
38
39  return new MipsELFMCLinker(pConfig, pModule, pOutput);
40}
41
42} // namespace of mcld
43
44//===----------------------------------------------------------------------===//
45// MipsMCLinker
46//===----------------------------------------------------------------------===//
47extern "C" void MCLDInitializeMipsMCLinker() {
48  // Register the linker frontend
49  mcld::TargetRegistry::RegisterMCLinker(TheMipselTarget, createMipsMCLinker);
50}
51