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