Some systems, such as Darwin, only declare getentropy in <sys/random.h>, so declare it there on WASI too for compatibility. Also, give getentropy the underscore-prefix/weak-symbol treatment, as it's not a standard-reserved identifier.
This incoporates pieces from musl-libc, cloudlibc, cloudabi, libpreopen, and dlmalloc, as well as a significant amount of new code.