summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/lto.h39
-rw-r--r--include/llvm/CodeGen/TargetLoweringObjectFileImpl.h8
-rw-r--r--include/llvm/LTO/LTOModule.h31
-rw-r--r--include/llvm/Target/TargetLoweringObjectFile.h6
4 files changed, 83 insertions, 1 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h
index 7078a745ff..fbad2b5686 100644
--- a/include/llvm-c/lto.h
+++ b/include/llvm-c/lto.h
@@ -40,7 +40,7 @@ typedef bool lto_bool_t;
* @{
*/
-#define LTO_API_VERSION 7
+#define LTO_API_VERSION 8
/**
* \since prior to LTO_API_VERSION=3
@@ -246,6 +246,43 @@ lto_module_get_symbol_name(lto_module_t mod, unsigned int index);
extern lto_symbol_attributes
lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
+
+/**
+ * Returns the number of dependent libraries in the object module.
+ *
+ * \since LTO_API_VERSION=8
+ */
+extern unsigned int
+lto_module_get_num_deplibs(lto_module_t mod);
+
+
+/**
+ * Returns the ith dependent library in the module.
+ *
+ * \since LTO_API_VERSION=8
+ */
+extern const char*
+lto_module_get_deplib(lto_module_t mod, unsigned int index);
+
+
+/**
+ * Returns the number of linker options in the object module.
+ *
+ * \since LTO_API_VERSION=8
+ */
+extern unsigned int
+lto_module_get_num_linkeropts(lto_module_t mod);
+
+
+/**
+ * Returns the ith linker option in the module.
+ *
+ * \since LTO_API_VERSION=8
+ */
+extern const char*
+lto_module_get_linkeropt(lto_module_t mod, unsigned int index);
+
+
/**
* Diagnostic severity.
*
diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 5b22c9c685..4e90e141ce 100644
--- a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -80,6 +80,10 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
public:
virtual ~TargetLoweringObjectFileMachO() {}
+ /// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
+ /// option string. Returns StringRef() if the option does not specify a library.
+ virtual StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const;
+
/// emitModuleFlags - Emit the module flags that specify the garbage
/// collection information.
virtual void emitModuleFlags(MCStreamer &Streamer,
@@ -129,6 +133,10 @@ public:
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
+ /// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
+ /// option string. Returns StringRef() if the option does not specify a library.
+ virtual StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const;
+
/// emitModuleFlags - Emit Obj-C garbage collection and linker options. Only
/// linker option emission is implemented for COFF.
virtual void emitModuleFlags(MCStreamer &Streamer,
diff --git a/include/llvm/LTO/LTOModule.h b/include/llvm/LTO/LTOModule.h
index 78a72fe168..c70afa4196 100644
--- a/include/llvm/LTO/LTOModule.h
+++ b/include/llvm/LTO/LTOModule.h
@@ -51,6 +51,9 @@ private:
llvm::OwningPtr<llvm::Module> _module;
llvm::OwningPtr<llvm::TargetMachine> _target;
llvm::MCObjectFileInfo ObjFileInfo;
+ StringSet _linkeropt_strings;
+ std::vector<const char *> _deplibs;
+ std::vector<const char *> _linkeropts;
std::vector<NameAndAttributes> _symbols;
// _defines and _undefines only needed to disambiguate tentative definitions
@@ -129,6 +132,30 @@ public:
return NULL;
}
+ /// getDependentLibraryCount - Get the number of dependent libraries
+ uint32_t getDependentLibraryCount() {
+ return _deplibs.size();
+ }
+
+ /// getDependentLibrary - Get the dependent library at the specified index.
+ const char *getDependentLibrary(uint32_t index) {
+ if (index < _deplibs.size())
+ return _deplibs[index];
+ return NULL;
+ }
+
+ /// getLinkerOptCount - Get the number of linker options
+ uint32_t getLinkerOptCount() {
+ return _linkeropts.size();
+ }
+
+ /// getLinkerOpt - Get the linker option at the specified index.
+ const char *getLinkerOpt(uint32_t index) {
+ if (index < _linkeropts.size())
+ return _linkeropts[index];
+ return NULL;
+ }
+
/// getLLVVMModule - Return the Module.
llvm::Module *getLLVVMModule() { return _module.get(); }
@@ -138,6 +165,10 @@ public:
}
private:
+ /// parseMetadata - Parse metadata from the module
+ // FIXME: it only parses "Linker Options" metadata at the moment
+ void parseMetadata();
+
/// parseSymbols - Parse the symbols from the module and model-level ASM and
/// add them to either the defined or undefined lists.
bool parseSymbols(std::string &errMsg);
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h
index 4aedd3aa31..5bf9a13563 100644
--- a/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/include/llvm/Target/TargetLoweringObjectFile.h
@@ -57,6 +57,12 @@ public:
const TargetMachine &TM,
const MCSymbol *Sym) const;
+ /// getDepLibFromLinkerOpt - Extract the dependent library name from a linker
+ /// option string. Returns StringRef() if the option does not specify a library.
+ virtual StringRef getDepLibFromLinkerOpt(StringRef LinkerOption) const {
+ return StringRef();
+ }
+
/// emitModuleFlags - Emit the module flags that the platform cares about.
virtual void emitModuleFlags(MCStreamer &,
ArrayRef<Module::ModuleFlagEntry>,