diff options
author | Manman Ren <manman.ren@gmail.com> | 2014-02-10 23:26:14 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2014-02-10 23:26:14 +0000 |
commit | f3fc8c9d0953dbb275f00122afbe207ef7e76df4 (patch) | |
tree | b1374660a820a6e15ff03115b06ef0f30679f5ca /tools/lto | |
parent | 4822c5fa52bcc581ac54046b1f5f28be6159bb4e (diff) | |
download | llvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.gz llvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.bz2 llvm-f3fc8c9d0953dbb275f00122afbe207ef7e76df4.tar.xz |
LTO API: add lto_module_create_from_memory_with_path.
This function adds an extra path argument to lto_module_create_from_memory.
The path argument will be passed to makeBuffer to make sure the MemoryBuffer
has a name and the created module has a module identifier.
This is mainly for emitting warning messages from the linker. When we emit
warning message on a module, we can use the module identifier.
rdar://15985737
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r-- | tools/lto/lto.cpp | 11 | ||||
-rw-r--r-- | tools/lto/lto.exports | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 967250acd7..d2f1ffdfa2 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -156,6 +156,17 @@ lto_module_t lto_module_create_from_memory(const void* mem, size_t length) { return LTOModule::makeLTOModule(mem, length, Options, sLastErrorString); } +/// Loads an object file from memory with an extra path argument. +/// Returns NULL on error (check lto_get_error_message() for details). +lto_module_t lto_module_create_from_memory_with_path(const void* mem, + size_t length, + const char *path) { + lto_initialize(); + llvm::TargetOptions Options; + lto_set_target_options(Options); + return LTOModule::makeLTOModule(mem, length, Options, sLastErrorString, path); +} + /// lto_module_dispose - Frees all memory for a module. Upon return the /// lto_module_t is no longer valid. void lto_module_dispose(lto_module_t mod) { diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports index 9b8dcb5f09..b10ab1a3e6 100644 --- a/tools/lto/lto.exports +++ b/tools/lto/lto.exports @@ -5,6 +5,7 @@ lto_module_create lto_module_create_from_fd lto_module_create_from_fd_at_offset lto_module_create_from_memory +lto_module_create_from_memory_with_path lto_module_get_deplib lto_module_get_linkeropt lto_module_get_num_deplibs |