Home | History | Annotate | Download | only in X86
      1 //===- X86SectLinker.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 <llvm/ADT/Triple.h>
     10 #include <mcld/Support/TargetRegistry.h>
     11 
     12 #include "X86.h"
     13 #include "X86AndroidSectLinker.h"
     14 #include "X86ELFSectLinker.h"
     15 
     16 using namespace mcld;
     17 
     18 namespace mcld {
     19 //===----------------------------------------------------------------------===//
     20 /// createX86SectLinker - the help funtion to create corresponding X86SectLinker
     21 ///
     22 SectLinker* createX86SectLinker(const std::string &pTriple,
     23                                 SectLinkerOption &pOption,
     24                                 mcld::TargetLDBackend &pLDBackend)
     25 {
     26   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 X86AndroidSectLinker(pOption,
     36                                   pLDBackend);
     37 }
     38 
     39 } // namespace of mcld
     40 
     41 //==========================
     42 // X86SectLinker
     43 extern "C" void LLVMInitializeX86SectLinker() {
     44   // Register the linker frontend
     45   mcld::TargetRegistry::RegisterSectLinker(TheX86Target, createX86SectLinker);
     46 }
     47