[llvm] r239411 - Add more wrappers for symbol APIs to the C API.
Eli Bendersky
eliben at google.com
Tue Jun 9 08:57:30 PDT 2015
Author: eliben
Date: Tue Jun 9 10:57:30 2015
New Revision: 239411
URL: http://llvm.org/viewvc/llvm-project?rev=239411&view=rev
Log:
Add more wrappers for symbol APIs to the C API.
This represents some of the functionality we expose in the llvmlite Python
binding.
Patch by Antoine Pitrou
Differential Revision: http://reviews.llvm.org/D10222
Modified:
llvm/trunk/include/llvm-c/Support.h
llvm/trunk/lib/Support/DynamicLibrary.cpp
Modified: llvm/trunk/include/llvm-c/Support.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Support.h?rev=239411&r1=239410&r2=239411&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Support.h (original)
+++ llvm/trunk/include/llvm-c/Support.h Tue Jun 9 10:57:30 2015
@@ -58,6 +58,24 @@ LLVMBool LLVMLoadLibraryPermanently(cons
void LLVMParseCommandLineOptions(int argc, const char *const *argv,
const char *Overview);
+/**
+ * This function will search through all previously loaded dynamic
+ * libraries for the symbol \p symbolName. If it is found, the address of
+ * that symbol is returned. If not, null is returned.
+ *
+ * @see sys::DynamicLibrary::SearchForAddressOfSymbol()
+ */
+void *LLVMSearchForAddressOfSymbol(const char *symbolName);
+
+/**
+ * This functions permanently adds the symbol \p symbolName with the
+ * value \p symbolValue. These symbols are searched before any
+ * libraries.
+ *
+ * @see sys::DynamicLibrary::AddSymbol()
+ */
+void LLVMAddSymbol(const char *symbolName, void *symbolValue);
+
#ifdef __cplusplus
}
#endif
Modified: llvm/trunk/lib/Support/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DynamicLibrary.cpp?rev=239411&r1=239410&r2=239411&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DynamicLibrary.cpp (original)
+++ llvm/trunk/lib/Support/DynamicLibrary.cpp Tue Jun 9 10:57:30 2015
@@ -178,3 +178,12 @@ void* DynamicLibrary::SearchForAddressOf
LLVMBool LLVMLoadLibraryPermanently(const char* Filename) {
return llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename);
}
+
+void *LLVMSearchForAddressOfSymbol(const char *symbolName) {
+ return llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(symbolName);
+}
+
+void LLVMAddSymbol(const char *symbolName, void *symbolValue) {
+ return llvm::sys::DynamicLibrary::AddSymbol(symbolName, symbolValue);
+}
+
More information about the llvm-commits
mailing list