summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86SectLinker.cpp
blob: 14621f3b81b0843c8afcf6b0c319462a824cdcf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===- X86SectLinker.cpp --------------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <llvm/ADT/Triple.h>
#include <mcld/Support/TargetRegistry.h>

#include "X86.h"
#include "X86AndroidSectLinker.h"
#include "X86ELFSectLinker.h"

using namespace mcld;

namespace mcld {
//===----------------------------------------------------------------------===//
/// createX86SectLinker - the help funtion to create corresponding X86SectLinker
///
SectLinker* createX86SectLinker(const std::string &pTriple,
                                SectLinkerOption &pOption,
                                mcld::TargetLDBackend &pLDBackend)
{
  Triple theTriple(pTriple);
  if (theTriple.isOSDarwin()) {
    assert(0 && "MachO linker has not supported yet");
  }
  if (theTriple.isOSWindows()) {
    assert(0 && "COFF linker has not supported yet");
  }

  // For now, use Android SectLinker directly
  return new X86AndroidSectLinker(pOption,
                                  pLDBackend);
}

} // namespace of mcld

//==========================
// X86SectLinker
extern "C" void LLVMInitializeX86SectLinker() {
  // Register the linker frontend
  mcld::TargetRegistry::RegisterSectLinker(TheX86Target, createX86SectLinker);
}