rust/library/std/src/sys/unix/process
Josh Stone 5ff6ac4287 Refactor weak symbols in std::sys::unix
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-11-12 15:25:16 -08:00
..
process_common Avoid overlapping cfg attributes when both macOS and aarch64 2020-11-08 09:43:51 -05:00
process_unix Tolerate SIGTRAP for panic abort after panic::always_abort 2021-05-13 18:42:52 +01:00
mod.rs STD support for the ESP-IDF framework 2021-08-10 12:09:00 +03:00
process_common.rs Manual Debug for Unix ExitCode ExitStatus ExitStatusError 2021-08-24 19:24:07 +01:00
process_fuchsia.rs Provide ExitStatusError 2021-05-12 11:12:19 +01:00
process_unix.rs Refactor weak symbols in std::sys::unix 2021-11-12 15:25:16 -08:00
process_unsupported.rs STD support for the ESP-IDF framework 2021-08-10 12:09:00 +03:00
process_vxworks.rs Add ExitStatusError for vxworks 2021-05-20 01:34:06 +02:00
zircon.rs [fuchsia] Update process info struct 2021-10-15 10:40:39 -07:00