-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Use protected visibility by default on ELF platforms #105518
Comments
Those issues are about which symbols are exported or not. This issue is not about which symbols are exported or not. Protected visibility will still export symbols. It merely prevents overwriting those symbols from other dylibs. |
Ah ok thanks for the clarification! |
Attempted to implement this in https://github.com/bjorn3/rust/tree/protected_visibility. It works fine for ld.gold and ld.lld, but with ld.bfd it results in:
|
@bjorn3 did you report the issue upstream to Binutils? This would be a nice thing to have. |
I didn't. I don't even know if the latest binutils has the same issue. |
I just published a blog post on this topic: https://davidlattimore.github.io/posts/2024/08/27/rust-dylib-rabbit-holes.html The situation has improved significantly with GNU ld from binutils 2.40 and later, which went into distros late last year. I'd say that we can't justify breaking linking for users that have GNU ld < 2.40 for quite some time. So that means this would need to be behind a flag. The good news is that we could consider defaulting that flag to true when LLD is selected as the linker. I'm happy to have a go at this, unless @bjorn3 or someone else wants to? |
This might be a bit unexpected, so I'm posting it for your information. |
… r=Urgau Replace -Z default-hidden-visibility with -Z default-visibility Issue rust-lang#105518
Rollup merge of rust-lang#130005 - davidlattimore:protected-vis-flag, r=Urgau Replace -Z default-hidden-visibility with -Z default-visibility Issue rust-lang#105518
I noticed that the .so files built by x.py contain a lot of "unnecessary" PLT entries. The compiler should be using protected visibility on ELF platforms by default.
I was thinking we should be able to tie it to
#[no_mangle]
but on Zulip @bjorn3 proposed tying it to the SymbolExportLevel (Rust for mangled and unmangled but not exported from cdylib#[rustc_std_internal_symbol]
symbols and C for#[no_mangle]
symbols).The text was updated successfully, but these errors were encountered: