https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109289
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #8 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to myself from comment #2)
> [...]/source-gcc/libgcc/emutls.c: In function ‘__emutls_get_address’:
> [...]/source-gcc/libgcc/emutls.c:172:13: error: implicit declaration of
> function ‘calloc’ [-Wimplicit-function-declaration]
> 172 | arr = calloc (size + 1, sizeof (void *));
> | ^~~~~~
> [...]/source-gcc/libgcc/emutls.c:32:1: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘calloc’
> 31 | #include "gthr.h"
> +++ |+#include <stdlib.h>
> 32 |
> [...]/source-gcc/libgcc/emutls.c:172:13: warning: incompatible implicit
> declaration of built-in function ‘calloc’ [-Wbuiltin-declaration-mismatch]
> 172 | arr = calloc (size + 1, sizeof (void *));
> | ^~~~~~
> [...]/source-gcc/libgcc/emutls.c:172:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘calloc’
> [...]/source-gcc/libgcc/emutls.c:184:13: error: implicit declaration of
> function ‘realloc’ [-Wimplicit-function-declaration]
> 184 | arr = realloc (arr, (size + 1) * sizeof (void *));
> | ^~~~~~~
> [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘realloc’
> [...]/source-gcc/libgcc/emutls.c:184:13: warning: incompatible implicit
> declaration of built-in function ‘realloc’ [-Wbuiltin-declaration-mismatch]
> [...]/source-gcc/libgcc/emutls.c:184:13: note: include ‘<stdlib.h>’ or
> provide a declaration of ‘realloc’
> GCC's suggestion to "include ‘<stdlib.h>’" needs to be carefully reviewed,
> in case this is meant to be buildable in an environment without C library
> headers?
(In reply to Florian Weimer from comment #3)
> Thomas, the safe thing to do would be to use __builtin_calloc and
> __builtin_realloc in those spots because it avoids a dependency on an
> external header that might not exist at this point.
That part got resolved differently, in commit
r14-6207-g6e84dafcc72d1cd6d028b42f1801e092a91d3214 "tsystem.h: Declare
calloc/realloc #ifdef inhibit_libc".