about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorManuel Drehwald <git@manuel.drehwald.info>2021-06-21 01:38:25 +0200
committerManuel Drehwald <git@manuel.drehwald.info>2021-06-21 01:38:25 +0200
commit9f406ce2c799cd39173f43cff8288674710f91d7 (patch)
treeca7747ca4885aa6d54bc4af3ace3b26fd393d93d /compiler/rustc_codegen_llvm
parent4dbdcd1c5cc5f2e61495af95d81b1fc588506aa4 (diff)
downloadrust-9f406ce2c799cd39173f43cff8288674710f91d7.tar.gz
rust-9f406ce2c799cd39173f43cff8288674710f91d7.zip
addressing feedback
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index a15edaf5138..1972e96d10e 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -130,13 +130,12 @@ unsafe fn configure_llvm(sess: &Session) {
     llvm::LLVMInitializePasses();
 
     for plugin in &sess.opts.debugging_opts.llvm_plugins {
-        let path = CString::new(plugin.as_bytes()).unwrap();
-        let res = libc::dlopen(path.as_ptr(), libc::RTLD_LAZY | libc::RTLD_GLOBAL);
-        if res.is_null() {
-            println!("{}", CStr::from_ptr(libc::dlerror()).to_string_lossy().into_owned());
+        let path = path::Path::new(plugin);
+        let res = DynamicLibrary::open(path);
+        match res {
+            Ok(_) => debug!("configure_llvm: {}", plugin),
+            Err(e) => bug!("couldn't load plugin: {}", e),
         }
-        println!("{:p}", res);
-        println!("{}", plugin);
     }
 
     rustc_llvm::initialize_available_targets();