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 "X86ELFSectLinker.h"
     14 
     15 using namespace mcld;
     16 
     17 namespace mcld {
     18 //===----------------------------------------------------------------------===//
     19 /// createX86SectLinker - the help funtion to create corresponding X86SectLinker
     20 ///
     21 SectLinker* createX86SectLinker(const std::string &pTriple,
     22                                 SectLinkerOption &pOption,
     23                                 mcld::TargetLDBackend &pLDBackend)
     24 {
     25   Triple theTriple(pTriple);
     26   if (theTriple.isOSDarwin()) {
     27     assert(0 && "MachO linker has not supported yet");
     28     return NULL;
     29   }
     30   if (theTriple.isOSWindows()) {
     31     assert(0 && "COFF linker has not supported yet");
     32     return NULL;
     33   }
     34 
     35   if (theTriple.isArch32Bit())
     36     return new X86ELFSectLinker(pOption, pLDBackend);
     37 
     38   assert(0 && "X86_64 has not supported yet");
     39   return NULL;
     40 }
     41 
     42 } // namespace of mcld
     43 
     44 //==========================
     45 // X86SectLinker
     46 extern "C" void LLVMInitializeX86SectLinker() {
     47   // Register the linker frontend
     48   mcld::TargetRegistry::RegisterSectLinker(TheX86Target, createX86SectLinker);
     49 }
     50 
     51