1//===- Linker.h -----------------------------------------------------------===//
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#ifndef ALONE_SUPPORT_LINKER_CONFIG_H
11#define ALONE_SUPPORT_LINKER_CONFIG_H
12
13#include <string>
14
15#include <mcld/MC/MCLDInfo.h>
16#include <mcld/Support/TargetRegistry.h>
17#include <mcld/LD/DiagnosticLineInfo.h>
18#include <mcld/LD/DiagnosticPrinter.h>
19
20namespace alone {
21
22class LinkerConfig {
23private:
24  //===--------------------------------------------------------------------===//
25  // Available Configurations
26  //===--------------------------------------------------------------------===//
27  const std::string mTriple;
28  bool mShared;
29  std::string mSOName;
30
31private:
32  //===--------------------------------------------------------------------===//
33  // These are generated by LinkerConfig during initialize().
34  //===--------------------------------------------------------------------===//
35  const mcld::Target *mTarget;
36  bool initializeTarget();
37
38  mcld::MCLDInfo *mLDInfo;
39  bool initializeLDInfo();
40
41  mcld::DiagnosticLineInfo *mDiagLineInfo;
42  mcld::DiagnosticPrinter *mDiagPrinter;
43  bool initializeDiagnostic();
44
45public:
46  //===--------------------------------------------------------------------===//
47  // Getters
48  //===--------------------------------------------------------------------===//
49  inline const std::string &getTriple() const
50  { return mTriple; }
51
52  inline const mcld::Target *getTarget() const
53  { return mTarget; }
54
55  inline mcld::MCLDInfo* getLDInfo()
56  { return mLDInfo; }
57
58  inline const mcld::MCLDInfo* getLDInfo() const
59  { return mLDInfo; }
60
61  inline bool isShared() const
62  { return mShared; }
63
64  inline std::string getSOName() const
65  { return mSOName; }
66
67  void setShared(bool pEnable = true);
68
69  void setBsymbolic(bool pEnable = true);
70
71  void setSOName(const std::string &pSOName);
72
73  void setDyld(const std::string &pDyld);
74
75  void setSysRoot(const std::string &pSysRoot);
76
77  void addWrap(const std::string &pWrapSymbol);
78
79  void addPortable(const std::string &pPortableSymbol);
80
81  void addSearchDir(const std::string &pDir);
82
83public:
84  LinkerConfig(const std::string& pTriple);
85
86  virtual ~LinkerConfig();
87};
88
89} // end namespace alone
90
91#endif // ALONE_SUPPORT_LINKER_CONFIG_H
92