summaryrefslogtreecommitdiff
path: root/tools/lto
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-01-21 18:31:27 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-01-21 18:31:27 +0000
commita747cf1c4d740dfe5fd1b3cd1b3d43251892457a (patch)
tree3640e0852df6d853ed2b84c2a1ccce517a3c336a /tools/lto
parent92e658b56616cf389de242df230682f0b1c9e4fd (diff)
downloadllvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.gz
llvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.bz2
llvm-a747cf1c4d740dfe5fd1b3cd1b3d43251892457a.tar.xz
Adding new LTO APIs to parse metadata nodes and extract linker options and
dependent libraries from a bitcode module. Differential Revision: http://llvm-reviews.chandlerc.com/D2343 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/lto.cpp22
-rw-r--r--tools/lto/lto.exports4
2 files changed, 26 insertions, 0 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index 3d58a577dc..967250acd7 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -193,6 +193,28 @@ lto_symbol_attributes lto_module_get_symbol_attribute(lto_module_t mod,
return mod->getSymbolAttributes(index);
}
+/// lto_module_get_num_deplibs - Returns the number of dependent libraries in
+/// the object module.
+unsigned int lto_module_get_num_deplibs(lto_module_t mod) {
+ return mod->getDependentLibraryCount();
+}
+
+/// lto_module_get_deplib - Returns the ith dependent library in the module.
+const char* lto_module_get_deplib(lto_module_t mod, unsigned int index) {
+ return mod->getDependentLibrary(index);
+}
+
+/// lto_module_get_num_linkeropts - Returns the number of linker options in the
+/// object module.
+unsigned int lto_module_get_num_linkeropts(lto_module_t mod) {
+ return mod->getLinkerOptCount();
+}
+
+/// lto_module_get_linkeropt - Returns the ith linker option in the module.
+const char* lto_module_get_linkeropt(lto_module_t mod, unsigned int index) {
+ return mod->getLinkerOpt(index);
+}
+
/// Set a diagnostic handler.
void lto_codegen_set_diagnostic_handler(lto_code_gen_t cg,
lto_diagnostic_handler_t diag_handler,
diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports
index c8f8ee873b..9b8dcb5f09 100644
--- a/tools/lto/lto.exports
+++ b/tools/lto/lto.exports
@@ -5,6 +5,10 @@ lto_module_create
lto_module_create_from_fd
lto_module_create_from_fd_at_offset
lto_module_create_from_memory
+lto_module_get_deplib
+lto_module_get_linkeropt
+lto_module_get_num_deplibs
+lto_module_get_num_linkeropts
lto_module_get_num_symbols
lto_module_get_symbol_attribute
lto_module_get_symbol_name