Skip to content

Commit 3ee1d3e

Browse files
committed
rustllvm: Fix symbol resolution on Mac for rusti. rs=bugfix
1 parent 9bf87bb commit 3ee1d3e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/rustllvm/RustWrapper.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ void *RustMCJITMemoryManager::getPointerToNamedFunction(const std::string &Name,
290290
void *Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr);
291291
if (Ptr) return Ptr;
292292

293+
// If it wasn't found and if it starts with an underscore ('_') character,
294+
// try again without the underscore.
295+
if (NameStr[0] == '_') {
296+
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
297+
if (Ptr) return Ptr;
298+
}
299+
293300
if (AbortOnFailure)
294301
report_fatal_error("Program used external function '" + Name +
295302
"' which could not be resolved!");

0 commit comments

Comments
 (0)