diff options
| -rw-r--r-- | llvm/include/llvm-c/lto.h | 10 | ||||
| -rw-r--r-- | llvm/include/llvm/LTO/LTO.h | 4 | ||||
| -rw-r--r-- | llvm/lib/LTO/LTO.cpp | 10 | ||||
| -rw-r--r-- | llvm/tools/lto/lto.cpp | 6 | ||||
| -rw-r--r-- | llvm/tools/lto/lto.exports | 1 |
5 files changed, 30 insertions, 1 deletions
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h index 0ec490fcd5a..41e6067cf44 100644 --- a/llvm/include/llvm-c/lto.h +++ b/llvm/include/llvm-c/lto.h @@ -44,7 +44,7 @@ typedef bool lto_bool_t; * @{ */ -#define LTO_API_VERSION 24 +#define LTO_API_VERSION 25 /** * \since prior to LTO_API_VERSION=3 @@ -593,6 +593,14 @@ extern const char * lto_input_get_dependent_library(lto_input_t input, size_t *size); /** + * Returns the list of libcall symbols that can be generated by LTO + * that might not be visible from the symbol table of bitcode files. + * + * \since prior to LTO_API_VERSION=25 + */ +extern const char *const *lto_runtime_lib_symbols_list(size_t *size); + +/** * @} // endgoup LLVMCLTO * @defgroup LLVMCTLTO ThinLTO * @ingroup LLVMC diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h index 4bf93c5ee44..407af5e8de5 100644 --- a/llvm/include/llvm/LTO/LTO.h +++ b/llvm/include/llvm/LTO/LTO.h @@ -298,6 +298,10 @@ public: /// Cache) for each task identifier. Error run(AddStreamFn AddStream, NativeObjectCache Cache = nullptr); + /// Static method that returns a list of libcall symbols that can be generated + /// by LTO but might not be visible from bitcode symbol table. + static ArrayRef<const char*> getRuntimeLibcallSymbols(); + private: Config Conf; diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 4696265a232..9e16cba44fd 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1011,6 +1011,16 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) { std::move(RegularLTO.CombinedModule), ThinLTO.CombinedIndex); } +static const char *libcallRoutineNames[] = { +#define HANDLE_LIBCALL(code, name) name, +#include "llvm/IR/RuntimeLibcalls.def" +#undef HANDLE_LIBCALL +}; + +ArrayRef<const char*> LTO::getRuntimeLibcallSymbols() { + return makeArrayRef(libcallRoutineNames); +} + /// This class defines the interface to the ThinLTO backend. class lto::ThinBackendProc { protected: diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index ce670c22c7f..9ff16e85db4 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -652,3 +652,9 @@ extern const char *lto_input_get_dependent_library(lto_input_t input, size_t *size) { return LTOModule::getDependentLibrary(unwrap(input), index, size); } + +extern const char *const *lto_runtime_lib_symbols_list(size_t *size) { + auto symbols = lto::LTO::getRuntimeLibcallSymbols(); + *size = symbols.size(); + return symbols.data(); +} diff --git a/llvm/tools/lto/lto.exports b/llvm/tools/lto/lto.exports index 6913e0e70dc..d24809fe762 100644 --- a/llvm/tools/lto/lto.exports +++ b/llvm/tools/lto/lto.exports @@ -76,3 +76,4 @@ lto_input_create lto_input_dispose lto_input_get_num_dependent_libraries lto_input_get_dependent_library +lto_runtime_lib_symbols_list |

