aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-10-20 12:47:07 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2023-01-05 14:38:51 -0500
commit8b35ed1febd786c7aec34bbd7080c73a7c91bfca (patch)
treeca39491788734538b4d8cfbb6547cc466738ff81 /gdbsupport
parent2b16913cdca20ae1dafdbd816b025a6efdc6c06f (diff)
downloadgdb-8b35ed1febd786c7aec34bbd7080c73a7c91bfca.zip
gdb-8b35ed1febd786c7aec34bbd7080c73a7c91bfca.tar.gz
gdb-8b35ed1febd786c7aec34bbd7080c73a7c91bfca.tar.bz2
gdbsupport: move libxxhash configure check to gdbsupport
The following patch moves the fast_hash function, which uses libxxhash, to gdbsupport. Move the libxxhash configure check to gdbsupport (and transitively to gdbserver). Change-Id: I242499e50c8cd6fe9f51e6e92dc53a1b3daaa96e Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/Makefile.in3
-rw-r--r--gdbsupport/common.m424
-rw-r--r--gdbsupport/config.in3
-rwxr-xr-xgdbsupport/configure514
4 files changed, 544 insertions, 0 deletions
diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
index 6aadae4..6db7644 100644
--- a/gdbsupport/Makefile.in
+++ b/gdbsupport/Makefile.in
@@ -254,6 +254,7 @@ GMSGFMT = @GMSGFMT@
GREP = @GREP@
HAVE_CXX11 = @HAVE_CXX11@
HAVE_LIBIPT = @HAVE_LIBIPT@
+HAVE_LIBXXHASH = @HAVE_LIBXXHASH@
INCINTL = @INCINTL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -268,8 +269,10 @@ LIBINTL_DEP = @LIBINTL_DEP@
LIBIPT = @LIBIPT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBXXHASH = @LIBXXHASH@
LTLIBIPT = @LTLIBIPT@
LTLIBOBJS = @LTLIBOBJS@
+LTLIBXXHASH = @LTLIBXXHASH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index 7b10026..c6b9a25 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -215,6 +215,30 @@ AC_DEFUN([GDB_AC_COMMON], [
BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
fi
+
+ dnl xxhash support
+ # Check for xxhash
+ AC_ARG_WITH(xxhash,
+ AS_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
+ [], [with_xxhash=auto])
+
+ if test "x$with_xxhash" != "xno"; then
+ AC_LIB_HAVE_LINKFLAGS([xxhash], [],
+ [#include <xxhash.h>],
+ [XXH32("foo", 3, 0);
+ ])
+ if test "$HAVE_LIBXXHASH" != yes; then
+ if test "$with_xxhash" = yes; then
+ AC_MSG_ERROR([xxhash is missing or unusable])
+ fi
+ fi
+ if test "x$with_xxhash" = "xauto"; then
+ with_xxhash="$HAVE_LIBXXHASH"
+ fi
+ fi
+
+ AC_MSG_CHECKING([whether to use xxhash])
+ AC_MSG_RESULT([$with_xxhash])
])
dnl Check that the provided value ($1) is either "yes" or "no". If not,
diff --git a/gdbsupport/config.in b/gdbsupport/config.in
index 577866c..2cdc1fb 100644
--- a/gdbsupport/config.in
+++ b/gdbsupport/config.in
@@ -124,6 +124,9 @@
/* Define if you have the ipt library. */
#undef HAVE_LIBIPT
+/* Define if you have the xxhash library. */
+#undef HAVE_LIBXXHASH
+
/* Define to 1 if you have the <linux/elf.h> header file. */
#undef HAVE_LINUX_ELF_H
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 38541e8..a0e4a3f 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -631,6 +631,9 @@ HAVE_PIPE_OR_PIPE2_FALSE
HAVE_PIPE_OR_PIPE2_TRUE
SELFTEST_FALSE
SELFTEST_TRUE
+LTLIBXXHASH
+LIBXXHASH
+HAVE_LIBXXHASH
LTLIBIPT
LIBIPT
HAVE_LIBIPT
@@ -776,6 +779,9 @@ with_gnu_ld
enable_rpath
with_libipt_prefix
with_libipt_type
+with_xxhash
+with_libxxhash_prefix
+with_libxxhash_type
enable_unit_tests
enable_werror
enable_build_warnings
@@ -1442,6 +1448,10 @@ Optional Packages:
--with-libipt-prefix[=DIR] search for libipt in DIR/include and DIR/lib
--without-libipt-prefix don't search for libipt in includedir and libdir
--with-libipt-type=TYPE type of library to search for (auto/static/shared)
+ --with-xxhash use libxxhash for hashing (faster) (auto/yes/no)
+ --with-libxxhash-prefix[=DIR] search for libxxhash in DIR/include and DIR/lib
+ --without-libxxhash-prefix don't search for libxxhash in includedir and libdir
+ --with-libxxhash-type=TYPE type of library to search for (auto/static/shared)
Some influential environment variables:
CC C compiler command
@@ -9963,6 +9973,510 @@ $as_echo "$bfd_cv_have_sys_procfs_type_elf_fpregset_t" >&6; }
fi
+ # Check for xxhash
+
+# Check whether --with-xxhash was given.
+if test "${with_xxhash+set}" = set; then :
+ withval=$with_xxhash;
+else
+ with_xxhash=auto
+fi
+
+
+ if test "x$with_xxhash" != "xno"; then
+
+
+
+
+
+
+
+
+ use_additional=yes
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+
+# Check whether --with-libxxhash-prefix was given.
+if test "${with_libxxhash_prefix+set}" = set; then :
+ withval=$with_libxxhash_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/lib"
+ fi
+ fi
+
+fi
+
+
+# Check whether --with-libxxhash-type was given.
+if test "${with_libxxhash_type+set}" = set; then :
+ withval=$with_libxxhash_type; with_libxxhash_type=$withval
+else
+ with_libxxhash_type=auto
+fi
+
+ lib_type=`eval echo \$with_libxxhash_type`
+
+ LIBXXHASH=
+ LTLIBXXHASH=
+ INCXXHASH=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='xxhash '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ elif test x$lib_type != xshared; then
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBXXHASH; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ elif test x$lib_type != xshared; then
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$hardcode_direct" = yes; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBXXHASH; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$found_so"
+ else
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$found_a"
+ else
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */lib | */lib/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCXXHASH; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCXXHASH="${INCXXHASH}${INCXXHASH:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/lib"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/lib"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBXXHASH; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBXXHASH; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$dep"
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-l$name"
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }-l$name"
+ else
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }-l:lib$name.$libext"
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }-l:lib$name.$libext"
+ fi
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBXXHASH="${LIBXXHASH}${LIBXXHASH:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBXXHASH="${LTLIBXXHASH}${LTLIBXXHASH:+ }-R$found_dir"
+ done
+ fi
+
+
+ ac_save_CPPFLAGS="$CPPFLAGS"
+
+ for element in $INCXXHASH; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxxhash" >&5
+$as_echo_n "checking for libxxhash... " >&6; }
+if ${ac_cv_libxxhash+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBXXHASH"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <xxhash.h>
+int
+main ()
+{
+XXH32("foo", 3, 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_libxxhash=yes
+else
+ ac_cv_libxxhash=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ac_save_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libxxhash" >&5
+$as_echo "$ac_cv_libxxhash" >&6; }
+ if test "$ac_cv_libxxhash" = yes; then
+ HAVE_LIBXXHASH=yes
+
+$as_echo "#define HAVE_LIBXXHASH 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libxxhash" >&5
+$as_echo_n "checking how to link with libxxhash... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBXXHASH" >&5
+$as_echo "$LIBXXHASH" >&6; }
+ else
+ HAVE_LIBXXHASH=no
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBXXHASH=
+ LTLIBXXHASH=
+ fi
+
+
+
+
+
+
+ if test "$HAVE_LIBXXHASH" != yes; then
+ if test "$with_xxhash" = yes; then
+ as_fn_error $? "xxhash is missing or unusable" "$LINENO" 5
+ fi
+ fi
+ if test "x$with_xxhash" = "xauto"; then
+ with_xxhash="$HAVE_LIBXXHASH"
+ fi
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use xxhash" >&5
+$as_echo_n "checking whether to use xxhash... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_xxhash" >&5
+$as_echo "$with_xxhash" >&6; }
+
# Check whether we will enable the inclusion of unit tests when
# compiling GDB.