Home | History | Annotate | Download | only in Mips
      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 "MipsAndroidSectLinker.h"
     14 
     15 using namespace mcld;
     16 
     17 namespace mcld {
     18 //===----------------------------------------------------------------------===//
     19 /// createMipsSectLinker - the help funtion to create
     20 /// corresponding MipsSectLinker
     21 ///
     22 SectLinker* 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   }
     30   if (theTriple.isOSWindows()) {
     31     assert(0 && "COFF linker has not supported yet");
     32   }
     33 
     34   // For now, use Android SectLinker directly
     35   return new MipsAndroidSectLinker(pOption,
     36                                    pLDBackend);
     37 }
     38 
     39 } // namespace of mcld
     40 
     41 //==========================
     42 // MipsSectLinker
     43 extern "C" void LLVMInitializeMipsSectLinker() {
     44   // Register the linker frontend
     45   mcld::TargetRegistry::RegisterSectLinker(TheMipselTarget,
     46                                            createMipsSectLinker);
     47 }
     48