about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-24 06:11:51 +0000
committerbors <bors@rust-lang.org>2023-10-24 06:11:51 +0000
commit6eb3e97d5549f81bbdb8a5e94a005a338bc284ec (patch)
tree2e40f46ee1ba861d99dcb49dc6b7d5d2b4f2cc08 /compiler/rustc_codegen_gcc/tests
parente918db897df677d9bbda64d82ebbb8f1bc9e557f (diff)
parent090e9de5708388a21d66adbec91c871a48ac355e (diff)
downloadrust-6eb3e97d5549f81bbdb8a5e94a005a338bc284ec.tar.gz
rust-6eb3e97d5549f81bbdb8a5e94a005a338bc284ec.zip
Auto merge of #116319 - BlackHoleFox:apple-rand-take-2, r=thomcc
Remove Apple RNG fallbacks and simplify implementation

Now that we have [higher Apple platform requirements](https://github.com/rust-lang/rust/pull/104385), the RNG code can be simplified a lot. Since `getentropy` still doesn't look to be usable outside macOS this implementation:
- Removes any macOS fallback paths and unconditionally links to `getentropy`
- Minimizes the implementation for everything else (iOS, watchOS, etc).

`CCRandomGenerateBytes` was added in iOS 8 which means that we can use it now. It and `SecRandomCopyBytes` have the exact same functionality, but the former has a simpler API and no longer requires libstd to link to `Security.framework` for one function. Its also available in all the other target's SDKs.

Why care about `getentropy` then though on macOS? Well, its still much more performant. Benchmarking shows it runs at ~2x the speed of `CCRandomGenerateBytes`, which makes sense since it directly pulls from the kernel vs going through its own generator etc.

Semi-related to a previous, but reverted, attempt at improving this logic in https://github.com/rust-lang/rust/pull/101011
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests')
0 files changed, 0 insertions, 0 deletions