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).

Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP to avoid the sanitizer
configure check failure.

bfd/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

binutils/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

ld/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

libctf/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

libsframe/

	* configure.ac: Replace AC_FUNC_MMAP with GCC_AC_FUNC_MMAP.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
This commit is contained in:
H.J. Lu 2024-04-09 06:43:36 -07:00
parent 219822fd5d
commit 303da223b1
20 changed files with 40 additions and 9 deletions

View File

@ -125,7 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
$(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/mmap.m4 $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \

1
bfd/aclocal.m4 vendored
View File

@ -1180,6 +1180,7 @@ m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/mmap.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
m4_include([../config/pkg.m4])

5
bfd/configure vendored
View File

@ -17332,6 +17332,9 @@ done
save_ASAN_OPTIONS="$ASAN_OPTIONS"
ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS
for ac_func in getpagesize
do :
@ -17510,6 +17513,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
ASAN_OPTIONS="$save_ASAN_OPTIONS"
for ac_func in madvise mprotect
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`

View File

@ -1029,7 +1029,7 @@ AC_MSG_RESULT($bfd_file_ptr)
AC_SUBST(bfd_file_ptr)
AC_SUBST(bfd_ufile_ptr)
AC_FUNC_MMAP
GCC_AC_FUNC_MMAP
AC_CHECK_FUNCS(madvise mprotect)
case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
true+yes ) AC_DEFINE(USE_MMAP, 1, [Use mmap if it's available?]) ;;

View File

@ -152,7 +152,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
$(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/mmap.m4 $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \

1
binutils/aclocal.m4 vendored
View File

@ -1200,6 +1200,7 @@ m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/mmap.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
m4_include([../config/pkg.m4])

5
binutils/configure vendored
View File

@ -15231,6 +15231,9 @@ done
save_ASAN_OPTIONS="$ASAN_OPTIONS"
ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS
for ac_func in getpagesize
do :
@ -15409,6 +15412,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
ASAN_OPTIONS="$save_ASAN_OPTIONS"
for ac_func in fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`

View File

@ -199,7 +199,7 @@ AC_SUBST(DEMANGLER_NAME)
AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h \
sys/stat.h sys/time.h sys/types.h unistd.h)
AC_HEADER_SYS_WAIT
AC_FUNC_MMAP
GCC_AC_FUNC_MMAP
AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes)
AC_MSG_CHECKING([for mbstate_t])

View File

@ -126,7 +126,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
$(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/mmap.m4 $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/pkg.m4 \
$(top_srcdir)/../config/plugins.m4 \

1
ld/aclocal.m4 vendored
View File

@ -1202,6 +1202,7 @@ m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/mmap.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
m4_include([../config/pkg.m4])

5
ld/configure vendored
View File

@ -18802,6 +18802,9 @@ done
save_ASAN_OPTIONS="$ASAN_OPTIONS"
ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS
for ac_func in getpagesize
do :
@ -18980,6 +18983,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
ASAN_OPTIONS="$save_ASAN_OPTIONS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }

View File

@ -401,7 +401,7 @@ BFD_BINARY_FOPEN
AC_CHECK_DECLS([asprintf, environ, stpcpy])
AC_FUNC_MMAP
GCC_AC_FUNC_MMAP
AC_SEARCH_LIBS([dlopen], [dl])

View File

@ -145,7 +145,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/lib-ld.m4 \
$(top_srcdir)/../config/lib-link.m4 \
$(top_srcdir)/../config/lib-prefix.m4 \
$(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/mmap.m4 $(top_srcdir)/../config/nls.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/po.m4 \
$(top_srcdir)/../config/progtest.m4 \

1
libctf/aclocal.m4 vendored
View File

@ -1240,6 +1240,7 @@ m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
m4_include([../config/mmap.m4])
m4_include([../config/nls.m4])
m4_include([../config/override.m4])
m4_include([../config/po.m4])

5
libctf/configure vendored
View File

@ -15989,6 +15989,9 @@ done
save_ASAN_OPTIONS="$ASAN_OPTIONS"
ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS
for ac_func in getpagesize
do :
@ -16167,6 +16170,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
ASAN_OPTIONS="$save_ASAN_OPTIONS"
# Needed for BFD capability checks.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
$as_echo_n "checking for library containing dlsym... " >&6; }

View File

@ -65,7 +65,7 @@ AM_MAINTAINER_MODE
AM_INSTALL_LIBBFD
ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
AC_FUNC_MMAP
GCC_AC_FUNC_MMAP
# Needed for BFD capability checks.
AC_SEARCH_LIBS(dlsym, dl)
AM_ZLIB

View File

@ -126,6 +126,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/jobserver.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/mmap.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/warnings.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \

View File

@ -1233,6 +1233,7 @@ m4_include([../config/dejagnu.m4])
m4_include([../config/depstand.m4])
m4_include([../config/jobserver.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/mmap.m4])
m4_include([../config/override.m4])
m4_include([../config/warnings.m4])
m4_include([../libtool.m4])

5
libsframe/configure vendored
View File

@ -12520,6 +12520,9 @@ done
save_ASAN_OPTIONS="$ASAN_OPTIONS"
ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS
for ac_func in getpagesize
do :
@ -12698,6 +12701,8 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h
fi
rm -f conftest.mmap conftest.txt
ASAN_OPTIONS="$save_ASAN_OPTIONS"
for ac_header in byteswap.h endian.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`

View File

@ -112,7 +112,7 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
AM_MAINTAINER_MODE
AM_INSTALL_LIBBFD
AC_FUNC_MMAP
GCC_AC_FUNC_MMAP
AC_CHECK_HEADERS(byteswap.h endian.h)
dnl Check for bswap_{16,32,64}