1
Fork 0

allow loading of llvm plugins on nightly

This commit is contained in:
Manuel Drehwald 2021-06-13 18:23:01 +02:00
parent fb3ea63d9b
commit 4dbdcd1c5c
3 changed files with 13 additions and 0 deletions

View file

@ -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());