std_detect: Always avoid dlsym on *-linux-gnu* targets #1375
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.
Currently, we use
dlsym
on non-x861 Linux/Android when thestd_detect_dlsym_getauxval
feature (enabled by default) is enabled becausegetauxval
may not be available.However, since Rust 1.64, all
*-linux-gnu*
targets have glibc requirements higher than glibc 2.16 thatgetauxval
added, and we can safely assumegetauxval
is linked to the binary.Related #655 (fyi @briansmith)
IIUC, at this time, we can do this on only
*-linux-gnu*
targets, because:*-linux-musl*
, it seems thatgetauxval
is not always available, independent of version requirements: Undefined reference togetauxval
in functioninit_have_lse_atomics
when compiling to nightlyaarch64-unknown-linux-musl
rust#89626getauxval
is used on the C/C++ side).*-android*
, according to auxv crate,getauxval
is available for android 4.3 or later, but the Android API requirement for Rust is still 4.0 (Ice Cream Sandwich).getauxval
is always available.*-linux-*
targets (e.g.*-linux-uclibc*
), according to auxv crate,getauxval
is not available.Footnotes
On x86, we use cpuid instead of auxv. ↩