Conversation
taiki-e
force-pushed
the
main
branch
3 times, most recently
from
August 14, 2026 19:38
609936b to
5bc3902
Compare
taiki-e
force-pushed
the
weakref
branch
8 times, most recently
from
August 15, 2026 08:11
cc196f5 to
deb39f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is similar to
dlsymand unstable#[linkage = "extern_weak"], but async-signal-safe unlikedlsymand works on stable and sound with fat LTO unlikeextern_weak.When statically linked, weakref may resolve to null even if the symbol is actually available (as with
dlsymandextern_weak).However, unlike
dlsymit works if there are other strong references to the same symbol, so this PR enables detection at all times for targets where it was previously enabled only with dynamic linking.Unlike
extern_weak, this can be soundly used with "fat LTO + other strong reference + symbol resolved to null" case: rust-lang/rust#154439With rust-lang/rust#154439 (comment) example on aarch64-unknown-linux-gnu:
(A weak reference is promoted to a strong reference as a strong reference already exists in deps.rs, and since there is no
my_extern, it is correct that a link error occurs in this example.)See comments on
weakref!macro added to src/utils.rs for more details.Refs: https://sourceware.org/binutils/docs/as/Weakref.html