]> git.lizzy.rs Git - rust.git/commitdiff
addressing feedback
authorManuel Drehwald <git@manuel.drehwald.info>
Sun, 20 Jun 2021 23:38:25 +0000 (01:38 +0200)
committerManuel Drehwald <git@manuel.drehwald.info>
Sun, 20 Jun 2021 23:38:25 +0000 (01:38 +0200)
compiler/rustc_codegen_llvm/src/llvm_util.rs

index a15edaf513858cfe6839ec9b51585602e3b6bd6f..1972e96d10eb96ce8031d49b0bb38733b6237c35 100644 (file)
@@ -130,13 +130,12 @@ fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
     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();