mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-07 17:00:19 +02:00
Fixes #2095 std::random_device can fail to find a random source and throw an assert during initialization. The constructor allows you to provide a token string to select an explicit random source, but this is c++ library specific and will still assert if the source isn't found. Also specific tokens are very much target and library specific, so it is unsafe to use. In the libstdc++ case, the default implementation will try to open `/dev/urandom` which might not be available on all targets. Instead of relying on this C++ object, use the `getrandom` syscall directly to generate our RNG used in the ELFCodeLoader. Resolves any sort of asserting case, blocks on RNG generation, and is guaranteed to be available since this syscall has been available since a very old kernel version.