https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98733
--- Comment #1 from Timm Bäder <tbaeder at redhat dot com> --- I looked into this problem again and I think a potential fix could be as easy as... commit b95eed1938403874be927d4c25b8bbf88ed686ce (HEAD -> master) Author: Timm Bäder <tbae...@redhat.com> Date: Mon May 10 09:33:26 2021 +0200 libiberty: Check for asprintf/snprintf macros asprintf and snprintf might be defined as a macro, in which case the declarations in libiberty.h should be omitted. This is in particular true for compilers that do not support __va_arg_pack(). diff --git a/include/libiberty.h b/include/libiberty.h index f4c0fe11d6f..51a5bf91219 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -648,7 +648,7 @@ extern void *bsearch_r (const void *, const void *, int (*)(const void *, const void *, void *), void *); -#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF +#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF && !defined(asprintf) /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ @@ -672,7 +672,7 @@ extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0); extern char *xvasprintf (const char *, va_list) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF(1,0); -#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF +#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF && !defined(snprintf) /* Like sprintf but prints at most N characters. */ extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3; #endif Does that seem like a sensible thing to do on the GCC side?