aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorAaron Merey <amerey@redhat.com>2020-01-09 13:19:20 +0000
committerNick Clifton <nickc@redhat.com>2020-01-09 13:19:20 +0000
commit301a9420d947da145884261ac31a7a52438c2894 (patch)
treefb30bb433561f4887f14f356b4802c400939ad7a /configure
parent40c75bc8b07abc5d5774ea1c439b69c96e7fd485 (diff)
downloadgdb-301a9420d947da145884261ac31a7a52438c2894.zip
gdb-301a9420d947da145884261ac31a7a52438c2894.tar.gz
gdb-301a9420d947da145884261ac31a7a52438c2894.tar.bz2
Add support for debuginfod to the binutils (disable by default, enabled via a configure time option).
debuginfod is a lightweight web service that indexes ELF/DWARF debugging resources by build-id and serves them over HTTP. This patch enables objdump and readelf to query debuginfod servers when they are otherwise not able to find separate debug files. Binutils can be built with debuginfod using the --with-debuginfod configure option. This requires that libdebuginfod be installed and found at configure time. debuginfod is packaged with elfutils, starting with version 0.178. For more information see https://sourceware.org/elfutils/. toplevel* config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds new configure option --with-debuginfod. * configure: Regenerate. * configure.ac: Call AC_DEBUGINFOD. binutils* Makefile.am (readelf_LDADD, objdump_LDADD): Add libdebuginfod. * Makefile.in: Regenerate. * NEWS: Update. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Call AC_DEBUGINFOD. * doc/Makefile.in: Regenerate. * doc/binutils.texi: Add section on using binutils with debuginfod. * dwarf.c (debuginfod_fetch_separate_debug_info): New function. Query debuginfod servers for the target debug file. (load_separate_debug_info): Call debuginfod_fetch_separate_debug_info if configured with debuginfod. (load_separate_debug_files): Add file argument to load_separate_debug_info calls. * dwarf.h (get_build_id): Add declaration. * objdump.c (get_build_id): New function. Get build-id of file. * readelf.c (get_build_id): Likewise. * testsuite/binutils-all/debuginfod.exp: New tests. * testsuite/binutils-all/linkdebug.s: Add .note.gnu.build-id section.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure139
1 files changed, 137 insertions, 2 deletions
diff --git a/configure b/configure
index 6a9719f..e02123c 100755
--- a/configure
+++ b/configure
@@ -690,6 +690,7 @@ extra_mpc_gmp_configure_flags
extra_mpfr_configure_flags
gmpinc
gmplibs
+LIBDEBUGINFOD
do_compare
GNATMAKE
GNATBIND
@@ -790,6 +791,7 @@ enable_libssp
enable_libstdcxx
enable_liboffloadmic
enable_bootstrap
+with_debuginfod
with_mpc
with_mpc_include
with_mpc_lib
@@ -1553,6 +1555,8 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-system-zlib use installed libz
+ --with-debuginfod Enable debuginfo lookups with debuginfod
+ (auto/yes/no)
--with-mpc=PATH specify prefix directory for installed MPC package.
Equivalent to --with-mpc-include=PATH/include plus
--with-mpc-lib=PATH/lib
@@ -1921,6 +1925,52 @@ fi
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -5433,6 +5483,92 @@ gmplibs="-lmpc -lmpfr -lgmp"
gmpinc=
have_gmp=no
+# Check for debuginfod
+
+
+# Enable debuginfod
+
+# Check whether --with-debuginfod was given.
+if test "${with_debuginfod+set}" = set; then :
+ withval=$with_debuginfod;
+else
+ with_debuginfod=auto
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debuginfod" >&5
+$as_echo_n "checking whether to use debuginfod... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
+$as_echo "$with_debuginfod" >&6; }
+
+if test "${with_debuginfod}" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
+else
+ ac_cv_lib_debuginfod_debuginfod_begin=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_debuginfod_lib=yes
+fi
+
+ ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
+"
+if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
+ have_debuginfod_h=yes
+fi
+
+ if test "x$have_debuginfod_lib" = "xyes" -a \
+ "x$have_debuginfod_h" = "xyes"; then
+
+$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
+
+ LIBDEBUGINFOD="-ldebuginfod"
+
+ else
+
+ if test "$with_debuginfod" = yes; then
+ as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
+ fi
+ fi
+fi
+
+
# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
@@ -5587,8 +5723,7 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
# Check for the recommended and required versions of GMP.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of gmp.h" >&5
$as_echo_n "checking for the correct version of gmp.h... " >&6; }
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
int