Skip to content

Get __pthread_get_minstack at runtime with dlsym #23631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2015

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Mar 23, 2015

Linking __pthread_get_minstack, even weakly, was causing Debian’s dpkg-shlibdeps to detect an unnecessarily strict versioned dependency on libc6.

Closes #23628.

Linking __pthread_get_minstack, even weakly, was causing Debian’s
dpkg-shlibdeps to detect an unnecessarily strict versioned dependency
on libc6.

Closes rust-lang#23628.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@rust-highfive
Copy link
Contributor

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

#[cfg(target_os = "linux")]
fn min_stack_size(attr: *const libc::pthread_attr_t) -> libc::size_t {
type F = unsafe extern "C" fn(*const libc::pthread_attr_t) -> libc::size_t;
extern {
#[linkage = "extern_weak"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you're removing this could you merge the mac os implementation into this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not a Mac user; does Rust use glibc on Mac? I figured we shouldn’t waste time looking up __pthread_get_minstack on non-glibc.

(But yeah, I should update the comment below, if nothing else.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

andersk added 2 commits March 23, 2015 03:48
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@alexcrichton
Copy link
Member

We currently actually have a two other of these sorts of extern_weak symbols, but is this the only problematic one? They are:

@andersk
Copy link
Contributor Author

andersk commented Mar 23, 2015

Those two are less problematic because they aren’t GLIBC_PRIVATE. They cause dependencies on libc6 (>= 2.12) and libc6 (>= 2.18), respectively. So you might be spuriously prevented from using the package with a much older libc6, but you’ll always be able to use it with a newer one.

 Looking up symbol __cxa_thread_atexit_impl@GLIBC_2.18
 Found in symbols file of libc.so.6 (minver: 2.18, dep: libc6 #MINVER#)
 Looking up symbol pthread_setname_np@GLIBC_2.12
 Found in symbols file of libpthread.so.0 (minver: 2.12, dep: libc6 #MINVER#)

@alexcrichton
Copy link
Member

Ah well it looks like pthread_setname_np is going away anyway, and we can probably apply the same treatment to __cxa_thread_atexit_impl later on if we really need to.

@alexcrichton
Copy link
Member

@bors: r+ 737bb30

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 23, 2015
Linking `__pthread_get_minstack`, even weakly, was causing Debian’s `dpkg-shlibdeps` to detect an unnecessarily strict versioned dependency on libc6.

Closes rust-lang#23628.
@bors bors merged commit 737bb30 into rust-lang:master Mar 24, 2015
@andersk andersk deleted the minstack-dlsym branch March 28, 2015 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of __pthread_get_minstack leads to unnecessarily strict libc6 versioned dependency on Debian
6 participants