1 //===- X86MCLinker.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 "X86.h" 10 #include "X86ELFMCLinker.h" 11 #include <mcld/Module.h> 12 #include <mcld/Support/TargetRegistry.h> 13 #include <llvm/ADT/Triple.h> 14 15 using namespace mcld; 16 17 namespace mcld { 18 19 //===----------------------------------------------------------------------===// 20 /// createX86MCLinker - the help funtion to create corresponding X86MCLinker 21 //===----------------------------------------------------------------------===// 22 MCLinker* createX86MCLinker(const std::string &pTriple, 23 LinkerConfig& pConfig, 24 mcld::Module& pModule, 25 MemoryArea& pOutput) 26 { 27 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 X86ELFMCLinker(pConfig, pModule, pOutput); 38 } 39 40 } // namespace of mcld 41 42 //===----------------------------------------------------------------------===// 43 // X86MCLinker 44 //===----------------------------------------------------------------------===// 45 extern "C" void MCLDInitializeX86MCLinker() { 46 // Register the linker frontend 47 mcld::TargetRegistry::RegisterMCLinker(TheX86_32Target, createX86MCLinker); 48 mcld::TargetRegistry::RegisterMCLinker(TheX86_64Target, createX86MCLinker); 49 } 50 51