Skip to content

Commit c838673

Browse files
proc-macro-srv: drop unnecessary usage of RTLD_DEEPBIND
the constant is wrong on some platforms (e.g., on mips64el it's 0x10, and 0x8 is RTLD_NOLOAD which makes all this functionality broken), and it is no longer needed because #60593 got fixed by #99944 in the meantime. Signed-off-by: Fabian Grünbichler <[email protected]>
1 parent d8a6409 commit c838673

File tree

1 file changed

+1
-15
lines changed
  • src/tools/rust-analyzer/crates/proc-macro-srv/src

1 file changed

+1
-15
lines changed

src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ use paths::{Utf8Path, Utf8PathBuf};
1212
use crate::{proc_macros::ProcMacros, server_impl::TopSubtree, ProcMacroKind, ProcMacroSrvSpan};
1313

1414
/// Loads dynamic library in platform dependent manner.
15-
///
16-
/// For unix, you have to use RTLD_DEEPBIND flag to escape problems described
17-
/// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample)
18-
/// and [here](https://github.com/rust-lang/rust/issues/60593).
19-
///
20-
/// Usage of RTLD_DEEPBIND
21-
/// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1)
22-
///
23-
/// It seems that on Windows that behaviour is default, so we do nothing in that case.
2415
#[cfg(windows)]
2516
fn load_library(file: &Utf8Path) -> Result<Library, libloading::Error> {
2617
unsafe { Library::new(file) }
@@ -29,12 +20,7 @@ fn load_library(file: &Utf8Path) -> Result<Library, libloading::Error> {
2920
#[cfg(unix)]
3021
fn load_library(file: &Utf8Path) -> Result<Library, libloading::Error> {
3122
use libloading::os::unix::Library as UnixLibrary;
32-
use std::os::raw::c_int;
33-
34-
const RTLD_NOW: c_int = 0x00002;
35-
const RTLD_DEEPBIND: c_int = 0x00008;
36-
37-
unsafe { UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into()) }
23+
unsafe { UnixLibrary::open(Some(file), libloading::os::unix::RTLD_NOW).map(|lib| lib.into()) }
3824
}
3925

4026
#[derive(Debug)]

0 commit comments

Comments
 (0)