libstdc++: Prefer to use mmap instead of malloc in libbacktrace
authorJonathan Wakely <jwakely@redhat.com>
Tue, 12 Apr 2022 16:56:45 +0000 (17:56 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 12 Apr 2022 21:38:31 +0000 (22:38 +0100)
commit3c742621ed28540cf42d4cfbc2bf03433cd26738
treefb0b6e89fda4b8eeffd65d81304b4e118691e188
parentb2c007b87dcd5db5d59447de2081777aea66f35f
libstdc++: Prefer to use mmap instead of malloc in libbacktrace

As reported in PR libbacktrace/105240, libbacktrace leaks memory when
using malloc for allocations. I originally thought it would be simpler
to just use malloc unconditionally (because it's supported on all
targets) but the leaks make that problematic.

This adds libbacktrace's detection for mmap to the libstdc++
configury, so that we use mmap.c and mmapio.c when possible. This avoids
the leaks seen previously, at least on linux.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Check for mmap.
* config.h.in: Regenerate.
* configure: Regenerate.
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/configure