forked from Imagelibrary/binutils-gdb
Sync libbacktrace from gcc [PR31327]
Note that this includes Nick's fix from edf64cd235 which
landed upstream a bit differently as r13-1566-g9ed57796235abc in GCC.
This pulls in libbacktrace as of r14-9404-gc775a030af9cad in GCC trunk.
Note that I have dropped a top-level Darwin change from r14-4825-g6a6d3817afa02b
which would've required an autoreconf, as it should be handled separately.
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# configure.ac -- Backtrace configure script.
|
||||
# Copyright (C) 2012-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
@@ -145,10 +145,10 @@ ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
|
||||
-Wmissing-format-attribute -Wcast-qual],
|
||||
[WARN_FLAGS])
|
||||
|
||||
if test -n "${with_target_subdir}"; then
|
||||
WARN_FLAGS="$WARN_FLAGS -Werror"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
[AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
|
||||
AS_IF([test "x$enable_werror" != "xno" && test -n "${with_target_subdir}"],
|
||||
[WARN_FLAGS="$WARN_FLAGS -Werror"])
|
||||
AC_SUBST(WARN_FLAGS)
|
||||
|
||||
if test -n "${with_target_subdir}"; then
|
||||
@@ -335,13 +335,17 @@ fi
|
||||
AC_SUBST(BACKTRACE_USES_MALLOC)
|
||||
|
||||
# Check for dl_iterate_phdr.
|
||||
AC_CHECK_HEADERS(link.h)
|
||||
if test "$ac_cv_header_link_h" = "no"; then
|
||||
AC_CHECK_HEADERS(link.h sys/link.h)
|
||||
if test "$ac_cv_header_link_h" = "no" -a "$ac_cv_header_sys_link_h" = "no"; then
|
||||
have_dl_iterate_phdr=no
|
||||
else
|
||||
if test -n "${with_target_subdir}"; then
|
||||
link_h=link.h
|
||||
if test "$ac_cv_header_link_h" = "no"; then
|
||||
link_h=sys/link.h
|
||||
fi
|
||||
# When built as a GCC target library, we can't do a link test.
|
||||
AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
|
||||
AC_EGREP_HEADER([dl_iterate_phdr], [$link_h], [have_dl_iterate_phdr=yes],
|
||||
[have_dl_iterate_phdr=no])
|
||||
else
|
||||
AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
|
||||
@@ -373,6 +377,8 @@ if test "$have_loadquery" = "yes"; then
|
||||
AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(windows.h)
|
||||
|
||||
# Check for the fcntl function.
|
||||
if test -n "${with_target_subdir}"; then
|
||||
case "${host}" in
|
||||
@@ -403,6 +409,9 @@ if test "$have_getexecname" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
|
||||
fi
|
||||
|
||||
# Check for _pgmptr variable, contains the executable filename on windows
|
||||
AC_CHECK_DECLS([_pgmptr])
|
||||
|
||||
# Check for sysctl definitions.
|
||||
|
||||
AC_CACHE_CHECK([for KERN_PROC],
|
||||
@@ -480,7 +489,18 @@ AC_CHECK_LIB([z], [compress],
|
||||
[AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
|
||||
AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
|
||||
|
||||
dnl Test whether the linker supports the --compress_debug_sections option.
|
||||
dnl Test whether the linker supports the --build-id option.
|
||||
AC_CACHE_CHECK([whether --build-id is supported],
|
||||
[libbacktrace_cv_ld_buildid],
|
||||
[LDFLAGS_hold=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -Wl,--build-id"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
|
||||
[libbacktrace_cv_ld_buildid=yes],
|
||||
[libbacktrace_cv_ld_buildid=no])
|
||||
LDFLAGS=$LDFLAGS_hold])
|
||||
AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes)
|
||||
|
||||
dnl Test whether the linker supports the --compress-debug-sections option.
|
||||
AC_CACHE_CHECK([whether --compress-debug-sections is supported],
|
||||
[libgo_cv_ld_compress],
|
||||
[LDFLAGS_hold=$LDFLAGS
|
||||
@@ -491,6 +511,21 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
|
||||
LDFLAGS=$LDFLAGS_hold])
|
||||
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
|
||||
|
||||
AC_CHECK_LIB([zstd], [ZSTD_compress],
|
||||
[AC_DEFINE(HAVE_ZSTD, 1, [Define if -lzstd is available.])])
|
||||
AM_CONDITIONAL(HAVE_ZSTD, test "$ac_cv_lib_zstd_ZSTD_compress" = yes)
|
||||
|
||||
dnl Test whether the linker supports --compress-debug-sections=zstd option.
|
||||
AC_CACHE_CHECK([whether --compress-debug-sections=zstd is supported],
|
||||
[libgo_cv_ld_compress_zstd],
|
||||
[LDFLAGS_hold=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zstd"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
|
||||
[libgo_cv_ld_compress_zstd=yes],
|
||||
[libgo_cv_ld_compress_zstd=no])
|
||||
LDFLAGS=$LDFLAGS_hold])
|
||||
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZSTD, test "$libgo_cv_ld_compress_zstd" = yes)
|
||||
|
||||
AC_ARG_VAR(OBJCOPY, [location of objcopy])
|
||||
AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
|
||||
AC_CHECK_PROG(READELF, readelf, readelf)
|
||||
@@ -500,7 +535,7 @@ AC_CACHE_CHECK([whether objcopy supports debuglink],
|
||||
libbacktrace_cv_objcopy_debuglink=no
|
||||
elif ! test -n "${OBJCOPY}"; then
|
||||
libbacktrace_cv_objcopy_debuglink=no
|
||||
elif ${OBJCOPY} --help | fgrep add-gnu-debuglink >/dev/null 2>&1; then
|
||||
elif ${OBJCOPY} --help | grep add-gnu-debuglink >/dev/null 2>&1; then
|
||||
libbacktrace_cv_objcopy_debuglink=yes
|
||||
else
|
||||
libbacktrace_cv_objcopy_debuglink=no
|
||||
|
||||
Reference in New Issue
Block a user