+2021-03-19 Duncan Simpson <dr.duncan.p.simpson@gmail.com>
+
+ PR gold/26585
+ * configure.ac: Add check for mallinfo2.
+ * configure: Regenerate.
+ * main.cc (main): Use mallinfo2 if available.
+
2021-03-19 Cary Coutant <ccoutant@gmail.com>
PR gold/27246
esac
-for ac_func in mallinfo posix_fallocate fallocate readv sysconf times mkdtemp
+for ac_func in mallinfo mallinfo2 posix_fallocate fallocate readv sysconf times mkdtemp
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
esac
AC_SUBST(DLOPEN_LIBS)
-AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times mkdtemp)
+AC_CHECK_FUNCS(mallinfo mallinfo2 posix_fallocate fallocate readv sysconf times mkdtemp)
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
#include <cstdio>
#include <cstring>
-#ifdef HAVE_MALLINFO
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
#include <malloc.h>
#endif
elapsed.sys / 1000, (elapsed.sys % 1000) * 1000,
elapsed.wall / 1000, (elapsed.wall % 1000) * 1000);
-#ifdef HAVE_MALLINFO
+#if defined(HAVE_MALLINFO2)
+ struct mallinfo m = mallinfo2();
+ fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"),
+ program_name, static_cast<long long>(m.arena));
+#elif defined(HAVE_MALLINFO)
struct mallinfo m = mallinfo();
fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"),
program_name, static_cast<long long>(m.arena));
#endif
+
File_read::print_stats();
Archive::print_stats();
Lib_group::print_stats();