rust/library/std/src/sys
Arlie Davis f4debc8e94 Resolve DLL imports at CRT startup, not on demand
On Windows, libstd uses GetProcAddress to locate some DLL imports, so
that libstd can run on older versions of Windows. If a given DLL import
is not present, then libstd uses other behavior (such as fallback
implementations).

This commit uses a feature of the Windows CRT to do these DLL imports
during module initialization, before main() (or DllMain()) is called.
This is the ideal time to resolve imports, because the module is
effectively single-threaded at that point; no other threads can
touch the data or code of the module that is being initialized.

This avoids several problems. First, it makes the cost of performing
the DLL import lookups deterministic. Right now, the DLL imports are
done on demand, which means that application threads _might_ have to
do the DLL import during some time-sensitive operation. This is a
small source of unpredictability. Since threads can race, it's even
possible to have more than one thread running the same redundant
DLL lookup.

This commit also removes using the heap to allocate strings, during
the DLL lookups.
2021-01-29 10:41:49 -08:00
..
hermit deprecate atomic::spin_loop_hint in favour of hint::spin_loop 2021-01-13 16:30:29 +10:00
sgx deprecate atomic::spin_loop_hint in favour of hint::spin_loop 2021-01-13 16:30:29 +10:00
unix Add setgroups to std::os::unix::process::CommandExt 2021-01-21 22:42:38 -08:00
unsupported Disambiguate symlink argument names 2020-11-14 14:46:14 -08:00
vxworks Take some of sys/vxworks/process/* from sys/unix instead. 2020-10-16 06:22:05 +02:00
wasi std: Update wasi-libc commit of the wasm32-wasi target 2021-01-14 10:40:10 -08:00
wasm Rollup merge of #78138 - fortanix:raoul/dlmalloc0.2, r=Mark-Simulacrum 2020-11-17 10:06:16 +01:00
windows Resolve DLL imports at CRT startup, not on demand 2021-01-29 10:41:49 -08:00
mod.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00