On Fri, May 8, 2020 at 12:58 AM Gerald Pfeifer <ger...@pfeifer.com> wrote:
>
> A user reported that gcc -m32 on x86-64 does not define __ILP32__
> and I found the same on i686 (with gcc -x c -dM -E /dev/null).
>
> The code has
>
>       if (TARGET_X32)
>         {
>           cpp_define (parse_in, "_ILP32");
>           cpp_define (parse_in, "__ILP32__");
>         }
>
> so -mx32 does define __ILP32__.
>
> This patch does the same for all "regular" 32-bit x86 targets.
> Tested on i386-unknown-freebsd11.3 so far.
>
> Okay?

OK.

Thanks,
Uros.

> Gerald
>
>
>         * config/i386/i386-c.c (ix86_target_macros): Define _ILP32 and
>         __ILP32__ for 32-bit targets.
> ---
>  gcc/config/i386/i386-c.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
> index b46ebb289d2..891b2c68372 100644
> --- a/gcc/config/i386/i386-c.c
> +++ b/gcc/config/i386/i386-c.c
> @@ -701,6 +701,8 @@ ix86_target_macros (void)
>        cpp_assert (parse_in, "cpu=i386");
>        cpp_assert (parse_in, "machine=i386");
>        builtin_define_std ("i386");
> +      cpp_define (parse_in, "_ILP32");
> +      cpp_define (parse_in, "__ILP32__");
>      }
>
>    if (!TARGET_80387)
> --
> 2.26.2

Reply via email to