[llvm] r333152 - Revert r333147 "[ORC] Add findSymbolIn() wrapper to C bindings."
Andres Freund via llvm-commits
llvm-commits at lists.llvm.org
Wed May 23 22:10:20 PDT 2018
Author: anarazel
Date: Wed May 23 22:10:19 2018
New Revision: 333152
URL: http://llvm.org/viewvc/llvm-project?rev=333152&view=rev
Log:
Revert r333147 "[ORC] Add findSymbolIn() wrapper to C bindings."
This reverts r333147 until https://reviews.llvm.org/D47308 is ready to
be reviewed. r333147 exposed a behavioural difference between
OrcCBindingsStack::findSymbolIn() and OrcCBindingsStack::findSymbol(),
where only the latter does name mangling. After r333147 that causes a
test failure on OSX, because the new test looks for main using
findSymbolIn() but the mangled name is _main.
Modified:
llvm/trunk/include/llvm-c/OrcBindings.h
llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindings.cpp
llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
llvm/trunk/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
Modified: llvm/trunk/include/llvm-c/OrcBindings.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/OrcBindings.h?rev=333152&r1=333151&r2=333152&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/OrcBindings.h (original)
+++ llvm/trunk/include/llvm-c/OrcBindings.h Wed May 23 22:10:19 2018
@@ -141,15 +141,6 @@ LLVMOrcErrorCode LLVMOrcGetSymbolAddress
const char *SymbolName);
/**
- * Get symbol address from JIT instance, searching only the specified
- * handle.
- */
-LLVMOrcErrorCode LLVMOrcGetSymbolAddressIn(LLVMOrcJITStackRef JITStack,
- LLVMOrcTargetAddress *RetAddr,
- LLVMOrcModuleHandle H,
- const char *SymbolName);
-
-/**
* Dispose of an ORC JIT stack.
*/
LLVMOrcErrorCode LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack);
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindings.cpp?rev=333152&r1=333151&r2=333152&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindings.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindings.cpp Wed May 23 22:10:19 2018
@@ -112,14 +112,6 @@ LLVMOrcErrorCode LLVMOrcGetSymbolAddress
return J.findSymbolAddress(*RetAddr, SymbolName, true);
}
-LLVMOrcErrorCode LLVMOrcGetSymbolAddressIn(LLVMOrcJITStackRef JITStack,
- LLVMOrcTargetAddress *RetAddr,
- LLVMOrcModuleHandle H,
- const char *SymbolName) {
- OrcCBindingsStack &J = *unwrap(JITStack);
- return J.findSymbolAddressIn(*RetAddr, H, SymbolName, true);
-}
-
LLVMOrcErrorCode LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack) {
auto *J = unwrap(JITStack);
auto Err = J->shutdown();
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h?rev=333152&r1=333151&r2=333152&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h Wed May 23 22:10:19 2018
@@ -380,7 +380,6 @@ public:
JITSymbol findSymbolIn(orc::VModuleKey K, const std::string &Name,
bool ExportedSymbolsOnly) {
- assert(KeyLayers.count(K) && "looking up symbol in unknown module");
return KeyLayers[K]->findSymbolIn(K, Name, ExportedSymbolsOnly);
}
@@ -392,27 +391,6 @@ public:
// Successful lookup, non-null symbol:
if (auto AddrOrErr = Sym.getAddress()) {
RetAddr = *AddrOrErr;
- return LLVMOrcErrSuccess;
- } else
- return mapError(AddrOrErr.takeError());
- } else if (auto Err = Sym.takeError()) {
- // Lookup failure - report error.
- return mapError(std::move(Err));
- }
- // Otherwise we had a successful lookup but got a null result. We already
- // set RetAddr to '0' above, so just return success.
- return LLVMOrcErrSuccess;
- }
-
- LLVMOrcErrorCode findSymbolAddressIn(JITTargetAddress &RetAddr,
- orc::VModuleKey K,
- const std::string &Name,
- bool ExportedSymbolsOnly) {
- RetAddr = 0;
- if (auto Sym = findSymbolIn(K, Name, ExportedSymbolsOnly)) {
- // Successful lookup, non-null symbol:
- if (auto AddrOrErr = Sym.getAddress()) {
- RetAddr = *AddrOrErr;
return LLVMOrcErrSuccess;
} else
return mapError(AddrOrErr.takeError());
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp?rev=333152&r1=333151&r2=333152&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp Wed May 23 22:10:19 2018
@@ -98,26 +98,12 @@ TEST_F(OrcCAPIExecutionTest, TestEagerIR
LLVMOrcModuleHandle H;
LLVMOrcAddEagerlyCompiledIR(JIT, &H, wrap(M.release()), myResolver, nullptr);
-
- // get symbol address searching the entire stack
- {
- LLVMOrcTargetAddress MainAddr;
- LLVMOrcGetSymbolAddress(JIT, &MainAddr, "main");
- MainFnTy MainFn = (MainFnTy)MainAddr;
- int Result = MainFn();
- EXPECT_EQ(Result, 42)
- << "Eagerly JIT'd code did not return expected result";
- }
-
- // and then just searching a single handle
- {
- LLVMOrcTargetAddress MainAddr;
- LLVMOrcGetSymbolAddressIn(JIT, &MainAddr, H, "main");
- MainFnTy MainFn = (MainFnTy)MainAddr;
- int Result = MainFn();
- EXPECT_EQ(Result, 42)
- << "Eagerly JIT'd code did not return expected result";
- }
+ LLVMOrcTargetAddress MainAddr;
+ LLVMOrcGetSymbolAddress(JIT, &MainAddr, "main");
+ MainFnTy MainFn = (MainFnTy)MainAddr;
+ int Result = MainFn();
+ EXPECT_EQ(Result, 42)
+ << "Eagerly JIT'd code did not return expected result";
LLVMOrcRemoveModule(JIT, H);
More information about the llvm-commits
mailing list