about summary refs log tree commit diff
path: root/library/std/src/sys/unix/weak.rs
AgeCommit message (Collapse)AuthorLines
2022-12-30Replace libstd, libcore, liballoc in docs.jonathanCogan-4/+3
2022-12-28Update bootstrap cfgPietro Albini-45/+1
2022-12-05Reimplement weak! using Option.Peter Collingbourne-1/+36
2022-04-17Replace sys/unix/weak AtomicUsize with AtomicPtrCAD97-17/+15
2022-01-19Fix CVE-2022-21658 for UNIX-likeHans Kratz-2/+4
2021-12-14Fix a bunch of typosFrank Steffahn-1/+1
2021-11-12Refactor weak symbols in std::sys::unixJosh Stone-21/+81
This makes a few changes to the weak symbol macros in `sys::unix`: - `dlsym!` is added to keep the functionality for runtime `dlsym` lookups, like for `__pthread_get_minstack@GLIBC_PRIVATE` that we don't want to show up in ELF symbol tables. - `weak!` now uses `#[linkage = "extern_weak"]` symbols, so its runtime behavior is just a simple null check. This is also used by `syscall!`. - On non-ELF targets (macos/ios) where that linkage is not known to behave, `weak!` is just an alias to `dlsym!` for the old behavior. - `raw_syscall!` is added to always call `libc::syscall` on linux and android, for cases like `clone3` that have no known libc wrapper. The new `weak!` linkage does mean that you'll get versioned symbols if you build with a newer glibc, like `WEAK DEFAULT UND statx@GLIBC_2.28`. This might seem problematic, but old non-weak symbols can tie the build to new versions too, like `dlsym@GLIBC_2.34` from their recent library unification. If you build with an old glibc like `dist-x86_64-linux` does, you'll still get unversioned `WEAK DEFAULT UND statx`, which may be resolved based on the runtime glibc. I also found a few functions that don't need to be weak anymore: - Android can directly use `ftruncate64`, `pread64`, and `pwrite64`, as these were added in API 12, and our baseline is API 14. - Linux can directly use `splice`, added way back in glibc 2.5 and similarly old musl. Android only added it in API 21 though.
2021-08-01bump bootstrap compiler to 1.55Pietro Albini-5/+0
2021-07-10Change `weak!` and `linkat!` to macros 2.0Aris Merchant-3/+10
`weak!` is needed in a test in another module. With macros 1.0, importing `weak!` would require reordering module declarations in `std/src/lib.rs`, which is a bit too evil.
2021-01-13Update code to account for extern ABI requirementMark Rousskov-1/+1
2020-11-20unix/weak: pass arguments to syscall at the given typeRalf Jung-1/+1
2020-11-18Rollup merge of #79039 - thomcc:weakly-relaxing, r=AmanieuMara Bos-6/+40
Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak This moves reading this from multiple SeqCst reads to Relaxed read + Acquire fence if we are actually going to use the data. Would love to avoid the Acquire fence, but doing so would need Ordering::Consume, which neither Rust, nor LLVM supports (a shame, since this fence is hardly free on ARM, which is what I was hoping to improve). r? ``@Amanieu`` (Sorry for always picking you, but I know a lot of people wouldn't feel comfortable reviewing atomic ordering changes)
2020-11-16Try weak symbols for all linux syscall! wrappersJosh Stone-16/+7
2020-11-16linux: try to use libc getrandom to allow interpositionJosh Stone-2/+19
We'll try to use a weak `getrandom` symbol first, because that allows things like `LD_PRELOAD` interposition. For example, perf measurements might want to disable randomness to get reproducible results. If the weak symbol is not found, we fall back to a raw `SYS_getrandom` call.
2020-11-13Tighten the bounds on atomic Ordering in std::sys::unix::weakThom Chiovoloni-6/+40
2020-07-27mv std libs to library/mark-0/+101