[v3,5/6] libc/sys/rtems/crt0.c: _arc4random_getentropy_fail should not return

Message ID 20260416210047.2198615-6-joel@rtems.org
State New
Headers
Series Newlib and Cygwin C23 stdbit.h Support |

Commit Message

Joel Sherrill April 16, 2026, 9 p.m. UTC
  GCC now detects that the stub did return. Added while (1) to
address the warning.
---
 newlib/libc/sys/rtems/crt0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Corinna Vinschen April 17, 2026, 11:29 a.m. UTC | #1
Hi Joel,

this patch doesn't really belong to this series, right?


Corinna


On Apr 16 16:00, Joel Sherrill wrote:
> GCC now detects that the stub did return. Added while (1) to
> address the warning.
> ---
>  newlib/libc/sys/rtems/crt0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
> index 67f9d7302..f9c5ab951 100644
> --- a/newlib/libc/sys/rtems/crt0.c
> +++ b/newlib/libc/sys/rtems/crt0.c
> @@ -73,7 +73,7 @@ RTEMS_STUB(void, _Libatomic_Unlock_n(void *ptr, __size_t n), { });
>  
>  /* Stubs for routines for arc4random (from <unistd.h> and <machine/_arc4random.h> */
>  RTEMS_STUB(int,  getentropy(void *ptr, __size_t n), { return -1; });
> -RTEMS_STUB(void, _arc4random_getentropy_fail(void), { });
> +RTEMS_STUB(void, _arc4random_getentropy_fail(void), { while(1) ; });
>  
>  #if defined(__GNUC__)
>  /*
> -- 
> 2.47.3
  

Patch

diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 67f9d7302..f9c5ab951 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -73,7 +73,7 @@  RTEMS_STUB(void, _Libatomic_Unlock_n(void *ptr, __size_t n), { });
 
 /* Stubs for routines for arc4random (from <unistd.h> and <machine/_arc4random.h> */
 RTEMS_STUB(int,  getentropy(void *ptr, __size_t n), { return -1; });
-RTEMS_STUB(void, _arc4random_getentropy_fail(void), { });
+RTEMS_STUB(void, _arc4random_getentropy_fail(void), { while(1) ; });
 
 #if defined(__GNUC__)
 /*