Skip to content

Commit b6ef8b6

Browse files
authored
Rollup merge of #119637 - aoli-al:master, r=cuviper
Pass LLVM error message back to pass wrapper. When rustc fails to load a plugin, it should provide more detailed error message. Before this PR, rustc prints: ``` error: failed to run LLVM passes: Failed to load pass pluginPLUGIN_NAME.so ``` This PR passes LLVM errors back to rustc. After this PR, rustc prints: ``` error: failed to run LLVM passes: Could not load library 'PLUGIN_NAME.so': PLUGIN_NAME.so: undefined symbol: _ZN4llvm9DebugFlagE ``` This PR only contains usability improvements and does not change any functionality. Thus, no new unit test is implemented.
2 parents 0f2d12e + c9276ea commit b6ef8b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,9 @@ LLVMRustOptimize(
787787
for (auto PluginPath: Plugins) {
788788
auto Plugin = PassPlugin::Load(PluginPath.str());
789789
if (!Plugin) {
790-
LLVMRustSetLastError(("Failed to load pass plugin" + PluginPath.str()).c_str());
790+
auto Err = Plugin.takeError();
791+
auto ErrMsg = llvm::toString(std::move(Err));
792+
LLVMRustSetLastError(ErrMsg.c_str());
791793
return LLVMRustResult::Failure;
792794
}
793795
Plugin->registerPassBuilderCallbacks(PB);

0 commit comments

Comments
 (0)