[PATCH] libgcov: Fix build on Darwin [PR99406]

Iain Sandoe iain@sandoe-acoustics.co.uk
Fri Mar 5 16:19:47 GMT 2021


Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:

> As reported, bootstrap currently fails on older Darwin because  
> MAP_ANONYMOUS
> is not defined.
>
> The following is what gcc/system.h does, so I think it should work for
> libgcov.
> Build tested on x86_64-linux, ok for trunk?

bootstrap suceeded r11-7524 + this patch on Darwin11.
thanks,
Iain

>
> 2021-03-05  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR gcov-profile/99406
> 	* libgcov.h (MAP_FAILED, MAP_ANONYMOUS): If HAVE_SYS_MMAN_H is
> 	defined, define these macros if not defined already.
>
> --- libgcc/libgcov.h.jj	2021-03-04 19:36:52.931789790 +0100
> +++ libgcc/libgcov.h	2021-03-05 14:41:18.912291100 +0100
> @@ -172,6 +172,16 @@ extern struct gcov_info *gcov_list;
> #define ATTRIBUTE_HIDDEN
> #endif
>
> +#if HAVE_SYS_MMAN_H
> +#ifndef MAP_FAILED
> +#define MAP_FAILED ((void *)-1)
> +#endif
> +
> +#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
> +#define MAP_ANONYMOUS MAP_ANON
> +#endif
> +#endif
> +
> #include "gcov-io.h"
>
> /* Structures embedded in coveraged program.  The structures generated
>
> 	Jakub




More information about the Gcc-patches mailing list