[PATCH] add uClibc target hook (PR bootstrap/77819)

Bernd Schmidt bschmidt@redhat.com
Tue Oct 4 08:42:00 GMT 2016


On 10/03/2016 12:02 AM, Martin Sebor wrote:
> I couldn't find a good uclibc-only file where to put the new
> definition of the hook so I conditionally added it to
> targethooks.c.

> diff --git a/gcc/targhooks.c b/gcc/targhooks.c
> index d75650f..77b4a18 100644
> --- a/gcc/targhooks.c
> +++ b/gcc/targhooks.c
> @@ -1523,6 +1523,26 @@ default_printf_pointer_format (tree, const char **flags)
>    return "%zx";
>  }
>
> +#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */

I think DEFAULT_LIBC is defined only for linux targets, so this won't 
do. Just define unconditionally, with a declaration in targhooks.h?

> +const char*
> +uclibc_printf_pointer_format (tree arg, const char **flags)
> +{
> +  *flags = " +";
> +
> +  return arg && integer_zerop (arg) ? "(nil)" : "%#zx";
> +}

Then again, maybe also just move the hook from linux.c here, it appears 
identical.


Bernd



More information about the Gcc-patches mailing list