summaryrefslogtreecommitdiff
path: root/include/mcld/LinkerConfig.h
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-12-15 17:21:00 -0800
committerShih-wei Liao <sliao@google.com>2012-12-15 17:21:00 -0800
commit22add6ff3426df1a85089fe6a6e1597ee3b6f300 (patch)
treec58763780e7b965179d9cdce45f1fc5a5268932d /include/mcld/LinkerConfig.h
parentc842fe71ef087c982cc03d0ea73eeaf455d932d3 (diff)
downloadmclinker-22add6ff3426df1a85089fe6a6e1597ee3b6f300.tar.gz
MCLinker upstream commit 0459e386785c.
Change-Id: Ide6790f5a354b7fcc03d812d6c8cf43b1e309ba3
Diffstat (limited to 'include/mcld/LinkerConfig.h')
-rw-r--r--include/mcld/LinkerConfig.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/include/mcld/LinkerConfig.h b/include/mcld/LinkerConfig.h
new file mode 100644
index 0000000..7d52819
--- /dev/null
+++ b/include/mcld/LinkerConfig.h
@@ -0,0 +1,90 @@
+//===- LinkerConfig.h -----------------------------------------------------===//
+//
+// The MCLinker Project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef MCLD_LINKER_CONFIG_H
+#define MCLD_LINKER_CONFIG_H
+#ifdef ENABLE_UNITTEST
+#include <gtest.h>
+#endif
+
+#include <llvm/ADT/Triple.h>
+
+#include <mcld/GeneralOptions.h>
+#include <mcld/ScriptOptions.h>
+#include <mcld/BitcodeOption.h>
+#include <mcld/AttributeOption.h>
+#include <mcld/Support/Path.h>
+
+#include <string>
+
+namespace mcld {
+
+/** \class LinkerConfig
+ * \brief LinkerConfig is composed of argumments of MCLinker.
+ * options() - the general options
+ * scripts() - the script options
+ * bitcode() - the bitcode being linked
+ * attribute() - the attribute options
+ */
+class LinkerConfig
+{
+public:
+ enum CodeGenType {
+ Unknown,
+ Object,
+ DynObj,
+ Exec,
+ External
+ };
+
+public:
+ LinkerConfig();
+
+ explicit LinkerConfig(const std::string &pTripleString);
+
+ ~LinkerConfig();
+
+ const GeneralOptions& options() const { return m_Options; }
+ GeneralOptions& options() { return m_Options; }
+
+ const ScriptOptions& scripts() const { return m_Scripts; }
+ ScriptOptions& scripts() { return m_Scripts; }
+
+ const BitcodeOption& bitcode() const { return m_Bitcode; }
+ BitcodeOption& bitcode() { return m_Bitcode; }
+
+ const AttributeOption& attribute() const { return m_Attribute; }
+ AttributeOption& attribute() { return m_Attribute; }
+
+ CodeGenType codeGenType() const { return m_CodeGenType; }
+
+ void setCodeGenType(CodeGenType pType) { m_CodeGenType = pType; }
+
+ const llvm::Triple& triple() const { return m_Triple; }
+
+ void setTriple(const std::string& pTriple);
+
+ void setTriple(const llvm::Triple& pTriple);
+
+ static const char* version();
+
+private:
+ // ----- General Options ----- //
+ GeneralOptions m_Options;
+ ScriptOptions m_Scripts;
+ BitcodeOption m_Bitcode;
+ AttributeOption m_Attribute;
+
+ llvm::Triple m_Triple;
+ CodeGenType m_CodeGenType;
+};
+
+} // namespace of mcld
+
+#endif
+