1//===- MipsSectLinker.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
10#include <llvm/ADT/Triple.h>
11#include <mcld/Support/TargetRegistry.h>
12#include "Mips.h"
13#include "MipsELFSectLinker.h"
14
15using namespace mcld;
16
17namespace mcld {
18//===----------------------------------------------------------------------===//
19/// createMipsSectLinker - the help funtion to create
20/// corresponding MipsSectLinker
21///
22SectLinker* createMipsSectLinker(const std::string &pTriple,
23                                 SectLinkerOption &pOption,
24                                 mcld::TargetLDBackend &pLDBackend)
25{
26  llvm::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  return new MipsELFSectLinker(pOption, pLDBackend);
37}
38
39} // namespace of mcld
40
41//==========================
42// MipsSectLinker
43extern "C" void LLVMInitializeMipsSectLinker() {
44  // Register the linker frontend
45  mcld::TargetRegistry::RegisterSectLinker(TheMipselTarget,
46                                           createMipsSectLinker);
47}
48