newlib icon indicating copy to clipboard operation
newlib copied to clipboard

Add stub for getentropy syscall

Open noxrim opened this issue 1 year ago • 0 comments

Currently calling getentropy (and by extension arc4random) causes a link error because the reentrant version is not present in libc, with this change it should at least compile now

$ cat test.c
#include <unistd.h>

int main(void) {
    getentropy(NULL, 0);
}
$ /opt/devkitpro/devkitPPC/bin/powerpc-eabi-gcc test.c
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/14.2.0/../../../../powerpc-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 018000b8
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/14.2.0/../../../../powerpc-eabi/bin/ld: /opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/14.2.0/../../../../powerpc-eabi/lib/libc.a(libc_a-sysgetentropy.o): in function `getentropy':
(.text.getentropy+0x3c): undefined reference to `_getentropy_r'
collect2: error: ld returned 1 exit status

noxrim avatar Jan 08 '25 17:01 noxrim