Use the zx_cprng_draw system call directly rather than going
through the libc getentropy function. The libc function is a
trivial wrapper around the system call, and is not a standard C
function. Avoiding it reduces the Fuchsia libc ABI surface that
libc++ depends on.
Details
- Reviewers
phosek ldionne - Group Reviewers
Restricted Project - Commits
- rG3064dd8ccffc: [libcxx] Use Fuchsia-native CPRNG for std::random_device
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libcxx/src/random.cpp | ||
---|---|---|
188 | This pragma is magic. It leaves a breadcrumb in the .o and the linker will pick it up automatically? On what platforms does this work? |
libcxx/src/random.cpp | ||
---|---|---|
188 | Correct. The pragma syntax comes from MSVC and works there and in Clang on PE-COFF and ELF formats. The ELF linker magic it uses is only supported by lld last I checked (it emits an extra non-allocated section that other linkers would just ignore). For Fuchsia, we are fine assuming that current Clang and LLD are the only tools used. |
libcxx/src/random.cpp | ||
---|---|---|
188 | This is pretty awesome, we could use that for mach-o as well. |
LGTM
This pragma is magic. It leaves a breadcrumb in the .o and the linker will pick it up automatically?
On what platforms does this work?