From 4dbdcd1c5cc5f2e61495af95d81b1fc588506aa4 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sun, 13 Jun 2021 18:23:01 +0200 Subject: allow loading of llvm plugins on nightly --- compiler/rustc_codegen_llvm/src/llvm_util.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/rustc_codegen_llvm') diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 0dd3d2ae15b..a15edaf5138 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -129,6 +129,16 @@ 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()); + } + println!("{:p}", res); + println!("{}", plugin); + } + rustc_llvm::initialize_available_targets(); llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr()); -- cgit 1.4.1-3-g733a5