aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-04-09 06:39:21 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-04-10 03:57:02 -0700
commit219822fd5db6305592b45677a3b38c02b523360e (patch)
treebd623bf325da7ee47240e38443cac7100936a20b /libiberty
parentbdefc073061ff9e9334a1306e9c70745104dc57f (diff)
downloadgdb-219822fd5db6305592b45677a3b38c02b523360e.zip
gdb-219822fd5db6305592b45677a3b38c02b523360e.tar.gz
gdb-219822fd5db6305592b45677a3b38c02b523360e.tar.bz2
mmap: Avoid the sanitizer configure check failure
When -fsanitize=address,undefined is used to build, the mmap configure check failed with ================================================================= ==231796==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239 Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190 SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s). Define GCC_AC_FUNC_MMAP with export ASAN_OPTIONS=detect_leaks=0 to avoid the sanitizer configure check failure. config/ * mmap.m4 (GCC_AC_FUNC_MMAP): New. * no-executables.m4 (AC_FUNC_MMAP): Renamed to GCC_AC_FUNC_MMAP. Change AC_FUNC_MMAP to GCC_AC_FUNC_MMAP. libiberty/ * Makefile.in (aclocal_deps): Add $(srcdir)/../config/mmap.m4. * acinclude.m4: Change AC_FUNC_MMAP to GCC_AC_FUNC_MMAP. * aclocal.m4: Regenerated. * configure: Likewise. zlib/ * acinclude.m4: Include ../config/mmap.m4. * Makefile.in: Regenerated. * configure: Likewise.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/Makefile.in1
-rw-r--r--libiberty/acinclude.m42
-rw-r--r--libiberty/aclocal.m41
-rwxr-xr-xlibiberty/configure5
4 files changed, 8 insertions, 1 deletions
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 85c4b6b..b77a41c 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -508,6 +508,7 @@ aclocal_deps = \
$(srcdir)/../config/cet.m4 \
$(srcdir)/../config/enable.m4 \
$(srcdir)/../config/gcc-plugin.m4 \
+ $(srcdir)/../config/mmap.m4 \
$(srcdir)/../config/no-executables.m4 \
$(srcdir)/../config/override.m4 \
$(srcdir)/../config/picflag.m4 \
diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4
index 9974dcd..d08e31b 100644
--- a/libiberty/acinclude.m4
+++ b/libiberty/acinclude.m4
@@ -19,7 +19,7 @@ dnl On some versions of SunOS4 at least, strncmp reads a word at a time
dnl but erroneously reads past the end of strings. This can cause
dnl a SEGV in some cases.
AC_DEFUN([libiberty_AC_FUNC_STRNCMP],
-[AC_REQUIRE([AC_FUNC_MMAP])
+[AC_REQUIRE([GCC_AC_FUNC_MMAP])
AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
[AC_TRY_RUN([
/* Test by Jim Wilson and Kaveh Ghazi.
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index 364fb6b..9678b0a 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -17,6 +17,7 @@ m4_include([../config/cet.m4])
m4_include([../config/enable.m4])
m4_include([../config/gcc-plugin.m4])
m4_include([../config/hwcaps.m4])
+m4_include([../config/mmap.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])
m4_include([../config/picflag.m4])
diff --git a/libiberty/configure b/libiberty/configure
index 5c69fee..18e98b8 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -7724,6 +7724,9 @@ if test x$gcc_no_link = xyes; then
fi
fi
if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then
+ save_ASAN_OPTIONS="$ASAN_OPTIONS"
+ ASAN_OPTIONS=detect_leaks=0
+ export ASAN_OPTIONS
for ac_func in getpagesize
do :
@@ -7902,6 +7905,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
+ ASAN_OPTIONS="$save_ASAN_OPTIONS"
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strncmp" >&5