Subject: Re: bug#36649: 27.0.50; pure space and pdumper

From: Eli Zaretskii <[email-masked]>
Date: Wed, 19 May 2021 20:38:32 +0300

> Cc: [email-masked], [email-masked], [email-masked],
>  [email-masked], [email-masked]
> From: Paul Eggert <[email-masked]>
> Date: Wed, 19 May 2021 10:29:06 -0700
> 
> On 5/19/21 8:11 AM, Eli Zaretskii wrote:
> > Paul, if this kludge annoys you enough (I hope it will), please
> > suggest a cleaner way out of this conundrum.
> 
> configure.ac can define a macro that tells gmalloc.c about the kludge 
> situation, and gmalloc.c can refer to that macro to decide whether to 
> call rpl_free instead of plain 'free'.

The problem is not in gmalloc.c, the problem is in every src/*.c file
that calls 'free'.  That's because we redirect to hybrid_free in
conf_post.h, but Gnulib's stdlib.h is included after that, and it
undoes that redirection:

  #if @GNULIB_FREE_POSIX@
  # if @REPLACE_FREE@
  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  #   undef free
  #   define free rpl_free
  #  endif

Then the linker errors out due to unresolved externals, because
there's no rpl_free.

Would it work to add rpl_free to gmalloc.c, perhaps?

> Also, make sure that hybrid_free preserves errno.

If this is the best solution, then okay, will do.  I hoped something
cleaner could be possible.