• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- MCLDOptions.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 <mcld/MC/MCLDOptions.h>
10 #include <mcld/MC/MCLDInput.h>
11 
12 using namespace mcld;
13 
14 //===----------------------------------------------------------------------===//
15 // ScriptOptions
ScriptOptions()16 ScriptOptions::ScriptOptions()
17 {
18 }
19 
~ScriptOptions()20 ScriptOptions::~ScriptOptions()
21 {
22 }
23 
24 //===----------------------------------------------------------------------===//
25 // GeneralOptions
GeneralOptions()26 GeneralOptions::GeneralOptions()
27   : m_pDefaultBitcode(NULL),
28     m_Verbose(-1),
29     m_MaxErrorNum(-1),
30     m_MaxWarnNum(-1),
31     m_ExecStack(Unknown),
32     m_CommPageSize(0x0),
33     m_MaxPageSize(0x0),
34     m_bCombReloc(true),
35     m_bNoUndefined(false),
36     m_bInitFirst(false),
37     m_bInterPose(false),
38     m_bLoadFltr(false),
39     m_bMulDefs(false),
40     m_bNoCopyReloc(false),
41     m_bNoDefaultLib(false),
42     m_bNoDelete(false),
43     m_bNoDLOpen(false),
44     m_bNoDump(false),
45     m_bRelro(false),
46     m_bNow(false),
47     m_bOrigin(false),
48     m_bTrace(false),
49     m_Bsymbolic(false),
50     m_Bgroup(false),
51     m_bPIE(false),
52     m_bColor(true),
53     m_bAllowShlibUndefined(true),
54     m_bCreateEhFrameHdr(false)
55 {
56 }
57 
~GeneralOptions()58 GeneralOptions::~GeneralOptions()
59 {
60 }
61 
hasDefaultLDScript() const62 bool GeneralOptions::hasDefaultLDScript() const
63 {
64   return true;
65 }
66 
defaultLDScript() const67 const char* GeneralOptions::defaultLDScript() const
68 {
69   return NULL;
70 }
71 
setDefaultLDScript(const std::string & pFilename)72 void GeneralOptions::setDefaultLDScript(const std::string& pFilename)
73 {
74 }
75 
setSysroot(const mcld::sys::fs::Path & pSysroot)76 void GeneralOptions::setSysroot(const mcld::sys::fs::Path &pSysroot)
77 {
78   m_Sysroot.assign(pSysroot);
79 }
80 
addZOption(const ZOption & pOption)81 void GeneralOptions::addZOption(const ZOption& pOption)
82 {
83   switch (pOption.kind()) {
84     case ZOption::CombReloc:
85       m_bCombReloc = true;
86       break;
87     case ZOption::NoCombReloc:
88       m_bCombReloc = false;
89       break;
90     case ZOption::Defs:
91       m_bNoUndefined = true;
92       break;
93     case ZOption::ExecStack:
94       m_ExecStack = YES;
95       break;
96     case ZOption::NoExecStack:
97       m_ExecStack = NO;
98       break;
99     case ZOption::InitFirst:
100       m_bInitFirst = true;
101       break;
102     case ZOption::InterPose:
103       m_bInterPose = true;
104       break;
105     case ZOption::LoadFltr:
106       m_bLoadFltr = true;
107       break;
108     case ZOption::MulDefs:
109       m_bMulDefs = true;
110       break;
111     case ZOption::NoCopyReloc:
112       m_bNoCopyReloc = true;
113       break;
114     case ZOption::NoDefaultLib:
115       m_bNoDefaultLib = true;
116       break;
117     case ZOption::NoDelete:
118       m_bNoDelete = true;
119       break;
120     case ZOption::NoDLOpen:
121       m_bNoDLOpen = true;
122       break;
123     case ZOption::NoDump:
124       m_bNoDump = true;
125       break;
126     case ZOption::NoRelro:
127       m_bRelro = false;
128       break;
129     case ZOption::Relro:
130       m_bRelro = true;
131       break;
132     case ZOption::Lazy:
133       m_bNow = false;
134       break;
135     case ZOption::Now:
136       m_bNow = true;
137       break;
138     case ZOption::Origin:
139       m_bOrigin = true;
140       break;
141     case ZOption::CommPageSize:
142       m_CommPageSize = pOption.pageSize();
143       break;
144     case ZOption::MaxPageSize:
145       m_MaxPageSize = pOption.pageSize();
146       break;
147     case ZOption::Unknown:
148     default:
149       assert(false && "Not a recognized -z option.");
150       break;
151   }
152 }
153