Skip to content

Commit 9f406ce

Browse files
committed
addressing feedback
1 parent 4dbdcd1 commit 9f406ce

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,12 @@ unsafe fn configure_llvm(sess: &Session) {
130130
llvm::LLVMInitializePasses();
131131

132132
for plugin in &sess.opts.debugging_opts.llvm_plugins {
133-
let path = CString::new(plugin.as_bytes()).unwrap();
134-
let res = libc::dlopen(path.as_ptr(), libc::RTLD_LAZY | libc::RTLD_GLOBAL);
135-
if res.is_null() {
136-
println!("{}", CStr::from_ptr(libc::dlerror()).to_string_lossy().into_owned());
133+
let path = path::Path::new(plugin);
134+
let res = DynamicLibrary::open(path);
135+
match res {
136+
Ok(_) => debug!("configure_llvm: {}", plugin),
137+
Err(e) => bug!("couldn't load plugin: {}", e),
137138
}
138-
println!("{:p}", res);
139-
println!("{}", plugin);
140139
}
141140

142141
rustc_llvm::initialize_available_targets();

0 commit comments

Comments
 (0)