mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-04-30 12:49:10 +08:00
libbacktrace: update to current version from GCC trunk
This adds DWARF 5 support as well as an enhanced testsuite. Patch assembled by Than McIntosh.
This commit is contained in:
287
Makefile.am
287
Makefile.am
@@ -1,5 +1,5 @@
|
||||
# Makefile.am -- Backtrace Makefile.
|
||||
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I config
|
||||
|
||||
AM_CPPFLAGS =
|
||||
|
||||
AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
|
||||
|
||||
include_HEADERS = backtrace.h backtrace-supported.h
|
||||
@@ -83,46 +85,240 @@ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
|
||||
|
||||
# Testsuite.
|
||||
|
||||
# Add test to this variable, if you want it to be build.
|
||||
check_PROGRAMS =
|
||||
CLEANFILES =
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
# Add test to this variable, if you want it to be run.
|
||||
TESTS =
|
||||
|
||||
# Add test to this variable, if you want it to be build and run.
|
||||
BUILDTESTS =
|
||||
|
||||
if NATIVE
|
||||
check_LTLIBRARIES = libbacktrace_alloc.la
|
||||
|
||||
libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
|
||||
libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.lo alloc.lo
|
||||
|
||||
libbacktrace_alloc_la_DEPENDENCIES = $(libbacktrace_alloc_la_LIBADD)
|
||||
|
||||
check_LTLIBRARIES += libbacktrace_noformat.la
|
||||
|
||||
libbacktrace_noformat_la_SOURCES = $(libbacktrace_la_SOURCES)
|
||||
libbacktrace_noformat_la_LIBADD = $(BACKTRACE_FILE) $(VIEW_FILE) $(ALLOC_FILE)
|
||||
|
||||
libbacktrace_noformat_la_DEPENDENCIES = $(libbacktrace_noformat_la_LIBADD)
|
||||
|
||||
if HAVE_ELF
|
||||
if HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
TEST_BUILD_ID_DIR=$(abs_builddir)/usr/lib/debug/.build-id/
|
||||
|
||||
check_LTLIBRARIES += libbacktrace_elf_for_test.la
|
||||
|
||||
libbacktrace_elf_for_test_la_SOURCES = $(libbacktrace_la_SOURCES)
|
||||
libbacktrace_elf_for_test_la_LIBADD = $(BACKTRACE_FILE) elf_for_test.lo \
|
||||
$(VIEW_FILE) $(ALLOC_FILE)
|
||||
|
||||
elf_for_test.c: elf.c
|
||||
SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \
|
||||
REPLACE="#define SYSTEM_BUILD_ID_DIR \"$(TEST_BUILD_ID_DIR)\""; \
|
||||
$(SED) "s%$$SEARCH%$$REPLACE%" \
|
||||
$< \
|
||||
> $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
endif HAVE_OBJCOPY_DEBUGLINK
|
||||
endif HAVE_ELF
|
||||
|
||||
elf_%.c: elf.c
|
||||
SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \
|
||||
REPLACE='#undef BACKTRACE_ELF_SIZE\
|
||||
#define BACKTRACE_ELF_SIZE'; \
|
||||
$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
|
||||
$< \
|
||||
> $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
xcoff_%.c: xcoff.c
|
||||
SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
|
||||
REPLACE='#undef BACKTRACE_XCOFF_SIZE\
|
||||
#define BACKTRACE_XCOFF_SIZE'; \
|
||||
$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
|
||||
$< \
|
||||
> $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
test_elf_32_SOURCES = test_format.c testlib.c
|
||||
test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo
|
||||
|
||||
BUILDTESTS += test_elf_32
|
||||
|
||||
test_elf_64_SOURCES = test_format.c testlib.c
|
||||
test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo
|
||||
|
||||
BUILDTESTS += test_elf_64
|
||||
|
||||
test_xcoff_32_SOURCES = test_format.c testlib.c
|
||||
test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo
|
||||
|
||||
BUILDTESTS += test_xcoff_32
|
||||
|
||||
test_xcoff_64_SOURCES = test_format.c testlib.c
|
||||
test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo
|
||||
|
||||
BUILDTESTS += test_xcoff_64
|
||||
|
||||
test_pecoff_SOURCES = test_format.c testlib.c
|
||||
test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo
|
||||
|
||||
BUILDTESTS += test_pecoff
|
||||
|
||||
test_unknown_SOURCES = test_format.c testlib.c
|
||||
test_unknown_LDADD = libbacktrace_noformat.la unknown.lo
|
||||
|
||||
BUILDTESTS += test_unknown
|
||||
|
||||
unittest_SOURCES = unittest.c testlib.c
|
||||
unittest_LDADD = libbacktrace.la
|
||||
|
||||
BUILDTESTS += unittest
|
||||
|
||||
unittest_alloc_SOURCES = $(unittest_SOURCES)
|
||||
unittest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += unittest_alloc
|
||||
|
||||
check_LTLIBRARIES += libbacktrace_instrumented_alloc.la
|
||||
|
||||
libbacktrace_instrumented_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
|
||||
libbacktrace_instrumented_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) \
|
||||
read.lo instrumented_alloc.lo
|
||||
|
||||
libbacktrace_instrumented_alloc_la_DEPENDENCIES = \
|
||||
$(libbacktrace_instrumented_alloc_la_LIBADD)
|
||||
|
||||
instrumented_alloc.lo: alloc.c
|
||||
|
||||
allocfail_SOURCES = allocfail.c testlib.c
|
||||
allocfail_LDADD = libbacktrace_instrumented_alloc.la
|
||||
|
||||
check_PROGRAMS += allocfail
|
||||
|
||||
allocfail.sh: allocfail
|
||||
|
||||
TESTS += allocfail.sh
|
||||
|
||||
if HAVE_ELF
|
||||
if HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
b2test_SOURCES = $(btest_SOURCES)
|
||||
b2test_CFLAGS = $(btest_CFLAGS)
|
||||
b2test_LDFLAGS = -Wl,--build-id
|
||||
b2test_LDADD = libbacktrace_elf_for_test.la
|
||||
|
||||
check_PROGRAMS += b2test
|
||||
TESTS += b2test_buildid
|
||||
|
||||
if HAVE_DWZ
|
||||
|
||||
b3test_SOURCES = $(btest_SOURCES)
|
||||
b3test_CFLAGS = $(btest_CFLAGS)
|
||||
b3test_LDFLAGS = -Wl,--build-id
|
||||
b3test_LDADD = libbacktrace_elf_for_test.la
|
||||
|
||||
check_PROGRAMS += b3test
|
||||
TESTS += b3test_dwz_buildid
|
||||
|
||||
endif HAVE_DWZ
|
||||
|
||||
endif HAVE_OBJCOPY_DEBUGLINK
|
||||
endif HAVE_ELF
|
||||
|
||||
btest_SOURCES = btest.c testlib.c
|
||||
btest_CFLAGS = $(AM_CFLAGS) -g -O
|
||||
btest_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += btest
|
||||
BUILDTESTS += btest
|
||||
|
||||
btest_static_SOURCES = btest.c testlib.c
|
||||
btest_static_CFLAGS = $(AM_CFLAGS) -g -O
|
||||
btest_static_LDADD = libbacktrace.la
|
||||
btest_static_LDFLAGS = -static-libtool-libs
|
||||
if HAVE_ELF
|
||||
|
||||
check_PROGRAMS += btest_static
|
||||
btest_lto_SOURCES = btest.c testlib.c
|
||||
btest_lto_CFLAGS = $(AM_CFLAGS) -g -O -flto
|
||||
btest_lto_LDADD = libbacktrace.la
|
||||
|
||||
BUILDTESTS += btest_lto
|
||||
|
||||
endif HAVE_ELF
|
||||
|
||||
btest_alloc_SOURCES = $(btest_SOURCES)
|
||||
btest_alloc_CFLAGS = $(btest_CFLAGS)
|
||||
btest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += btest_alloc
|
||||
|
||||
if HAVE_DWZ
|
||||
|
||||
%_dwz: %
|
||||
rm -f $@ $@_common.debug
|
||||
cp $< $@_1
|
||||
cp $< $@_2
|
||||
$(DWZ) -m $@_common.debug $@_1 $@_2
|
||||
rm -f $@_2
|
||||
mv $@_1 $@
|
||||
|
||||
TESTS += btest_dwz
|
||||
|
||||
if HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
TESTS += btest_dwz_gnudebuglink
|
||||
|
||||
endif HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
endif HAVE_DWZ
|
||||
|
||||
stest_SOURCES = stest.c
|
||||
stest_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += stest
|
||||
BUILDTESTS += stest
|
||||
|
||||
stest_alloc_SOURCES = $(stest_SOURCES)
|
||||
stest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += stest_alloc
|
||||
|
||||
if HAVE_ELF
|
||||
|
||||
ztest_SOURCES = ztest.c testlib.c
|
||||
ztest_CFLAGS = -DSRCDIR=\"$(srcdir)\"
|
||||
ztest_LDADD = libbacktrace.la
|
||||
ztest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
if HAVE_ZLIB
|
||||
ztest_LDADD += -lz
|
||||
ztest_alloc_LDADD += -lz
|
||||
endif
|
||||
ztest_LDADD += $(CLOCK_GETTIME_LINK)
|
||||
ztest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
|
||||
|
||||
check_PROGRAMS += ztest
|
||||
BUILDTESTS += ztest
|
||||
|
||||
ztest_alloc_SOURCES = $(ztest_SOURCES)
|
||||
ztest_alloc_CFLAGS = $(ztest_CFLAGS)
|
||||
|
||||
BUILDTESTS += ztest_alloc
|
||||
|
||||
endif HAVE_ELF
|
||||
|
||||
edtest_SOURCES = edtest.c edtest2_build.c testlib.c
|
||||
edtest_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += edtest
|
||||
BUILDTESTS += edtest
|
||||
|
||||
edtest_alloc_SOURCES = $(edtest_SOURCES)
|
||||
edtest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += edtest_alloc
|
||||
|
||||
edtest2_build.c: gen_edtest2_build; @true
|
||||
gen_edtest2_build: $(srcdir)/edtest2.c
|
||||
@@ -130,30 +326,38 @@ gen_edtest2_build: $(srcdir)/edtest2.c
|
||||
$(SHELL) $(srcdir)/move-if-change tmp-edtest2_build.c edtest2_build.c
|
||||
echo timestamp > $@
|
||||
|
||||
CLEANFILES += edtest2_build.c gen_edtest2_build
|
||||
|
||||
if HAVE_PTHREAD
|
||||
|
||||
check_PROGRAMS += ttest
|
||||
BUILDTESTS += ttest
|
||||
|
||||
ttest_SOURCES = ttest.c testlib.c
|
||||
ttest_CFLAGS = $(AM_CFLAGS) -pthread
|
||||
ttest_LDADD = libbacktrace.la
|
||||
|
||||
BUILDTESTS += ttest_alloc
|
||||
|
||||
ttest_alloc_SOURCES = $(ttest_SOURCES)
|
||||
ttest_alloc_CFLAGS = $(ttest_CFLAGS)
|
||||
ttest_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
endif HAVE_PTHREAD
|
||||
|
||||
if HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
TESTS += dtest
|
||||
TESTS += btest_gnudebuglink
|
||||
|
||||
dtest: btest_static
|
||||
$(OBJCOPY) --only-keep-debug btest_static btest.debug
|
||||
$(OBJCOPY) --strip-debug --add-gnu-debuglink=btest.debug btest_static dtest
|
||||
|
||||
CLEANFILES += dtest btest.debug
|
||||
%_gnudebuglink: %
|
||||
$(OBJCOPY) --only-keep-debug $< $@.debug
|
||||
$(OBJCOPY) --strip-debug --add-gnu-debuglink=$@.debug $< $@
|
||||
|
||||
endif HAVE_OBJCOPY_DEBUGLINK
|
||||
|
||||
%_buildid: %
|
||||
./install-debuginfo-for-buildid.sh \
|
||||
"$(TEST_BUILD_ID_DIR)" \
|
||||
$<
|
||||
$(OBJCOPY) --strip-debug $< $@
|
||||
|
||||
if HAVE_COMPRESSED_DEBUG
|
||||
|
||||
ctestg_SOURCES = btest.c testlib.c
|
||||
@@ -166,12 +370,49 @@ ctesta_CFLAGS = $(AM_CFLAGS) -g
|
||||
ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi
|
||||
ctesta_LDADD = libbacktrace.la
|
||||
|
||||
check_PROGRAMS += ctestg ctesta
|
||||
BUILDTESTS += ctestg ctesta
|
||||
|
||||
ctestg_alloc_SOURCES = $(ctestg_SOURCES)
|
||||
ctestg_alloc_CFLAGS = $(ctestg_CFLAGS)
|
||||
ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS)
|
||||
ctestg_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
ctesta_alloc_SOURCES = $(ctesta_SOURCES)
|
||||
ctesta_alloc_CFLAGS = $(ctesta_CFLAGS)
|
||||
ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS)
|
||||
ctesta_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += ctestg_alloc ctesta_alloc
|
||||
|
||||
endif
|
||||
|
||||
if HAVE_DWARF5
|
||||
|
||||
dwarf5_SOURCES = btest.c testlib.c
|
||||
dwarf5_CFLAGS = $(AM_CFLAGS) -gdwarf-5
|
||||
dwarf5_LDADD = libbacktrace.la
|
||||
|
||||
BUILDTESTS += dwarf5
|
||||
|
||||
dwarf5_alloc_SOURCES = $(dwarf5_SOURCES)
|
||||
dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS)
|
||||
dwarf5_alloc_LDADD = libbacktrace_alloc.la
|
||||
|
||||
BUILDTESTS += dwarf5_alloc
|
||||
|
||||
endif
|
||||
|
||||
endif NATIVE
|
||||
|
||||
check_PROGRAMS += $(BUILDTESTS)
|
||||
|
||||
TESTS += $(BUILDTESTS)
|
||||
|
||||
CLEANFILES = $(TESTS) *.debug elf_for_test.c edtest2_build.c gen_edtest2_build
|
||||
|
||||
clean-local:
|
||||
-rm -rf usr
|
||||
|
||||
# We can't use automake's automatic dependency tracking, because it
|
||||
# breaks when using bootstrap-lean. Automatic dependency tracking
|
||||
# with GCC bootstrap will cause some of the objects to depend on
|
||||
@@ -186,7 +427,7 @@ endif NATIVE
|
||||
|
||||
alloc.lo: config.h backtrace.h internal.h
|
||||
backtrace.lo: config.h backtrace.h internal.h
|
||||
btest.lo: backtrace.h backtrace-supported.h filenames.h
|
||||
btest.lo: filenames.h backtrace.h backtrace-supported.h
|
||||
dwarf.lo: config.h filenames.h backtrace.h internal.h
|
||||
elf.lo: config.h backtrace.h internal.h
|
||||
fileline.lo: config.h backtrace.h internal.h
|
||||
|
||||
1691
Makefile.in
1691
Makefile.in
File diff suppressed because it is too large
Load Diff
597
aclocal.m4
vendored
597
aclocal.m4
vendored
@@ -1,8 +1,7 @@
|
||||
# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
|
||||
# Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -12,33 +11,31 @@
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
|
||||
[m4_warning([this file was generated for autoconf 2.64.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
|
||||
[m4_warning([this file was generated for autoconf 2.69.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 1
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
[am__api_version='1.15'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11.6], [],
|
||||
m4_if([$1], [1.15.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11.6])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.15.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 1
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
|
||||
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
@@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# harmless because $srcdir is '.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
@@ -108,29 +103,25 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
||||
# Expand $ac_aux_dir to an absolute path.
|
||||
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[AC_PREREQ([2.52])dnl
|
||||
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
@@ -152,18 +143,21 @@ fi])])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 16
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
|
||||
m4_define([AC_PROG_CC],
|
||||
m4_defn([AC_PROG_CC])
|
||||
[_AM_PROG_CC_C_O
|
||||
])
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
@@ -176,7 +170,7 @@ fi])])
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.62])dnl
|
||||
[AC_PREREQ([2.65])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
@@ -205,33 +199,42 @@ AC_SUBST([CYGPATH_W])
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
[AC_DIAGNOSE([obsolete],
|
||||
[$0: two- and three-arguments forms are deprecated.])
|
||||
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
m4_if(
|
||||
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
|
||||
[ok:ok],,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
|
||||
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
|
||||
AM_MISSING_PROG([AUTOCONF], [autoconf])
|
||||
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
|
||||
AM_MISSING_PROG([AUTOHEADER], [autoheader])
|
||||
AM_MISSING_PROG([MAKEINFO], [makeinfo])
|
||||
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
# For better backward compatibility. To be removed once Automake 1.9.x
|
||||
# dies out for good. For more background, see:
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
@@ -240,34 +243,82 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
[_AM_DEPENDENCIES([CC])],
|
||||
[m4_define([AC_PROG_CC],
|
||||
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
[_AM_DEPENDENCIES([CXX])],
|
||||
[m4_define([AC_PROG_CXX],
|
||||
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
[_AM_DEPENDENCIES([OBJC])],
|
||||
[m4_define([AC_PROG_OBJC],
|
||||
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
[_AM_DEPENDENCIES([OBJCXX])],
|
||||
[m4_define([AC_PROG_OBJCXX],
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell bug-automake@gnu.org about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi
|
||||
dnl The trailing newline in this macro's definition is deliberate, for
|
||||
dnl backward compatibility and to allow trailing 'dnl'-style comments
|
||||
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
|
||||
])
|
||||
|
||||
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
|
||||
dnl mangled by Autoconf and run in a shell conditional statement.
|
||||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
@@ -289,21 +340,18 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 1
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
if test x"${install_sh+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
@@ -311,46 +359,22 @@ if test x"${install_sh}" != xset; then
|
||||
install_sh="\${SHELL} $am_aux_dir/install-sh"
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
|
||||
# 2011 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_MAINTAINER_MODE([DEFAULT-MODE])
|
||||
# ----------------------------------
|
||||
# Control maintainer-specific portions of Makefiles.
|
||||
# Default is to disable them, unless `enable' is passed literally.
|
||||
# For symmetry, `disable' may be passed as well. Anyway, the user
|
||||
# Default is to disable them, unless 'enable' is passed literally.
|
||||
# For symmetry, 'disable' may be passed as well. Anyway, the user
|
||||
# can override the default with the --enable/--disable switch.
|
||||
AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
[m4_case(m4_default([$1], [disable]),
|
||||
@@ -361,8 +385,9 @@ AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
|
||||
AC_ARG_ENABLE([maintainer-mode],
|
||||
[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
|
||||
am_maintainer_other[ make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer])],
|
||||
[USE_MAINTAINER_MODE=$enableval],
|
||||
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
|
||||
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
|
||||
@@ -372,19 +397,14 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
]
|
||||
)
|
||||
|
||||
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
@@ -392,11 +412,10 @@ AC_DEFUN([AM_MISSING_PROG],
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
# Define MISSING if not defined so far and test if it is modern enough.
|
||||
# If it is, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
@@ -409,122 +428,22 @@ if test x"${MISSING+set}" != xset; then
|
||||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
if eval "$MISSING --is-lightweight"; then
|
||||
am_missing_run="$MISSING "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
AC_MSG_WARN(['missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 1
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2012
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
|
||||
# ---------------------------------------------------
|
||||
# Add --enable-multilib to configure.
|
||||
AC_DEFUN([AM_ENABLE_MULTILIB],
|
||||
[m4_warn([obsolete], [$0 will be removed from Automake core soon.
|
||||
Files implementing the "multilib" feature are (and will remain) available
|
||||
to the 'contrib/' directory in the Automake distribution.])]dnl
|
||||
[# Default to --enable-multilib
|
||||
AC_ARG_ENABLE(multilib,
|
||||
[ --enable-multilib build many library versions (default)],
|
||||
[case "$enableval" in
|
||||
yes) multilib=yes ;;
|
||||
no) multilib=no ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
|
||||
esac],
|
||||
[multilib=yes])
|
||||
|
||||
# We may get other options which we leave undocumented:
|
||||
# --with-target-subdir, --with-multisrctop, --with-multisubdir
|
||||
# See config-ml.in if you want the gory details.
|
||||
|
||||
if test "$srcdir" = "."; then
|
||||
if test "$with_target_subdir" != "."; then
|
||||
multi_basedir="$srcdir/$with_multisrctop../$2"
|
||||
else
|
||||
multi_basedir="$srcdir/$with_multisrctop$2"
|
||||
fi
|
||||
else
|
||||
multi_basedir="$srcdir/$2"
|
||||
fi
|
||||
AC_SUBST(multi_basedir)
|
||||
|
||||
# Even if the default multilib is not a cross compilation,
|
||||
# it may be that some of the other multilibs are.
|
||||
if test $cross_compiling = no && test $multilib = yes \
|
||||
&& test "x${with_multisubdir}" != x ; then
|
||||
cross_compiling=maybe
|
||||
fi
|
||||
|
||||
AC_OUTPUT_COMMANDS([
|
||||
# Only add multilib support code if we just rebuilt the top-level
|
||||
# Makefile.
|
||||
case " $CONFIG_FILES " in
|
||||
*" ]m4_default([$1],Makefile)[ "*)
|
||||
ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
|
||||
;;
|
||||
esac],
|
||||
[
|
||||
srcdir="$srcdir"
|
||||
host="$host"
|
||||
target="$target"
|
||||
with_multisubdir="$with_multisubdir"
|
||||
with_multisrctop="$with_multisrctop"
|
||||
with_target_subdir="$with_target_subdir"
|
||||
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
multi_basedir="$multi_basedir"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
CC="$CC"])])dnl
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
|
||||
# Foundation, Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
@@ -534,7 +453,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
# --------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ------------------------
|
||||
@@ -548,24 +467,82 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
# _AM_PROG_CC_C_O
|
||||
# ---------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
|
||||
# to automatically call this.
|
||||
AC_DEFUN([_AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
AC_LANG_PUSH([C])dnl
|
||||
AC_CACHE_CHECK(
|
||||
[whether $CC understands -c and -o together],
|
||||
[am_cv_prog_cc_c_o],
|
||||
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
|
||||
# Make sure it works both with $CC and with simple cc.
|
||||
# Following AC_PROG_CC_C_O, we do the test twice because some
|
||||
# compilers refuse to overwrite an existing .o file with -o,
|
||||
# though they will create one.
|
||||
am_cv_prog_cc_c_o=yes
|
||||
for am_i in 1 2; do
|
||||
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
|
||||
&& test -f conftest2.$ac_objext; then
|
||||
: OK
|
||||
else
|
||||
am_cv_prog_cc_c_o=no
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
unset am_i])
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
AC_LANG_POP([C])])
|
||||
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_RUN_LOG(COMMAND)
|
||||
# -------------------
|
||||
# Run COMMAND, save the exit status in ac_status, and log it.
|
||||
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
|
||||
AC_DEFUN([AM_RUN_LOG],
|
||||
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
|
||||
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
|
||||
(exit $ac_status); }])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
@@ -576,21 +553,23 @@ case `pwd` in
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
|
||||
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
|
||||
esac
|
||||
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# Do 'set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
am_has_slept=no
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
@@ -601,7 +580,13 @@ if (
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
if test "$[2]" = conftest.file || test $am_try -eq 2; then
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep 1
|
||||
am_has_slept=yes
|
||||
done
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
@@ -611,46 +596,118 @@ else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
AC_MSG_RESULT([yes])
|
||||
# If we didn't sleep, we still need to ensure time stamps of config.status and
|
||||
# generated files are strictly newer.
|
||||
am_sleep_pid=
|
||||
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
|
||||
( sleep 1 ) &
|
||||
am_sleep_pid=$!
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[AC_MSG_CHECKING([that generated files are newer than configure])
|
||||
if test -n "$am_sleep_pid"; then
|
||||
# Hide warnings about reused PIDs.
|
||||
wait $am_sleep_pid 2>/dev/null
|
||||
fi
|
||||
AC_MSG_RESULT([done])])
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 1
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Enable less verbose build rules; with the default set to DEFAULT
|
||||
# ("yes" being less verbose, "no" or empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_ARG_ENABLE([silent-rules], [dnl
|
||||
AS_HELP_STRING(
|
||||
[--enable-silent-rules],
|
||||
[less verbose build output (undo: "make V=1")])
|
||||
AS_HELP_STRING(
|
||||
[--disable-silent-rules],
|
||||
[verbose build output (undo: "make V=0")])dnl
|
||||
])
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
|
||||
esac
|
||||
dnl
|
||||
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
|
||||
dnl do not support nested variable expansions.
|
||||
dnl See automake bug#9928 and bug#10237.
|
||||
am_make=${MAKE-make}
|
||||
AC_CACHE_CHECK([whether $am_make supports nested variables],
|
||||
[am_cv_make_support_nested_variables],
|
||||
[if AS_ECHO([['TRUE=$(BAR$(V))
|
||||
BAR0=false
|
||||
BAR1=true
|
||||
V=1
|
||||
am__doit:
|
||||
@$(TRUE)
|
||||
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
|
||||
am_cv_make_support_nested_variables=yes
|
||||
else
|
||||
am_cv_make_support_nested_variables=no
|
||||
fi])
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AC_SUBST([AM_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
|
||||
AM_BACKSLASH='\'
|
||||
AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# One issue with vendor 'install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# always use install-sh in "make install-strip", and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# Installed binaries are usually stripped using 'strip' when the user
|
||||
# run "make install-strip". However 'strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
# will honor the 'STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
@@ -664,18 +721,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
@@ -685,26 +740,62 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
#
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility. Yes, it's still used
|
||||
# in the wild :-( We should find a proper way to deprecate it ...
|
||||
AC_SUBST([AMTAR], ['$${TAR-tar}'])
|
||||
|
||||
# We'll loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
|
||||
[m4_case([$1],
|
||||
[ustar],
|
||||
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
|
||||
# There is notably a 21 bits limit for the UID and the GID. In fact,
|
||||
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
|
||||
# and bug#13588).
|
||||
am_max_uid=2097151 # 2^21 - 1
|
||||
am_max_gid=$am_max_uid
|
||||
# The $UID and $GID variables are not portable, so we need to resort
|
||||
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
|
||||
# below are definitely unexpected, so allow the users to see them
|
||||
# (that is, avoid stderr redirection).
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
|
||||
if test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi
|
||||
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
|
||||
if test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi],
|
||||
|
||||
[pax],
|
||||
[],
|
||||
|
||||
[m4_fatal([Unknown tar format])])
|
||||
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
|
||||
# Go ahead even if we have the value already cached. We do so because we
|
||||
# need to set the values for the 'am__tar' and 'am__untar' variables.
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
|
||||
for _am_tool in $_am_tools; do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
for _am_tar in tar gnutar gtar; do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
@@ -740,7 +831,7 @@ do
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
# tar/untar a dummy directory, and stop if the command works.
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
@@ -748,6 +839,7 @@ do
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
AM_RUN_LOG([cat conftest.dir/file])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
@@ -755,13 +847,18 @@ rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([config/lead-dot.m4])
|
||||
m4_include([config/libtool.m4])
|
||||
m4_include([config/ltoptions.m4])
|
||||
m4_include([config/ltsugar.m4])
|
||||
m4_include([config/ltversion.m4])
|
||||
m4_include([config/lt~obsolete.m4])
|
||||
m4_include([acinclude.m4])
|
||||
m4_include([config/multi.m4])
|
||||
m4_include([config/override.m4])
|
||||
m4_include([config/unwind_ipinfo.m4])
|
||||
m4_include([config/warnings.m4])
|
||||
|
||||
15
alloc.c
15
alloc.c
@@ -1,5 +1,5 @@
|
||||
/* alloc.c -- Memory allocation without mmap.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -145,12 +145,23 @@ backtrace_vector_release (struct backtrace_state *state ATTRIBUTE_UNUSED,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data)
|
||||
{
|
||||
vec->alc = 0;
|
||||
|
||||
if (vec->size == 0)
|
||||
{
|
||||
/* As of C17, realloc with size 0 is marked as an obsolescent feature, use
|
||||
free instead. */
|
||||
free (vec->base);
|
||||
vec->base = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
vec->base = realloc (vec->base, vec->size);
|
||||
if (vec->base == NULL)
|
||||
{
|
||||
error_callback (data, "realloc", errno);
|
||||
return 0;
|
||||
}
|
||||
vec->alc = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
136
allocfail.c
Normal file
136
allocfail.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/* allocfail.c -- Test for libbacktrace library
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
(2) Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
(3) The name of the author may not be used to
|
||||
endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "filenames.h"
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "backtrace-supported.h"
|
||||
|
||||
#include "testlib.h"
|
||||
|
||||
extern uint64_t get_nr_allocs (void);
|
||||
extern void set_fail_at_alloc (uint64_t);
|
||||
extern int at_fail_alloc_p (void);
|
||||
|
||||
static int test1 (void) __attribute__ ((noinline, unused));
|
||||
static int f2 (int) __attribute__ ((noinline));
|
||||
static int f3 (int, int) __attribute__ ((noinline));
|
||||
|
||||
static unsigned callback_errors = 0;
|
||||
|
||||
static void
|
||||
error_callback_full (void *vdata ATTRIBUTE_UNUSED,
|
||||
const char *msg ATTRIBUTE_UNUSED,
|
||||
int errnum ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (at_fail_alloc_p ())
|
||||
{
|
||||
set_fail_at_alloc (0);
|
||||
return;
|
||||
}
|
||||
|
||||
callback_errors++;
|
||||
}
|
||||
|
||||
static int
|
||||
callback_full (void *vdata ATTRIBUTE_UNUSED, uintptr_t pc ATTRIBUTE_UNUSED,
|
||||
const char *filename ATTRIBUTE_UNUSED,
|
||||
int lineno ATTRIBUTE_UNUSED,
|
||||
const char *function ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
test1 (void)
|
||||
{
|
||||
return f2 (__LINE__) + 1;
|
||||
}
|
||||
|
||||
static int
|
||||
f2 (int f1line)
|
||||
{
|
||||
return f3 (f1line, __LINE__) + 2;
|
||||
}
|
||||
|
||||
static int
|
||||
f3 (int f1line ATTRIBUTE_UNUSED, int f2line ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = backtrace_full (state, 0, callback_full, error_callback_full, NULL);
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
fprintf (stderr, "test1: unexpected return value %d\n", i);
|
||||
++failures;
|
||||
}
|
||||
|
||||
if (callback_errors)
|
||||
++failures;
|
||||
|
||||
return failures;
|
||||
}
|
||||
|
||||
/* Run all the tests. */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
uint64_t fail_at = 0;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
fail_at = atoi (argv[1]);
|
||||
set_fail_at_alloc (fail_at);
|
||||
}
|
||||
|
||||
state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
|
||||
error_callback_full, NULL);
|
||||
if (state == NULL)
|
||||
exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
|
||||
#if BACKTRACE_SUPPORTED
|
||||
test1 ();
|
||||
#endif
|
||||
|
||||
if (argc == 1)
|
||||
fprintf (stderr, "%llu\n", (long long unsigned) get_nr_allocs ());
|
||||
|
||||
exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
104
allocfail.sh
Executable file
104
allocfail.sh
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/bin/sh
|
||||
|
||||
# allocfail.sh -- Test for libbacktrace library.
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
|
||||
# (1) Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
|
||||
# (2) Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
|
||||
# (3) The name of the author may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f ./allocfail ]; then
|
||||
# Hard failure.
|
||||
exit 99
|
||||
fi
|
||||
|
||||
allocs=$(./allocfail 2>&1)
|
||||
if [ "$allocs" = "" ]; then
|
||||
# Hard failure.
|
||||
exit 99
|
||||
fi
|
||||
|
||||
# This generates the following output:
|
||||
# ...
|
||||
# $ allocfail.sh
|
||||
# allocs: 80495
|
||||
# Status changed to 0 at 1
|
||||
# Status changed to 1 at 3
|
||||
# Status changed to 0 at 11
|
||||
# Status changed to 1 at 12
|
||||
# Status changed to 0 at 845
|
||||
# ...
|
||||
#
|
||||
# We have status 0 for an allocation failure at:
|
||||
# - 1 because backtrace_create_state handles failure robustly
|
||||
# - 2 because the fail switches backtrace_full to !can_alloc mode.
|
||||
# - 11 because failure of elf_open_debugfile_by_buildid does not generate an
|
||||
# error callback beyond the one for the allocation failure itself.
|
||||
|
||||
echo "allocs: $allocs"
|
||||
|
||||
step=1
|
||||
i=1
|
||||
passes=0
|
||||
prev_status=-1
|
||||
while [ $i -le $allocs ]; do
|
||||
if ./allocfail $i >/dev/null 2>&1; status=$?; then
|
||||
true
|
||||
fi
|
||||
if [ $status -gt 1 ]; then
|
||||
echo "Unallowed fail found: $i"
|
||||
# Failure.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The test-case would run too long if we would excercise all allocs.
|
||||
# So, run with step 1 initially, and increase the step once we have 10
|
||||
# subsequent passes, and drop back to step 1 once we encounter another
|
||||
# failure. This takes ~2.6 seconds on an i7-6600U CPU @ 2.60GHz.
|
||||
if [ $status -eq 0 ]; then
|
||||
passes=$(($passes + 1))
|
||||
if [ $passes -ge 10 ]; then
|
||||
step=$((step * 10))
|
||||
passes=0
|
||||
fi
|
||||
elif [ $status -eq 1 ]; then
|
||||
passes=0
|
||||
step=1
|
||||
fi
|
||||
|
||||
if [ $status -ne $prev_status ]; then
|
||||
echo "Status changed to $status at $i"
|
||||
fi
|
||||
prev_status=$status
|
||||
|
||||
i=$(($i + $step))
|
||||
done
|
||||
|
||||
# Success.
|
||||
exit 0
|
||||
2
atomic.c
2
atomic.c
@@ -1,5 +1,5 @@
|
||||
/* atomic.c -- Support for atomic functions if not present.
|
||||
Copyright (C) 2013-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* backtrace-supported.h.in -- Whether stack backtrace is supported.
|
||||
Copyright (C) 2012-2016 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* backtrace.c -- Entry point for stack backtrace library.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -98,7 +98,7 @@ unwind (struct _Unwind_Context *context, void *vdata)
|
||||
|
||||
/* Get a stack backtrace. */
|
||||
|
||||
int
|
||||
int __attribute__((noinline))
|
||||
backtrace_full (struct backtrace_state *state, int skip,
|
||||
backtrace_full_callback callback,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
|
||||
10
backtrace.h
10
backtrace.h
@@ -1,5 +1,5 @@
|
||||
/* backtrace.h -- Public header file for stack backtrace library.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -75,7 +75,13 @@ typedef void (*backtrace_error_callback) (void *data, const char *msg,
|
||||
use appropriate atomic operations. If THREADED is zero the state
|
||||
may only be accessed by one thread at a time. This returns a state
|
||||
pointer on success, NULL on error. If an error occurs, this will
|
||||
call the ERROR_CALLBACK routine. */
|
||||
call the ERROR_CALLBACK routine.
|
||||
|
||||
Calling this function allocates resources that cannot be freed.
|
||||
There is no backtrace_free_state function. The state is used to
|
||||
cache information that is expensive to recompute. Programs are
|
||||
expected to call this function at most once and to save the return
|
||||
value for all later calls to backtrace functions. */
|
||||
|
||||
extern struct backtrace_state *backtrace_create_state (
|
||||
const char *filename, int threaded,
|
||||
|
||||
17
btest.c
17
btest.c
@@ -1,5 +1,5 @@
|
||||
/* btest.c -- Test for libbacktrace library
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -48,9 +48,9 @@ POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
/* Test the backtrace function with non-inlined functions. */
|
||||
|
||||
static int test1 (void) __attribute__ ((noinline, unused));
|
||||
static int f2 (int) __attribute__ ((noinline));
|
||||
static int f3 (int, int) __attribute__ ((noinline));
|
||||
static int test1 (void) __attribute__ ((noinline, noclone, unused));
|
||||
static int f2 (int) __attribute__ ((noinline, noclone));
|
||||
static int f3 (int, int) __attribute__ ((noinline, noclone));
|
||||
|
||||
static int
|
||||
test1 (void)
|
||||
@@ -162,9 +162,9 @@ f13 (int f1line, int f2line)
|
||||
|
||||
/* Test the backtrace_simple function with non-inlined functions. */
|
||||
|
||||
static int test3 (void) __attribute__ ((noinline, unused));
|
||||
static int f22 (int) __attribute__ ((noinline));
|
||||
static int f23 (int, int) __attribute__ ((noinline));
|
||||
static int test3 (void) __attribute__ ((noinline, noclone, unused));
|
||||
static int f22 (int) __attribute__ ((noinline, noclone));
|
||||
static int f23 (int, int) __attribute__ ((noinline, noclone));
|
||||
|
||||
static int
|
||||
test3 (void)
|
||||
@@ -423,7 +423,8 @@ test5 (void)
|
||||
fprintf (stderr, "test5: NULL syminfo name\n");
|
||||
symdata.failed = 1;
|
||||
}
|
||||
else if (strcmp (symdata.name, "global") != 0)
|
||||
else if (!(strncmp (symdata.name, "global", 6) == 0
|
||||
&& (symdata.name[6] == '\0'|| symdata.name[6] == '.')))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"test5: unexpected syminfo name got %s expected %s\n",
|
||||
|
||||
348
compile
Executable file
348
compile
Executable file
@@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -34,9 +34,6 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <link.h> header file. */
|
||||
#undef HAVE_LINK_H
|
||||
|
||||
@@ -132,6 +129,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||
# define _DARWIN_USE_64_BIT_INODE 1
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
|
||||
38
config/enable.m4
Normal file
38
config/enable.m4
Normal file
@@ -0,0 +1,38 @@
|
||||
dnl ----------------------------------------------------------------------
|
||||
dnl This whole bit snagged from libstdc++-v3.
|
||||
|
||||
dnl
|
||||
dnl GCC_ENABLE
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
|
||||
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
|
||||
dnl
|
||||
dnl See docs/html/17_intro/configury.html#enable for documentation.
|
||||
dnl
|
||||
AC_DEFUN([GCC_ENABLE],[dnl
|
||||
m4_define([_g_switch],[--enable-$1])dnl
|
||||
m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
|
||||
AC_ARG_ENABLE($1,_g_help,
|
||||
m4_bmatch([$5],
|
||||
[^permit ],
|
||||
[[
|
||||
case "$enableval" in
|
||||
m4_bpatsubst([$5],[permit ])) ;;
|
||||
*) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
|
||||
dnl Idea for future: generate a URL pointing to
|
||||
dnl "onlinedocs/configopts.html#whatever"
|
||||
esac
|
||||
]],
|
||||
[^$],
|
||||
[[
|
||||
case "$enableval" in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
|
||||
esac
|
||||
]],
|
||||
[[$5]]),
|
||||
[enable_]m4_bpatsubst([$1],-,_)[=][$2])
|
||||
m4_undefine([_g_switch])dnl
|
||||
m4_undefine([_g_help])dnl
|
||||
])
|
||||
|
||||
31
config/lead-dot.m4
Normal file
31
config/lead-dot.m4
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- Autoconf -*-
|
||||
# Copyright (C) 2003, 2009 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# serial 1
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
1061
config/libtool.m4
vendored
1061
config/libtool.m4
vendored
File diff suppressed because it is too large
Load Diff
11
config/ltoptions.m4
vendored
11
config/ltoptions.m4
vendored
@@ -1,6 +1,7 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
@@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
@@ -133,13 +134,13 @@ case $host in
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [0], [Assembler program])dnl
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
|
||||
18
config/ltsugar.m4
vendored
18
config/ltsugar.m4
vendored
@@ -1,13 +1,13 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 ltsugar.m4
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
@@ -63,14 +63,14 @@ m4_define([lt_append],
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if([$2], [], [],
|
||||
[m4_if([$4], [], [],
|
||||
[lt_join(m4_quote(m4_default([$1], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
|
||||
[m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
|
||||
[_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
|
||||
])
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
|
||||
10
config/ltversion.m4
vendored
10
config/ltversion.m4
vendored
@@ -9,15 +9,15 @@
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 2976 ltversion.m4
|
||||
# serial 3134 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.4])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.2976])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.7a])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3134])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.4'
|
||||
macro_revision='1.2976'
|
||||
[macro_version='2.2.7a'
|
||||
macro_revision='1.3134'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
|
||||
10
config/lt~obsolete.m4
vendored
10
config/lt~obsolete.m4
vendored
@@ -1,6 +1,6 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
@@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
@@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
||||
|
||||
68
config/multi.m4
Normal file
68
config/multi.m4
Normal file
@@ -0,0 +1,68 @@
|
||||
## -*- Autoconf -*-
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
|
||||
# ---------------------------------------------------
|
||||
# Add --enable-multilib to configure.
|
||||
AC_DEFUN([AM_ENABLE_MULTILIB],
|
||||
[# Default to --enable-multilib
|
||||
AC_ARG_ENABLE(multilib,
|
||||
[ --enable-multilib build many library versions (default)],
|
||||
[case "$enableval" in
|
||||
yes) multilib=yes ;;
|
||||
no) multilib=no ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
|
||||
esac],
|
||||
[multilib=yes])
|
||||
|
||||
# We may get other options which we leave undocumented:
|
||||
# --with-target-subdir, --with-multisrctop, --with-multisubdir
|
||||
# See config-ml.in if you want the gory details.
|
||||
|
||||
if test "$srcdir" = "."; then
|
||||
if test "$with_target_subdir" != "."; then
|
||||
multi_basedir="$srcdir/$with_multisrctop../$2"
|
||||
else
|
||||
multi_basedir="$srcdir/$with_multisrctop$2"
|
||||
fi
|
||||
else
|
||||
multi_basedir="$srcdir/$2"
|
||||
fi
|
||||
AC_SUBST(multi_basedir)
|
||||
|
||||
# Even if the default multilib is not a cross compilation,
|
||||
# it may be that some of the other multilibs are.
|
||||
if test $cross_compiling = no && test $multilib = yes \
|
||||
&& test "x${with_multisubdir}" != x ; then
|
||||
cross_compiling=maybe
|
||||
fi
|
||||
|
||||
AC_OUTPUT_COMMANDS([
|
||||
# Only add multilib support code if we just rebuilt the top-level
|
||||
# Makefile.
|
||||
case " $CONFIG_FILES " in
|
||||
*" ]m4_default([$1],Makefile)[ "*)
|
||||
ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
|
||||
;;
|
||||
esac],
|
||||
[
|
||||
srcdir="$srcdir"
|
||||
host="$host"
|
||||
target="$target"
|
||||
with_multisubdir="$with_multisubdir"
|
||||
with_multisrctop="$with_multisrctop"
|
||||
with_target_subdir="$with_target_subdir"
|
||||
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
multi_basedir="$multi_basedir"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
CC="$CC"
|
||||
CXX="$CXX"
|
||||
GFORTRAN="$GFORTRAN"
|
||||
GDC="$GDC"])])dnl
|
||||
116
config/override.m4
Normal file
116
config/override.m4
Normal file
@@ -0,0 +1,116 @@
|
||||
dnl Fix Autoconf bugs by overriding broken internal Autoconf
|
||||
dnl macros with backports of fixes from newer releases.
|
||||
dnl
|
||||
dnl The override bits of this file should be a no-op for the newest
|
||||
dnl Autoconf version, which means they can be removed once the complete
|
||||
dnl tree has moved to a new enough Autoconf version.
|
||||
dnl
|
||||
dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired
|
||||
dnl Autoconf version is used. It should be kept for consistency.
|
||||
|
||||
dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
|
||||
ifdef([m4_PACKAGE_VERSION], [
|
||||
|
||||
dnl Provide m4_copy_force and m4_rename_force for old Autoconf versions.
|
||||
|
||||
m4_ifndef([m4_copy_force],
|
||||
[m4_define([m4_copy_force],
|
||||
[m4_ifdef([$2], [m4_undefine([$2])])m4_copy($@)])])
|
||||
|
||||
m4_ifndef([m4_rename_force],
|
||||
[m4_define([m4_rename_force],
|
||||
[m4_ifdef([$2], [m4_undefine([$2])])m4_rename($@)])])
|
||||
|
||||
dnl AC_DEFUN a commonly used macro so this file is picked up.
|
||||
m4_copy([AC_PREREQ], [_AC_PREREQ])
|
||||
AC_DEFUN([AC_PREREQ], [frob])
|
||||
m4_copy_force([_AC_PREREQ], [AC_PREREQ])
|
||||
|
||||
|
||||
dnl Ensure exactly this Autoconf version is used
|
||||
m4_ifndef([_GCC_AUTOCONF_VERSION],
|
||||
[m4_define([_GCC_AUTOCONF_VERSION], [2.69])])
|
||||
|
||||
dnl Test for the exact version when AC_INIT is expanded.
|
||||
dnl This allows to update the tree in steps (for testing)
|
||||
dnl by putting
|
||||
dnl m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
|
||||
dnl in configure.ac before AC_INIT,
|
||||
dnl without rewriting this file.
|
||||
dnl Or for updating the whole tree at once with the definition above.
|
||||
AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
|
||||
[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
|
||||
m4_defn([m4_PACKAGE_VERSION]), [],
|
||||
[m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
|
||||
])
|
||||
m4_define([AC_INIT], m4_defn([AC_INIT])[
|
||||
_GCC_AUTOCONF_VERSION_CHECK
|
||||
])
|
||||
|
||||
|
||||
dnl Ensure we do not use a buggy M4.
|
||||
m4_if(m4_index([..wi.d.], [.d.]), [-1],
|
||||
[m4_fatal(m4_do([m4 with buggy strstr detected. Please install
|
||||
GNU M4 1.4.16 or newer and set the M4 environment variable]))])
|
||||
|
||||
|
||||
dnl Fix 2.64 cross compile detection for AVR and RTEMS
|
||||
dnl by not trying to compile fopen.
|
||||
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],
|
||||
[m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77],
|
||||
[m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])])
|
||||
|
||||
m4_version_prereq([2.66],, [
|
||||
dnl We need AC_CHECK_DECL which works for overloaded C++ functions.
|
||||
|
||||
# _AC_CHECK_DECL_BODY
|
||||
# -------------------
|
||||
# Shell function body for AC_CHECK_DECL.
|
||||
m4_define([_AC_CHECK_DECL_BODY],
|
||||
[ AS_LINENO_PUSH([$[]1])
|
||||
[as_decl_name=`echo $][2|sed 's/ *(.*//'`]
|
||||
[as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`]
|
||||
AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
|
||||
[@%:@ifndef $[]as_decl_name
|
||||
@%:@ifdef __cplusplus
|
||||
(void) $[]as_decl_use;
|
||||
@%:@else
|
||||
(void) $[]as_decl_name;
|
||||
@%:@endif
|
||||
@%:@endif
|
||||
])],
|
||||
[AS_VAR_SET([$[]3], [yes])],
|
||||
[AS_VAR_SET([$[]3], [no])])])
|
||||
AS_LINENO_POP
|
||||
])# _AC_CHECK_DECL_BODY
|
||||
|
||||
# _AC_CHECK_DECLS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND,
|
||||
# INCLUDES)
|
||||
# -------------------------------------------------------------
|
||||
# Helper to AC_CHECK_DECLS, which generates the check for a single
|
||||
# SYMBOL with INCLUDES, performs the AC_DEFINE, then expands
|
||||
# ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
|
||||
m4_define([_AC_CHECK_DECLS],
|
||||
[AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
|
||||
[AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_bpatsubst(HAVE_DECL_[$1],[ *(.*])),
|
||||
[$ac_have_decl],
|
||||
[Define to 1 if you have the declaration of `$1',
|
||||
and to 0 if you don't.])]dnl
|
||||
[m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])
|
||||
|
||||
])
|
||||
|
||||
dnl If flex/lex are not found, the top level configure sets LEX to
|
||||
dnl "/path_to/missing flex". When AC_PROG_LEX tries to find the flex
|
||||
dnl output file, it calls $LEX to do so, but the current lightweight
|
||||
dnl "missing" won't create a file. This results in an error.
|
||||
dnl Avoid calling the bulk of AC_PROG_LEX when $LEX is "missing".
|
||||
AC_DEFUN_ONCE([AC_PROG_LEX],
|
||||
[AC_CHECK_PROGS(LEX, flex lex, :)
|
||||
case "$LEX" in
|
||||
:|*"missing "*) ;;
|
||||
*) _AC_PROG_LEX_YYTEXT_DECL ;;
|
||||
esac])
|
||||
|
||||
])
|
||||
@@ -35,38 +35,3 @@ AC_DEFUN([GCC_CHECK_UNWIND_GETIPINFO], [
|
||||
AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
|
||||
fi
|
||||
])
|
||||
|
||||
# ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS])
|
||||
# Sets @VARIABLE@ to the subset of the given options which the
|
||||
# compiler accepts.
|
||||
AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
|
||||
[AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_LANG_PUSH(C)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
for real_option in $1; do
|
||||
# Do the check with the no- prefix removed since gcc silently
|
||||
# accepts any -Wno-* option on purpose
|
||||
case $real_option in
|
||||
-Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
|
||||
*) option=$real_option ;;
|
||||
esac
|
||||
AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
|
||||
AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
|
||||
[CFLAGS="$option"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[AS_VAR_SET(acx_Woption, yes)],
|
||||
[AS_VAR_SET(acx_Woption, no)])
|
||||
])
|
||||
AS_IF([test AS_VAR_GET(acx_Woption) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }$real_option"])
|
||||
AS_VAR_POPDEF([acx_Woption])dnl
|
||||
done
|
||||
CFLAGS="$save_CFLAGS"
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C)
|
||||
])# ACX_PROG_CC_WARNING_OPTS
|
||||
|
||||
227
config/warnings.m4
Normal file
227
config/warnings.m4
Normal file
@@ -0,0 +1,227 @@
|
||||
# Autoconf include file defining macros related to compile-time warnings.
|
||||
|
||||
# Copyright 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
|
||||
|
||||
#This file is part of GCC.
|
||||
|
||||
#GCC is free software; you can redistribute it and/or modify it under
|
||||
#the terms of the GNU General Public License as published by the Free
|
||||
#Software Foundation; either version 3, or (at your option) any later
|
||||
#version.
|
||||
|
||||
#GCC is distributed in the hope that it will be useful, but WITHOUT
|
||||
#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
#for more details.
|
||||
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with GCC; see the file COPYING3. If not see
|
||||
#<http://www.gnu.org/licenses/>.
|
||||
|
||||
# ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS])
|
||||
# Sets @VARIABLE@ to the subset of the given options which the
|
||||
# compiler accepts.
|
||||
AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
|
||||
[AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_LANG_PUSH(C)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
for real_option in $1; do
|
||||
# Do the check with the no- prefix removed since gcc silently
|
||||
# accepts any -Wno-* option on purpose
|
||||
case $real_option in
|
||||
-Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
|
||||
*) option=$real_option ;;
|
||||
esac
|
||||
AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
|
||||
AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
|
||||
[CFLAGS="$option"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[AS_VAR_SET(acx_Woption, yes)],
|
||||
[AS_VAR_SET(acx_Woption, no)])
|
||||
])
|
||||
AS_IF([test AS_VAR_GET(acx_Woption) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }$real_option"])
|
||||
AS_VAR_POPDEF([acx_Woption])dnl
|
||||
done
|
||||
CFLAGS="$save_CFLAGS"
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C)
|
||||
])# ACX_PROG_CC_WARNING_OPTS
|
||||
|
||||
# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC])
|
||||
# Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC
|
||||
# and accepts all of those options simultaneously, otherwise to nothing.
|
||||
AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC],
|
||||
[AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_LANG_PUSH(C)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
# Do the check with the no- prefix removed from the warning options
|
||||
# since gcc silently accepts any -Wno-* option on purpose
|
||||
m4_pushdef([acx_Woptions], [m4_bpatsubst([$1], [-Wno-], [-W])])dnl
|
||||
AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_]acx_Woptions)dnl
|
||||
AS_IF([test "$GCC" = yes],
|
||||
[AC_CACHE_CHECK([whether $CC supports -pedantic ]acx_Woptions, acx_Pedantic,
|
||||
[save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-pedantic acx_Woptions"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[AS_VAR_SET(acx_Pedantic, yes)],
|
||||
[AS_VAR_SET(acx_Pedantic, no)])
|
||||
CFLAGS="$save_CFLAGS"])
|
||||
AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"])
|
||||
])
|
||||
AS_VAR_POPDEF([acx_Pedantic])dnl
|
||||
m4_popdef([acx_Woptions])dnl
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C)
|
||||
])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
|
||||
|
||||
# ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR])
|
||||
# sets @VARIABLE@ to "-Werror" if the compiler is GCC >=x.y.z, or if
|
||||
# --enable-werror-always was given on the command line, otherwise
|
||||
# to nothing.
|
||||
# If the argument is the word "manual" instead of a version number,
|
||||
# then @VARIABLE@ will be set to -Werror only if --enable-werror-always
|
||||
# appeared on the configure command line.
|
||||
AC_DEFUN([ACX_PROG_CC_WARNINGS_ARE_ERRORS],
|
||||
[AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_LANG_PUSH(C)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WERROR])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
AC_ARG_ENABLE(werror-always,
|
||||
AS_HELP_STRING([--enable-werror-always],
|
||||
[enable -Werror despite compiler version]),
|
||||
[], [enable_werror_always=no])
|
||||
AS_IF([test $enable_werror_always = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-Werror"])
|
||||
m4_if($1, [manual],,
|
||||
[AS_VAR_PUSHDEF([acx_GCCvers], [acx_cv_prog_cc_gcc_$1_or_newer])dnl
|
||||
AC_CACHE_CHECK([whether $CC is GCC >=$1], acx_GCCvers,
|
||||
[set fnord `echo $1 | tr '.' ' '`
|
||||
shift
|
||||
AC_PREPROC_IFELSE(
|
||||
[#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
|
||||
< [$]1 * 10000 + [$]2 * 100 + [$]3
|
||||
#error insufficient
|
||||
#endif],
|
||||
[AS_VAR_SET(acx_GCCvers, yes)],
|
||||
[AS_VAR_SET(acx_GCCvers, no)])])
|
||||
AS_IF([test AS_VAR_GET(acx_GCCvers) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-Werror"])
|
||||
AS_VAR_POPDEF([acx_GCCvers])])
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C)
|
||||
])# ACX_PROG_CC_WARNINGS_ARE_ERRORS
|
||||
|
||||
# ACX_PROG_CXX_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CXXFLAGS])
|
||||
# Sets @VARIABLE@ to the subset of the given options which the
|
||||
# compiler accepts.
|
||||
AC_DEFUN([ACX_PROG_CXX_WARNING_OPTS],
|
||||
[AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_LANG_PUSH(C++)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WARN_CXXFLAGS])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
save_CXXFLAGS="$CXXFLAGS"
|
||||
for real_option in $1; do
|
||||
# Do the check with the no- prefix removed since gcc silently
|
||||
# accepts any -Wno-* option on purpose
|
||||
case $real_option in
|
||||
-Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
|
||||
*) option=$real_option ;;
|
||||
esac
|
||||
AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
|
||||
AC_CACHE_CHECK([whether $CXX supports $option], acx_Woption,
|
||||
[CXXFLAGS="$option"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[AS_VAR_SET(acx_Woption, yes)],
|
||||
[AS_VAR_SET(acx_Woption, no)])
|
||||
])
|
||||
AS_IF([test AS_VAR_GET(acx_Woption) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }$real_option"])
|
||||
AS_VAR_POPDEF([acx_Woption])dnl
|
||||
done
|
||||
CXXFLAGS="$save_CXXFLAGS"
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C++)
|
||||
])# ACX_PROG_CXX_WARNING_OPTS
|
||||
|
||||
# ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC])
|
||||
# Append to VARIABLE "-pedantic" + the argument, if the compiler is G++
|
||||
# and accepts all of those options simultaneously, otherwise to nothing.
|
||||
AC_DEFUN([ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC],
|
||||
[AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_LANG_PUSH(C++)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
# Do the check with the no- prefix removed from the warning options
|
||||
# since gcc silently accepts any -Wno-* option on purpose
|
||||
m4_pushdef([acx_Woptions], [m4_bpatsubst([$1], [-Wno-], [-W])])dnl
|
||||
AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_]acx_Woptions)dnl
|
||||
AS_IF([test "$GXX" = yes],
|
||||
[AC_CACHE_CHECK([whether $CXX supports -pedantic ]acx_Woptions, acx_Pedantic,
|
||||
[save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="-pedantic acx_Woptions"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[AS_VAR_SET(acx_Pedantic, yes)],
|
||||
[AS_VAR_SET(acx_Pedantic, no)])
|
||||
CXXFLAGS="$save_CXXFLAGS"])
|
||||
AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"])
|
||||
])
|
||||
AS_VAR_POPDEF([acx_Pedantic])dnl
|
||||
m4_popdef([acx_Woptions])dnl
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C++)
|
||||
])# ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC
|
||||
|
||||
# ACX_PROG_CXX_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR])
|
||||
# sets @VARIABLE@ to "-Werror" if the compiler is G++ >=x.y.z, or if
|
||||
# --enable-werror-always was given on the command line, otherwise
|
||||
# to nothing.
|
||||
# If the argument is the word "manual" instead of a version number,
|
||||
# then @VARIABLE@ will be set to -Werror only if --enable-werror-always
|
||||
# appeared on the configure command line.
|
||||
AC_DEFUN([ACX_PROG_CXX_WARNINGS_ARE_ERRORS],
|
||||
[AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_LANG_PUSH(C++)
|
||||
m4_pushdef([acx_Var], [m4_default([$2], [WERROR])])dnl
|
||||
AC_SUBST(acx_Var)dnl
|
||||
m4_expand_once([acx_Var=
|
||||
],m4_quote(acx_Var=))dnl
|
||||
AC_ARG_ENABLE(werror-always,
|
||||
AS_HELP_STRING([--enable-werror-always],
|
||||
[enable -Werror despite compiler version]),
|
||||
[], [enable_werror_always=no])
|
||||
AS_IF([test $enable_werror_always = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-Werror"])
|
||||
m4_if($1, [manual],,
|
||||
[AS_VAR_PUSHDEF([acx_GXXvers], [acx_cv_prog_cxx_gxx_$1_or_newer])dnl
|
||||
AC_CACHE_CHECK([whether $CXX is G++ >=$1], acx_GXXvers,
|
||||
[set fnord `echo $1 | tr '.' ' '`
|
||||
shift
|
||||
AC_PREPROC_IFELSE(
|
||||
[#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
|
||||
< [$]1 * 10000 + [$]2 * 100 + [$]3
|
||||
#error insufficient
|
||||
#endif],
|
||||
[AS_VAR_SET(acx_GXXvers, yes)],
|
||||
[AS_VAR_SET(acx_GXXvers, no)])])
|
||||
AS_IF([test AS_VAR_GET(acx_GXXvers) = yes],
|
||||
[acx_Var="$acx_Var${acx_Var:+ }-Werror"])
|
||||
AS_VAR_POPDEF([acx_GXXvers])])
|
||||
m4_popdef([acx_Var])dnl
|
||||
AC_LANG_POP(C++)
|
||||
])# ACX_PROG_CXX_WARNINGS_ARE_ERRORS
|
||||
38
configure.ac
38
configure.ac
@@ -1,5 +1,5 @@
|
||||
# configure.ac -- Backtrace configure script.
|
||||
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
@@ -29,7 +29,7 @@
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
AC_PREREQ(2.64)
|
||||
AC_PREREQ(2.69)
|
||||
AC_INIT(package-unused, version-unused,, libbacktrace)
|
||||
AC_CONFIG_SRCDIR(backtrace.h)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
@@ -45,6 +45,9 @@ target_alias=${target_alias-$host_alias}
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
# Default to not building a shared library.
|
||||
AC_DISABLE_SHARED
|
||||
|
||||
libtool_VERSION=1:0:0
|
||||
AC_SUBST(libtool_VERSION)
|
||||
|
||||
@@ -74,11 +77,16 @@ m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_PROG_AWK
|
||||
case "$AWK" in
|
||||
"") AC_MSG_ERROR([can't build without awk]) ;;
|
||||
esac
|
||||
|
||||
AC_CHECK_PROG(DWZ, dwz, dwz)
|
||||
AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
|
||||
|
||||
LT_INIT
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
@@ -251,6 +259,7 @@ elf64) elfsize=64 ;;
|
||||
*) elfsize=unused
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
|
||||
AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo")
|
||||
|
||||
# XCOFF defines.
|
||||
xcoffsize=
|
||||
@@ -297,12 +306,12 @@ if test "$have_mmap" = "no"; then
|
||||
ALLOC_FILE=alloc.lo
|
||||
else
|
||||
VIEW_FILE=mmapio.lo
|
||||
AC_PREPROC_IFELSE([
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
|
||||
#include <sys/mman.h>
|
||||
#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
|
||||
#error no MAP_ANONYMOUS
|
||||
#endif
|
||||
], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
|
||||
])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
|
||||
fi
|
||||
AC_SUBST(VIEW_FILE)
|
||||
AC_SUBST(ALLOC_FILE)
|
||||
@@ -406,7 +415,7 @@ AC_CACHE_CHECK([whether -pthread is supported],
|
||||
[libgo_cv_lib_pthread],
|
||||
[CFLAGS_hold=$CFLAGS
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
AC_COMPILE_IFELSE([[int i;]],
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
||||
[libgo_cv_lib_pthread=yes],
|
||||
[libgo_cv_lib_pthread=no])
|
||||
CFLAGS=$CFLAGS_hold])
|
||||
@@ -418,10 +427,19 @@ AC_SUBST(PTHREAD_CFLAGS)
|
||||
|
||||
AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
|
||||
|
||||
AC_CHECK_LIB([z], [compress], [])
|
||||
if test $ac_cv_lib_z_compress = "yes"; then
|
||||
AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])
|
||||
fi
|
||||
dnl Test whether the compiler supports the -gdwarf-5 option.
|
||||
AC_CACHE_CHECK([whether -gdwarf-5 is supported],
|
||||
[libbacktrace_cv_lib_dwarf5],
|
||||
[CFLAGS_hold=$CFLAGS
|
||||
CFLAGS="$CFLAGS -gdwarf-5"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
|
||||
[libbacktrace_cv_lib_dwarf5=yes],
|
||||
[libbacktrace_cv_lib_dwarf5=no])
|
||||
CFLAGS=$CFLAGS_hold])
|
||||
AM_CONDITIONAL(HAVE_DWARF5, test "$libbacktrace_cv_lib_dwarf5" = yes)
|
||||
|
||||
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.
|
||||
@@ -437,6 +455,7 @@ AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
|
||||
|
||||
AC_ARG_VAR(OBJCOPY, [location of objcopy])
|
||||
AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
|
||||
AC_CHECK_PROG(READELF, readelf, readelf)
|
||||
AC_CACHE_CHECK([whether objcopy supports debuglink],
|
||||
[libbacktrace_cv_objcopy_debuglink],
|
||||
[if test -n "${with_target_subdir}"; then
|
||||
@@ -464,6 +483,7 @@ else
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES(Makefile backtrace-supported.h)
|
||||
AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
|
||||
|
||||
# We need multilib support, but only if configuring for the target.
|
||||
AC_CONFIG_COMMANDS([default],
|
||||
|
||||
5
edtest.c
5
edtest.c
@@ -1,5 +1,5 @@
|
||||
/* edtest.c -- Test for libbacktrace storage allocation stress handling
|
||||
Copyright (C) 2017-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
@@ -43,8 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "testlib.h"
|
||||
|
||||
static int test1 (void) __attribute__ ((noinline, unused));
|
||||
static int test1 (void) __attribute__ ((noinline, unused));
|
||||
static int test1 (void) __attribute__ ((noinline, noclone, unused));
|
||||
extern int f2 (int);
|
||||
extern int f3 (int, int);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* edtest2.c -- Test for libbacktrace storage allocation stress handling (p2)
|
||||
Copyright (C) 2017-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
|
||||
223
elf.c
223
elf.c
@@ -1,5 +1,5 @@
|
||||
/* elf.c -- Get debug data from an ELF file for backtraces.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -337,41 +337,19 @@ typedef struct
|
||||
|
||||
#define ELFCOMPRESS_ZLIB 1
|
||||
|
||||
/* An index of ELF sections we care about. */
|
||||
/* Names of sections, indexed by enum dwarf_section in internal.h. */
|
||||
|
||||
enum debug_section
|
||||
{
|
||||
DEBUG_INFO,
|
||||
DEBUG_LINE,
|
||||
DEBUG_ABBREV,
|
||||
DEBUG_RANGES,
|
||||
DEBUG_STR,
|
||||
|
||||
/* The old style compressed sections. This list must correspond to
|
||||
the list of normal debug sections. */
|
||||
ZDEBUG_INFO,
|
||||
ZDEBUG_LINE,
|
||||
ZDEBUG_ABBREV,
|
||||
ZDEBUG_RANGES,
|
||||
ZDEBUG_STR,
|
||||
|
||||
DEBUG_MAX
|
||||
};
|
||||
|
||||
/* Names of sections, indexed by enum elf_section. */
|
||||
|
||||
static const char * const debug_section_names[DEBUG_MAX] =
|
||||
static const char * const dwarf_section_names[DEBUG_MAX] =
|
||||
{
|
||||
".debug_info",
|
||||
".debug_line",
|
||||
".debug_abbrev",
|
||||
".debug_ranges",
|
||||
".debug_str",
|
||||
".zdebug_info",
|
||||
".zdebug_line",
|
||||
".zdebug_abbrev",
|
||||
".zdebug_ranges",
|
||||
".zdebug_str"
|
||||
".debug_addr",
|
||||
".debug_str_offsets",
|
||||
".debug_line_str",
|
||||
".debug_rnglists"
|
||||
};
|
||||
|
||||
/* Information we gather for the sections we care about. */
|
||||
@@ -809,6 +787,8 @@ elf_readlink (struct backtrace_state *state, const char *filename,
|
||||
}
|
||||
}
|
||||
|
||||
#define SYSTEM_BUILD_ID_DIR "/usr/lib/debug/.build-id/"
|
||||
|
||||
/* Open a separate debug info file, using the build ID to find it.
|
||||
Returns an open file descriptor, or -1.
|
||||
|
||||
@@ -821,7 +801,7 @@ elf_open_debugfile_by_buildid (struct backtrace_state *state,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data)
|
||||
{
|
||||
const char * const prefix = "/usr/lib/debug/.build-id/";
|
||||
const char * const prefix = SYSTEM_BUILD_ID_DIR;
|
||||
const size_t prefix_len = strlen (prefix);
|
||||
const char * const suffix = ".debug";
|
||||
const size_t suffix_len = strlen (suffix);
|
||||
@@ -2638,7 +2618,8 @@ static int
|
||||
elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
uintptr_t base_address, backtrace_error_callback error_callback,
|
||||
void *data, fileline *fileline_fn, int *found_sym, int *found_dwarf,
|
||||
int exe, int debuginfo)
|
||||
struct dwarf_data **fileline_entry, int exe, int debuginfo,
|
||||
const char *with_buildid_data, uint32_t with_buildid_size)
|
||||
{
|
||||
struct backtrace_view ehdr_view;
|
||||
b_elf_ehdr ehdr;
|
||||
@@ -2658,6 +2639,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
unsigned int dynsym_shndx;
|
||||
unsigned int i;
|
||||
struct debug_section_info sections[DEBUG_MAX];
|
||||
struct debug_section_info zsections[DEBUG_MAX];
|
||||
struct backtrace_view symtab_view;
|
||||
int symtab_view_valid;
|
||||
struct backtrace_view strtab_view;
|
||||
@@ -2670,6 +2652,11 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
int debuglink_view_valid;
|
||||
const char *debuglink_name;
|
||||
uint32_t debuglink_crc;
|
||||
struct backtrace_view debugaltlink_view;
|
||||
int debugaltlink_view_valid;
|
||||
const char *debugaltlink_name;
|
||||
const char *debugaltlink_buildid_data;
|
||||
uint32_t debugaltlink_buildid_size;
|
||||
off_t min_offset;
|
||||
off_t max_offset;
|
||||
struct backtrace_view debug_view;
|
||||
@@ -2677,6 +2664,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
unsigned int using_debug_view;
|
||||
uint16_t *zdebug_table;
|
||||
struct elf_ppc64_opd_data opd_data, *opd;
|
||||
struct dwarf_sections dwarf_sections;
|
||||
|
||||
if (!debuginfo)
|
||||
{
|
||||
@@ -2694,6 +2682,10 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
debuglink_view_valid = 0;
|
||||
debuglink_name = NULL;
|
||||
debuglink_crc = 0;
|
||||
debugaltlink_view_valid = 0;
|
||||
debugaltlink_name = NULL;
|
||||
debugaltlink_buildid_data = NULL;
|
||||
debugaltlink_buildid_size = 0;
|
||||
debug_view_valid = 0;
|
||||
opd = NULL;
|
||||
|
||||
@@ -2803,7 +2795,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
shstr_size = shstrhdr->sh_size;
|
||||
shstr_off = shstrhdr->sh_offset;
|
||||
|
||||
if (!backtrace_get_view (state, descriptor, shstr_off, shstr_size,
|
||||
if (!backtrace_get_view (state, descriptor, shstr_off, shstrhdr->sh_size,
|
||||
error_callback, data, &names_view))
|
||||
goto fail;
|
||||
names_view_valid = 1;
|
||||
@@ -2813,6 +2805,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
dynsym_shndx = 0;
|
||||
|
||||
memset (sections, 0, sizeof sections);
|
||||
memset (zsections, 0, sizeof zsections);
|
||||
|
||||
/* Look for the symbol table. */
|
||||
for (i = 1; i < shnum; ++i)
|
||||
@@ -2840,7 +2833,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
|
||||
for (j = 0; j < (int) DEBUG_MAX; ++j)
|
||||
{
|
||||
if (strcmp (name, debug_section_names[j]) == 0)
|
||||
if (strcmp (name, dwarf_section_names[j]) == 0)
|
||||
{
|
||||
sections[j].offset = shdr->sh_offset;
|
||||
sections[j].size = shdr->sh_size;
|
||||
@@ -2849,10 +2842,23 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
}
|
||||
}
|
||||
|
||||
if (name[0] == '.' && name[1] == 'z')
|
||||
{
|
||||
for (j = 0; j < (int) DEBUG_MAX; ++j)
|
||||
{
|
||||
if (strcmp (name + 2, dwarf_section_names[j] + 1) == 0)
|
||||
{
|
||||
zsections[j].offset = shdr->sh_offset;
|
||||
zsections[j].size = shdr->sh_size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the build ID if present. This could check for any
|
||||
SHT_NOTE section with the right note name and type, but gdb
|
||||
looks for a specific section name. */
|
||||
if (!debuginfo
|
||||
if ((!debuginfo || with_buildid_data != NULL)
|
||||
&& !buildid_view_valid
|
||||
&& strcmp (name, ".note.gnu.build-id") == 0)
|
||||
{
|
||||
@@ -2868,11 +2874,20 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
if (note->type == NT_GNU_BUILD_ID
|
||||
&& note->namesz == 4
|
||||
&& strncmp (note->name, "GNU", 4) == 0
|
||||
&& shdr->sh_size < 12 + ((note->namesz + 3) & ~ 3) + note->descsz)
|
||||
&& shdr->sh_size <= 12 + ((note->namesz + 3) & ~ 3) + note->descsz)
|
||||
{
|
||||
buildid_data = ¬e->name[0] + ((note->namesz + 3) & ~ 3);
|
||||
buildid_size = note->descsz;
|
||||
}
|
||||
|
||||
if (with_buildid_size != 0)
|
||||
{
|
||||
if (buildid_size != with_buildid_size)
|
||||
goto fail;
|
||||
|
||||
if (memcmp (buildid_data, with_buildid_data, buildid_size) != 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the debuglink file if present. */
|
||||
@@ -2899,6 +2914,32 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
}
|
||||
}
|
||||
|
||||
if (!debugaltlink_view_valid
|
||||
&& strcmp (name, ".gnu_debugaltlink") == 0)
|
||||
{
|
||||
const char *debugaltlink_data;
|
||||
size_t debugaltlink_name_len;
|
||||
|
||||
if (!backtrace_get_view (state, descriptor, shdr->sh_offset,
|
||||
shdr->sh_size, error_callback, data,
|
||||
&debugaltlink_view))
|
||||
goto fail;
|
||||
|
||||
debugaltlink_view_valid = 1;
|
||||
debugaltlink_data = (const char *) debugaltlink_view.data;
|
||||
debugaltlink_name = debugaltlink_data;
|
||||
debugaltlink_name_len = strnlen (debugaltlink_data, shdr->sh_size);
|
||||
if (debugaltlink_name_len < shdr->sh_size)
|
||||
{
|
||||
/* Include terminating zero. */
|
||||
debugaltlink_name_len += 1;
|
||||
|
||||
debugaltlink_buildid_data
|
||||
= debugaltlink_data + debugaltlink_name_len;
|
||||
debugaltlink_buildid_size = shdr->sh_size - debugaltlink_name_len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the .opd section on PowerPC64 ELFv1. */
|
||||
if (ehdr.e_machine == EM_PPC64
|
||||
&& (ehdr.e_flags & EF_PPC64_ABI) < 2
|
||||
@@ -2993,8 +3034,12 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
if (debuglink_view_valid)
|
||||
backtrace_release_view (state, &debuglink_view, error_callback,
|
||||
data);
|
||||
ret = elf_add (state, NULL, d, base_address, error_callback, data,
|
||||
fileline_fn, found_sym, found_dwarf, 0, 1);
|
||||
if (debugaltlink_view_valid)
|
||||
backtrace_release_view (state, &debugaltlink_view, error_callback,
|
||||
data);
|
||||
ret = elf_add (state, "", d, base_address, error_callback, data,
|
||||
fileline_fn, found_sym, found_dwarf, NULL, 0, 1, NULL,
|
||||
0);
|
||||
if (ret < 0)
|
||||
backtrace_close (d, error_callback, data);
|
||||
else
|
||||
@@ -3028,8 +3073,12 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
|
||||
backtrace_release_view (state, &debuglink_view, error_callback,
|
||||
data);
|
||||
ret = elf_add (state, NULL, d, base_address, error_callback, data,
|
||||
fileline_fn, found_sym, found_dwarf, 0, 1);
|
||||
if (debugaltlink_view_valid)
|
||||
backtrace_release_view (state, &debugaltlink_view, error_callback,
|
||||
data);
|
||||
ret = elf_add (state, "", d, base_address, error_callback, data,
|
||||
fileline_fn, found_sym, found_dwarf, NULL, 0, 1, NULL,
|
||||
0);
|
||||
if (ret < 0)
|
||||
backtrace_close (d, error_callback, data);
|
||||
else
|
||||
@@ -3044,8 +3093,41 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
debuglink_view_valid = 0;
|
||||
}
|
||||
|
||||
struct dwarf_data *fileline_altlink = NULL;
|
||||
if (debugaltlink_name != NULL)
|
||||
{
|
||||
int d;
|
||||
|
||||
d = elf_open_debugfile_by_debuglink (state, filename, debugaltlink_name,
|
||||
0, error_callback, data);
|
||||
if (d >= 0)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = elf_add (state, filename, d, base_address, error_callback, data,
|
||||
fileline_fn, found_sym, found_dwarf, &fileline_altlink,
|
||||
0, 1, debugaltlink_buildid_data,
|
||||
debugaltlink_buildid_size);
|
||||
backtrace_release_view (state, &debugaltlink_view, error_callback,
|
||||
data);
|
||||
debugaltlink_view_valid = 0;
|
||||
if (ret < 0)
|
||||
{
|
||||
backtrace_close (d, error_callback, data);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debugaltlink_view_valid)
|
||||
{
|
||||
backtrace_release_view (state, &debugaltlink_view, error_callback, data);
|
||||
debugaltlink_view_valid = 0;
|
||||
}
|
||||
|
||||
/* Read all the debug sections in a single view, since they are
|
||||
probably adjacent in the file. We never release this view. */
|
||||
probably adjacent in the file. If any of sections are
|
||||
uncompressed, we never release this view. */
|
||||
|
||||
min_offset = 0;
|
||||
max_offset = 0;
|
||||
@@ -3053,14 +3135,23 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
{
|
||||
off_t end;
|
||||
|
||||
if (sections[i].size == 0)
|
||||
continue;
|
||||
if (sections[i].size != 0)
|
||||
{
|
||||
if (min_offset == 0 || sections[i].offset < min_offset)
|
||||
min_offset = sections[i].offset;
|
||||
end = sections[i].offset + sections[i].size;
|
||||
if (end > max_offset)
|
||||
max_offset = end;
|
||||
}
|
||||
if (zsections[i].size != 0)
|
||||
{
|
||||
if (min_offset == 0 || zsections[i].offset < min_offset)
|
||||
min_offset = zsections[i].offset;
|
||||
end = zsections[i].offset + zsections[i].size;
|
||||
if (end > max_offset)
|
||||
max_offset = end;
|
||||
}
|
||||
}
|
||||
if (min_offset == 0 || max_offset == 0)
|
||||
{
|
||||
if (!backtrace_close (descriptor, error_callback, data))
|
||||
@@ -3088,20 +3179,22 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
{
|
||||
sections[i].data = ((const unsigned char *) debug_view.data
|
||||
+ (sections[i].offset - min_offset));
|
||||
if (i < ZDEBUG_INFO)
|
||||
++using_debug_view;
|
||||
}
|
||||
|
||||
if (zsections[i].size == 0)
|
||||
zsections[i].data = NULL;
|
||||
else
|
||||
zsections[i].data = ((const unsigned char *) debug_view.data
|
||||
+ (zsections[i].offset - min_offset));
|
||||
}
|
||||
|
||||
/* Uncompress the old format (--compress-debug-sections=zlib-gnu). */
|
||||
|
||||
zdebug_table = NULL;
|
||||
for (i = 0; i < ZDEBUG_INFO; ++i)
|
||||
for (i = 0; i < (int) DEBUG_MAX; ++i)
|
||||
{
|
||||
struct debug_section_info *pz;
|
||||
|
||||
pz = §ions[i + ZDEBUG_INFO - DEBUG_INFO];
|
||||
if (sections[i].size == 0 && pz->size > 0)
|
||||
if (sections[i].size == 0 && zsections[i].size > 0)
|
||||
{
|
||||
unsigned char *uncompressed_data;
|
||||
size_t uncompressed_size;
|
||||
@@ -3117,7 +3210,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
|
||||
uncompressed_data = NULL;
|
||||
uncompressed_size = 0;
|
||||
if (!elf_uncompress_zdebug (state, pz->data, pz->size, zdebug_table,
|
||||
if (!elf_uncompress_zdebug (state, zsections[i].data,
|
||||
zsections[i].size, zdebug_table,
|
||||
error_callback, data,
|
||||
&uncompressed_data, &uncompressed_size))
|
||||
goto fail;
|
||||
@@ -3129,7 +3223,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
|
||||
/* Uncompress the official ELF format
|
||||
(--compress-debug-sections=zlib-gabi). */
|
||||
for (i = 0; i < ZDEBUG_INFO; ++i)
|
||||
for (i = 0; i < (int) DEBUG_MAX; ++i)
|
||||
{
|
||||
unsigned char *uncompressed_data;
|
||||
size_t uncompressed_size;
|
||||
@@ -3169,19 +3263,17 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
debug_view_valid = 0;
|
||||
}
|
||||
|
||||
if (!backtrace_dwarf_add (state, base_address,
|
||||
sections[DEBUG_INFO].data,
|
||||
sections[DEBUG_INFO].size,
|
||||
sections[DEBUG_LINE].data,
|
||||
sections[DEBUG_LINE].size,
|
||||
sections[DEBUG_ABBREV].data,
|
||||
sections[DEBUG_ABBREV].size,
|
||||
sections[DEBUG_RANGES].data,
|
||||
sections[DEBUG_RANGES].size,
|
||||
sections[DEBUG_STR].data,
|
||||
sections[DEBUG_STR].size,
|
||||
for (i = 0; i < (int) DEBUG_MAX; ++i)
|
||||
{
|
||||
dwarf_sections.data[i] = sections[i].data;
|
||||
dwarf_sections.size[i] = sections[i].size;
|
||||
}
|
||||
|
||||
if (!backtrace_dwarf_add (state, base_address, &dwarf_sections,
|
||||
ehdr.e_ident[EI_DATA] == ELFDATA2MSB,
|
||||
error_callback, data, fileline_fn))
|
||||
fileline_altlink,
|
||||
error_callback, data, fileline_fn,
|
||||
fileline_entry))
|
||||
goto fail;
|
||||
|
||||
*found_dwarf = 1;
|
||||
@@ -3199,6 +3291,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
backtrace_release_view (state, &strtab_view, error_callback, data);
|
||||
if (debuglink_view_valid)
|
||||
backtrace_release_view (state, &debuglink_view, error_callback, data);
|
||||
if (debugaltlink_view_valid)
|
||||
backtrace_release_view (state, &debugaltlink_view, error_callback, data);
|
||||
if (buildid_view_valid)
|
||||
backtrace_release_view (state, &buildid_view, error_callback, data);
|
||||
if (debug_view_valid)
|
||||
@@ -3269,7 +3363,7 @@ phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
|
||||
|
||||
if (elf_add (pd->state, filename, descriptor, info->dlpi_addr,
|
||||
pd->error_callback, pd->data, &elf_fileline_fn, pd->found_sym,
|
||||
&found_dwarf, 0, 0))
|
||||
&found_dwarf, NULL, 0, 0, NULL, 0))
|
||||
{
|
||||
if (found_dwarf)
|
||||
{
|
||||
@@ -3297,7 +3391,8 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
|
||||
struct phdr_data pd;
|
||||
|
||||
ret = elf_add (state, filename, descriptor, 0, error_callback, data,
|
||||
&elf_fileline_fn, &found_sym, &found_dwarf, 1, 0);
|
||||
&elf_fileline_fn, &found_sym, &found_dwarf, NULL, 1, 0, NULL,
|
||||
0);
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* fileline.c -- Get file and line number information in a backtrace.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -44,6 +44,9 @@ POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
|
||||
# define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
|
||||
# define HAS_DRIVE_SPEC(f) ((f)[0] != '\0' && (f)[1] == ':')
|
||||
# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f))
|
||||
#else
|
||||
# define IS_DIR_SEPARATOR(c) ((c) == '/')
|
||||
# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
|
||||
#endif
|
||||
|
||||
@@ -3,3 +3,6 @@
|
||||
/\177ELF\002/ { if (NR == 1) { print "elf64"; exit } }
|
||||
/\114\001/ { if (NR == 1) { print "pecoff"; exit } }
|
||||
/\144\206/ { if (NR == 1) { print "pecoff"; exit } }
|
||||
/\001\337/ { if (NR == 1) { print "xcoff32"; exit } }
|
||||
/\001\367/ { if (NR == 1) { print "xcoff64"; exit } }
|
||||
|
||||
|
||||
65
install-debuginfo-for-buildid.sh.in
Normal file
65
install-debuginfo-for-buildid.sh.in
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
# install-debug-info-for-buildid.sh -- Helper script for libbacktrace library
|
||||
# testing.
|
||||
# Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
|
||||
# (1) Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
|
||||
# (2) Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
|
||||
# (3) The name of the author may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Extract build-id from src, and copy debug info of src to
|
||||
# $build_id_dir/aa/bb...zz.debug.
|
||||
|
||||
set -e
|
||||
|
||||
sed=@SED@
|
||||
awk=@AWK@
|
||||
grep=@GREP@
|
||||
objcopy=@OBJCOPY@
|
||||
readelf=@READELF@
|
||||
mkdir_p="@MKDIR_P@"
|
||||
|
||||
build_id_dir="$1"
|
||||
src="$2"
|
||||
|
||||
buildid=$($readelf -n $src \
|
||||
| $grep "Build ID" \
|
||||
| $awk '{print $3}')
|
||||
|
||||
prefix=$(echo $buildid \
|
||||
| $sed 's/^\(.\{2\}\).*/\1/')
|
||||
|
||||
remainder=$(echo $buildid \
|
||||
| $sed 's/^.\{2\}//')
|
||||
|
||||
dir=$build_id_dir/$prefix
|
||||
dst=$dir/$remainder.debug
|
||||
|
||||
$mkdir_p $dir
|
||||
|
||||
$objcopy --only-keep-debug $src $dst
|
||||
114
instrumented_alloc.c
Normal file
114
instrumented_alloc.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* instrumented_alloc.c -- Memory allocation instrumented to fail when
|
||||
requested, for testing purposes.
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
(2) Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
(3) The name of the author may not be used to
|
||||
endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
/* Include all the header files of alloc here, to make sure they're not
|
||||
processed when including alloc.c below, such that the redefinitions of malloc
|
||||
and realloc are only effective in alloc.c itself. This does not work for
|
||||
config.h, because it's not wrapped in "#ifndef CONFIG_H\n#define CONFIG_H"
|
||||
and "#endif" but that does not seem to be harmful. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "internal.h"
|
||||
|
||||
extern void *instrumented_malloc (size_t size);
|
||||
extern void *instrumented_realloc (void *ptr, size_t size);
|
||||
|
||||
#define malloc instrumented_malloc
|
||||
#define realloc instrumented_realloc
|
||||
#include "alloc.c"
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
|
||||
static uint64_t nr_allocs = 0;
|
||||
static uint64_t fail_at_alloc = 0;
|
||||
|
||||
extern int at_fail_alloc_p (void);
|
||||
extern uint64_t get_nr_allocs (void);
|
||||
extern void set_fail_at_alloc (uint64_t);
|
||||
|
||||
void *
|
||||
instrumented_malloc (size_t size)
|
||||
{
|
||||
void *res;
|
||||
|
||||
if (at_fail_alloc_p ())
|
||||
return NULL;
|
||||
|
||||
res = malloc (size);
|
||||
if (res != NULL)
|
||||
nr_allocs++;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void *
|
||||
instrumented_realloc (void *ptr, size_t size)
|
||||
{
|
||||
void *res;
|
||||
|
||||
if (size != 0)
|
||||
{
|
||||
if (at_fail_alloc_p ())
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = realloc (ptr, size);
|
||||
if (res != NULL)
|
||||
nr_allocs++;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
at_fail_alloc_p (void)
|
||||
{
|
||||
return fail_at_alloc == nr_allocs + 1;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
get_nr_allocs (void)
|
||||
{
|
||||
return nr_allocs;
|
||||
}
|
||||
|
||||
void
|
||||
set_fail_at_alloc (uint64_t nr)
|
||||
{
|
||||
fail_at_alloc = nr;
|
||||
}
|
||||
60
internal.h
60
internal.h
@@ -1,5 +1,5 @@
|
||||
/* internal.h -- Internal header file for stack backtrace library.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -179,7 +179,7 @@ struct backtrace_view
|
||||
/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. Store the
|
||||
result in *VIEW. Returns 1 on success, 0 on error. */
|
||||
extern int backtrace_get_view (struct backtrace_state *state, int descriptor,
|
||||
off_t offset, size_t size,
|
||||
off_t offset, uint64_t size,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, struct backtrace_view *view);
|
||||
|
||||
@@ -257,6 +257,18 @@ extern int backtrace_vector_release (struct backtrace_state *state,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data);
|
||||
|
||||
/* Free the space managed by VEC. This will reset VEC. */
|
||||
|
||||
static inline void
|
||||
backtrace_vector_free (struct backtrace_state *state,
|
||||
struct backtrace_vector *vec,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
{
|
||||
vec->alc += vec->size;
|
||||
vec->size = 0;
|
||||
backtrace_vector_release (state, vec, error_callback, data);
|
||||
}
|
||||
|
||||
/* Read initial debug data from a descriptor, and set the
|
||||
fileline_data, syminfo_fn, and syminfo_data fields of STATE.
|
||||
Return the fileln_fn field in *FILELN_FN--this is done this way so
|
||||
@@ -274,23 +286,45 @@ extern int backtrace_initialize (struct backtrace_state *state,
|
||||
void *data,
|
||||
fileline *fileline_fn);
|
||||
|
||||
/* An enum for the DWARF sections we care about. */
|
||||
|
||||
enum dwarf_section
|
||||
{
|
||||
DEBUG_INFO,
|
||||
DEBUG_LINE,
|
||||
DEBUG_ABBREV,
|
||||
DEBUG_RANGES,
|
||||
DEBUG_STR,
|
||||
DEBUG_ADDR,
|
||||
DEBUG_STR_OFFSETS,
|
||||
DEBUG_LINE_STR,
|
||||
DEBUG_RNGLISTS,
|
||||
|
||||
DEBUG_MAX
|
||||
};
|
||||
|
||||
/* Data for the DWARF sections we care about. */
|
||||
|
||||
struct dwarf_sections
|
||||
{
|
||||
const unsigned char *data[DEBUG_MAX];
|
||||
size_t size[DEBUG_MAX];
|
||||
};
|
||||
|
||||
/* DWARF data read from a file, used for .gnu_debugaltlink. */
|
||||
|
||||
struct dwarf_data;
|
||||
|
||||
/* Add file/line information for a DWARF module. */
|
||||
|
||||
extern int backtrace_dwarf_add (struct backtrace_state *state,
|
||||
uintptr_t base_address,
|
||||
const unsigned char* dwarf_info,
|
||||
size_t dwarf_info_size,
|
||||
const unsigned char *dwarf_line,
|
||||
size_t dwarf_line_size,
|
||||
const unsigned char *dwarf_abbrev,
|
||||
size_t dwarf_abbrev_size,
|
||||
const unsigned char *dwarf_ranges,
|
||||
size_t dwarf_range_size,
|
||||
const unsigned char *dwarf_str,
|
||||
size_t dwarf_str_size,
|
||||
const struct dwarf_sections *dwarf_sections,
|
||||
int is_bigendian,
|
||||
struct dwarf_data *fileline_altlink,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, fileline *fileline_fn);
|
||||
void *data, fileline *fileline_fn,
|
||||
struct dwarf_data **fileline_entry);
|
||||
|
||||
/* A test-only hook for elf_uncompress_zdebug. */
|
||||
|
||||
|
||||
7444
libtool.m4
vendored
Normal file
7444
libtool.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
369
ltoptions.m4
vendored
Normal file
369
ltoptions.m4
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[pic_mode="$withval"],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
||||
123
ltsugar.m4
vendored
Normal file
123
ltsugar.m4
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
||||
23
ltversion.m4
vendored
Normal file
23
ltversion.m4
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3134 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.7a])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3134])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.7a'
|
||||
macro_revision='1.3134'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
98
lt~obsolete.m4
vendored
Normal file
98
lt~obsolete.m4
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
||||
4
mmap.c
4
mmap.c
@@ -1,5 +1,5 @@
|
||||
/* mmap.c -- Memory allocation with mmap.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -321,5 +321,7 @@ backtrace_vector_release (struct backtrace_state *state,
|
||||
backtrace_free (state, (char *) vec->base + aligned, alc,
|
||||
error_callback, data);
|
||||
vec->alc = 0;
|
||||
if (vec->size == 0)
|
||||
vec->base = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
10
mmapio.c
10
mmapio.c
@@ -1,5 +1,5 @@
|
||||
/* mmapio.c -- File views using mmap.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -51,7 +51,7 @@ POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
int
|
||||
backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
|
||||
int descriptor, off_t offset, size_t size,
|
||||
int descriptor, off_t offset, uint64_t size,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, struct backtrace_view *view)
|
||||
{
|
||||
@@ -60,6 +60,12 @@ backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
|
||||
off_t pageoff;
|
||||
void *map;
|
||||
|
||||
if ((uint64_t) (size_t) size != size)
|
||||
{
|
||||
error_callback (data, "file size too large", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pagesize = getpagesize ();
|
||||
inpage = offset % pagesize;
|
||||
pageoff = offset - inpage;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* backtrace.c -- Entry point for stack backtrace library.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
54
pecoff.c
54
pecoff.c
@@ -1,5 +1,5 @@
|
||||
/* pecoff.c -- Get debug data from a PE/COFFF file for backtraces.
|
||||
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2015-2019 Free Software Foundation, Inc.
|
||||
Adapted from elf.c by Tristan Gingold, AdaCore.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -133,19 +133,7 @@ typedef struct {
|
||||
uint16_t sc;
|
||||
} b_coff_internal_symbol;
|
||||
|
||||
/* An index of sections we care about. */
|
||||
|
||||
enum debug_section
|
||||
{
|
||||
DEBUG_INFO,
|
||||
DEBUG_LINE,
|
||||
DEBUG_ABBREV,
|
||||
DEBUG_RANGES,
|
||||
DEBUG_STR,
|
||||
DEBUG_MAX
|
||||
};
|
||||
|
||||
/* Names of sections, indexed by enum debug_section. */
|
||||
/* Names of sections, indexed by enum dwarf_section in internal.h. */
|
||||
|
||||
static const char * const debug_section_names[DEBUG_MAX] =
|
||||
{
|
||||
@@ -153,7 +141,11 @@ static const char * const debug_section_names[DEBUG_MAX] =
|
||||
".debug_line",
|
||||
".debug_abbrev",
|
||||
".debug_ranges",
|
||||
".debug_str"
|
||||
".debug_str",
|
||||
".debug_addr",
|
||||
".debug_str_offsets",
|
||||
".debug_line_str",
|
||||
".debug_rnglists"
|
||||
};
|
||||
|
||||
/* Information we gather for the sections we care about. */
|
||||
@@ -164,8 +156,6 @@ struct debug_section_info
|
||||
off_t offset;
|
||||
/* Section size. */
|
||||
size_t size;
|
||||
/* Section contents, after read from file. */
|
||||
const unsigned char *data;
|
||||
};
|
||||
|
||||
/* Information we keep for an coff symbol. */
|
||||
@@ -616,6 +606,7 @@ coff_add (struct backtrace_state *state, int descriptor,
|
||||
struct backtrace_view debug_view;
|
||||
int debug_view_valid;
|
||||
uintptr_t image_base;
|
||||
struct dwarf_sections dwarf_sections;
|
||||
|
||||
*found_sym = 0;
|
||||
*found_dwarf = 0;
|
||||
@@ -848,26 +839,20 @@ coff_add (struct backtrace_state *state, int descriptor,
|
||||
|
||||
for (i = 0; i < (int) DEBUG_MAX; ++i)
|
||||
{
|
||||
if (sections[i].size == 0)
|
||||
sections[i].data = NULL;
|
||||
size_t size = sections[i].size;
|
||||
dwarf_sections.size[i] = size;
|
||||
if (size == 0)
|
||||
dwarf_sections.data[i] = NULL;
|
||||
else
|
||||
sections[i].data = ((const unsigned char *) debug_view.data
|
||||
dwarf_sections.data[i] = ((const unsigned char *) debug_view.data
|
||||
+ (sections[i].offset - min_offset));
|
||||
}
|
||||
|
||||
if (!backtrace_dwarf_add (state, /* base_address */ 0,
|
||||
sections[DEBUG_INFO].data,
|
||||
sections[DEBUG_INFO].size,
|
||||
sections[DEBUG_LINE].data,
|
||||
sections[DEBUG_LINE].size,
|
||||
sections[DEBUG_ABBREV].data,
|
||||
sections[DEBUG_ABBREV].size,
|
||||
sections[DEBUG_RANGES].data,
|
||||
sections[DEBUG_RANGES].size,
|
||||
sections[DEBUG_STR].data,
|
||||
sections[DEBUG_STR].size,
|
||||
0, /* FIXME */
|
||||
error_callback, data, fileline_fn))
|
||||
if (!backtrace_dwarf_add (state, /* base_address */ 0, &dwarf_sections,
|
||||
0, /* FIXME: is_bigendian */
|
||||
NULL, /* altlink */
|
||||
error_callback, data, fileline_fn,
|
||||
NULL /* returned fileline_entry */))
|
||||
goto fail;
|
||||
|
||||
*found_dwarf = 1;
|
||||
@@ -920,7 +905,8 @@ backtrace_initialize (struct backtrace_state *state,
|
||||
if (found_sym)
|
||||
backtrace_atomic_store_pointer (&state->syminfo_fn, coff_syminfo);
|
||||
else
|
||||
__sync_bool_compare_and_swap (&state->syminfo_fn, NULL, coff_nosyms);
|
||||
(void) __sync_bool_compare_and_swap (&state->syminfo_fn, NULL,
|
||||
coff_nosyms);
|
||||
}
|
||||
|
||||
if (!state->threaded)
|
||||
|
||||
2
posix.c
2
posix.c
@@ -1,5 +1,5 @@
|
||||
/* posix.c -- POSIX file I/O routines for the backtrace library.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
4
print.c
4
print.c
@@ -1,5 +1,5 @@
|
||||
/* print.c -- Print the current backtrace.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -80,7 +80,7 @@ error_callback (void *data, const char *msg, int errnum)
|
||||
|
||||
/* Print a backtrace. */
|
||||
|
||||
void
|
||||
void __attribute__((noinline))
|
||||
backtrace_print (struct backtrace_state *state, int skip, FILE *f)
|
||||
{
|
||||
struct print_data data;
|
||||
|
||||
10
read.c
10
read.c
@@ -1,5 +1,5 @@
|
||||
/* read.c -- File views without mmap.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -46,12 +46,18 @@ POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
int
|
||||
backtrace_get_view (struct backtrace_state *state, int descriptor,
|
||||
off_t offset, size_t size,
|
||||
off_t offset, uint64_t size,
|
||||
backtrace_error_callback error_callback,
|
||||
void *data, struct backtrace_view *view)
|
||||
{
|
||||
ssize_t got;
|
||||
|
||||
if ((uint64_t) (size_t) size != size)
|
||||
{
|
||||
error_callback (data, "file size too large", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lseek (descriptor, offset, SEEK_SET) < 0)
|
||||
{
|
||||
error_callback (data, "lseek", errno);
|
||||
|
||||
4
simple.c
4
simple.c
@@ -1,5 +1,5 @@
|
||||
/* simple.c -- The backtrace_simple function.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -90,7 +90,7 @@ simple_unwind (struct _Unwind_Context *context, void *vdata)
|
||||
|
||||
/* Get a simple stack backtrace. */
|
||||
|
||||
int
|
||||
int __attribute__((noinline))
|
||||
backtrace_simple (struct backtrace_state *state, int skip,
|
||||
backtrace_simple_callback callback,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
|
||||
2
sort.c
2
sort.c
@@ -1,5 +1,5 @@
|
||||
/* sort.c -- Sort without allocating memory
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
state.c
2
state.c
@@ -1,5 +1,5 @@
|
||||
/* state.c -- Create the backtrace state.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
stest.c
2
stest.c
@@ -1,5 +1,5 @@
|
||||
/* stest.c -- Test for libbacktrace internal sort function
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
148
test-driver
Executable file
148
test-driver
Executable file
@@ -0,0 +1,148 @@
|
||||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
55
test_format.c
Normal file
55
test_format.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* test_format.c -- Test for libbacktrace library
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
(2) Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
(3) The name of the author may not be used to
|
||||
endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
/* This program tests the externally visible interfaces of the
|
||||
libbacktrace library. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "filenames.h"
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "backtrace-supported.h"
|
||||
|
||||
#include "testlib.h"
|
||||
|
||||
int
|
||||
main (int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
|
||||
error_callback_create, NULL);
|
||||
|
||||
exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* testlib.c -- test functions for libbacktrace library
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* testlib.h -- Header for test functions for libbacktrace library
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
ttest.c
2
ttest.c
@@ -1,5 +1,5 @@
|
||||
/* ttest.c -- Test for libbacktrace library
|
||||
Copyright (C) 2017-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2017-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
92
unittest.c
Normal file
92
unittest.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* unittest.c -- Test for libbacktrace library
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
(1) Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
(2) Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
(3) The name of the author may not be used to
|
||||
endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "filenames.h"
|
||||
|
||||
#include "backtrace.h"
|
||||
#include "backtrace-supported.h"
|
||||
|
||||
#include "testlib.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
static unsigned count;
|
||||
|
||||
static void
|
||||
error_callback (void *vdata ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED,
|
||||
int errnum ATTRIBUTE_UNUSED)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
||||
static int
|
||||
test1 (void)
|
||||
{
|
||||
int res;
|
||||
int failed;
|
||||
|
||||
struct backtrace_vector vec;
|
||||
|
||||
memset (&vec, 0, sizeof vec);
|
||||
|
||||
backtrace_vector_grow (state, 100, error_callback, NULL, &vec);
|
||||
vec.alc += vec.size;
|
||||
vec.size = 0;
|
||||
|
||||
count = 0;
|
||||
res = backtrace_vector_release (state, &vec, error_callback, NULL);
|
||||
failed = res != 1 || count != 0 || vec.base != NULL;
|
||||
|
||||
printf ("%s: unittest backtrace_vector_release size == 0\n",
|
||||
failed ? "FAIL": "PASS");
|
||||
|
||||
if (failed)
|
||||
++failures;
|
||||
|
||||
return failures;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc ATTRIBUTE_UNUSED, char **argv)
|
||||
{
|
||||
state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
|
||||
error_callback_create, NULL);
|
||||
|
||||
test1 ();
|
||||
|
||||
exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* unknown.c -- used when backtrace configury does not know file format.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Google.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
494
xcoff.c
494
xcoff.c
@@ -1,5 +1,5 @@
|
||||
/* xcoff.c -- Get debug data from an XCOFF file for backtraces.
|
||||
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
Adapted from elf.c.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -338,27 +338,32 @@ struct xcoff_incl_vector
|
||||
size_t count;
|
||||
};
|
||||
|
||||
/* Map a single PC value to a file/function/line. */
|
||||
/* A growable vector of functions information. */
|
||||
|
||||
struct xcoff_line
|
||||
struct xcoff_func
|
||||
{
|
||||
/* PC. */
|
||||
uintptr_t pc;
|
||||
/* File name. Many entries in the array are expected to point to
|
||||
the same file name. */
|
||||
const char *filename;
|
||||
/* The size of the function. */
|
||||
size_t size;
|
||||
/* Function name. */
|
||||
const char *function;
|
||||
/* Line number. */
|
||||
int lineno;
|
||||
const char *name;
|
||||
/* File name. */
|
||||
const char *filename;
|
||||
/* Pointer to first lnno entry. */
|
||||
uintptr_t lnnoptr;
|
||||
/* Base address of containing section. */
|
||||
uintptr_t sect_base;
|
||||
/* Starting source line number. */
|
||||
int lnno;
|
||||
};
|
||||
|
||||
/* A growable vector of line number information. This is used while
|
||||
reading the line numbers. */
|
||||
/* A growable vector of function information. This is used while
|
||||
reading the function symbols. */
|
||||
|
||||
struct xcoff_line_vector
|
||||
struct xcoff_func_vector
|
||||
{
|
||||
/* Memory. This is an array of struct xcoff_line. */
|
||||
/* Memory. This is an array of struct xcoff_func. */
|
||||
struct backtrace_vector vec;
|
||||
/* Number of valid mappings. */
|
||||
size_t count;
|
||||
@@ -370,20 +375,16 @@ struct xcoff_fileline_data
|
||||
{
|
||||
/* The data for the next file we know about. */
|
||||
struct xcoff_fileline_data *next;
|
||||
/* Line number information. */
|
||||
struct xcoff_line_vector vec;
|
||||
};
|
||||
|
||||
/* An index of DWARF sections we care about. */
|
||||
|
||||
enum dwarf_section
|
||||
{
|
||||
DWSECT_INFO,
|
||||
DWSECT_LINE,
|
||||
DWSECT_ABBREV,
|
||||
DWSECT_RANGES,
|
||||
DWSECT_STR,
|
||||
DWSECT_MAX
|
||||
/* Functions information. */
|
||||
struct xcoff_func_vector func_vec;
|
||||
/* Include files information. */
|
||||
struct xcoff_incl_vector incl_vec;
|
||||
/* Line numbers information. */
|
||||
const unsigned char *linenos;
|
||||
size_t linenos_size;
|
||||
uint64_t lnnoptr0;
|
||||
/* Loader address. */
|
||||
uintptr_t base_address;
|
||||
};
|
||||
|
||||
/* Information we gather for the DWARF sections we care about. */
|
||||
@@ -509,6 +510,7 @@ xcoff_syminfo (struct backtrace_state *state ATTRIBUTE_UNUSED, uintptr_t addr,
|
||||
{
|
||||
struct xcoff_syminfo_data *edata;
|
||||
struct xcoff_symbol *sym = NULL;
|
||||
const char *name;
|
||||
|
||||
if (!state->threaded)
|
||||
{
|
||||
@@ -547,7 +549,13 @@ xcoff_syminfo (struct backtrace_state *state ATTRIBUTE_UNUSED, uintptr_t addr,
|
||||
if (sym == NULL)
|
||||
callback (data, addr, NULL, 0, 0);
|
||||
else
|
||||
callback (data, addr, sym->name, sym->address, sym->size);
|
||||
{
|
||||
name = sym->name;
|
||||
/* AIX prepends a '.' to function entry points, remove it. */
|
||||
if (name && *name == '.')
|
||||
++name;
|
||||
callback (data, addr, name, sym->address, sym->size);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the name of an XCOFF symbol. */
|
||||
@@ -640,43 +648,76 @@ xcoff_initialize_syminfo (struct backtrace_state *state,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Compare struct xcoff_line for qsort. */
|
||||
/* Compare struct xcoff_func for qsort. */
|
||||
|
||||
static int
|
||||
xcoff_line_compare (const void *v1, const void *v2)
|
||||
xcoff_func_compare (const void *v1, const void *v2)
|
||||
{
|
||||
const struct xcoff_line *ln1 = (const struct xcoff_line *) v1;
|
||||
const struct xcoff_line *ln2 = (const struct xcoff_line *) v2;
|
||||
const struct xcoff_func *fn1 = (const struct xcoff_func *) v1;
|
||||
const struct xcoff_func *fn2 = (const struct xcoff_func *) v2;
|
||||
|
||||
if (ln1->pc < ln2->pc)
|
||||
if (fn1->pc < fn2->pc)
|
||||
return -1;
|
||||
else if (ln1->pc > ln2->pc)
|
||||
else if (fn1->pc > fn2->pc)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find a PC in a line vector. We always allocate an extra entry at
|
||||
the end of the lines vector, so that this routine can safely look
|
||||
at the next entry. */
|
||||
/* Compare a PC against an xcoff_func for bsearch. */
|
||||
|
||||
static int
|
||||
xcoff_line_search (const void *vkey, const void *ventry)
|
||||
xcoff_func_search (const void *vkey, const void *ventry)
|
||||
{
|
||||
const uintptr_t *key = (const uintptr_t *) vkey;
|
||||
const struct xcoff_line *entry = (const struct xcoff_line *) ventry;
|
||||
const struct xcoff_func *entry = (const struct xcoff_func *) ventry;
|
||||
uintptr_t pc;
|
||||
|
||||
pc = *key;
|
||||
if (pc < entry->pc)
|
||||
return -1;
|
||||
else if ((entry + 1)->pc == (uintptr_t) -1 || pc >= (entry + 1)->pc)
|
||||
else if ((entry->size == 0 && pc > entry->pc)
|
||||
|| (entry->size > 0 && pc >= entry->pc + entry->size))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Look for a PC in the line vector for one module. On success,
|
||||
/* Compare struct xcoff_incl for qsort. */
|
||||
|
||||
static int
|
||||
xcoff_incl_compare (const void *v1, const void *v2)
|
||||
{
|
||||
const struct xcoff_incl *in1 = (const struct xcoff_incl *) v1;
|
||||
const struct xcoff_incl *in2 = (const struct xcoff_incl *) v2;
|
||||
|
||||
if (in1->begin < in2->begin)
|
||||
return -1;
|
||||
else if (in1->begin > in2->begin)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find a lnnoptr in an include file. */
|
||||
|
||||
static int
|
||||
xcoff_incl_search (const void *vkey, const void *ventry)
|
||||
{
|
||||
const uintptr_t *key = (const uintptr_t *) vkey;
|
||||
const struct xcoff_incl *entry = (const struct xcoff_incl *) ventry;
|
||||
uintptr_t lnno;
|
||||
|
||||
lnno = *key;
|
||||
if (lnno < entry->begin)
|
||||
return -1;
|
||||
else if (lnno > entry->end)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Look for a PC in the function vector for one module. On success,
|
||||
call CALLBACK and return whatever it returns. On error, call
|
||||
ERROR_CALLBACK and return 0. Sets *FOUND to 1 if the PC is found,
|
||||
0 if not. */
|
||||
@@ -688,26 +729,82 @@ xcoff_lookup_pc (struct backtrace_state *state ATTRIBUTE_UNUSED,
|
||||
backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
|
||||
void *data, int *found)
|
||||
{
|
||||
const struct xcoff_line *ln;
|
||||
const struct xcoff_incl *incl, *bincl;
|
||||
const struct xcoff_func *fn;
|
||||
const b_xcoff_lineno *lineno;
|
||||
const unsigned char *lineptr;
|
||||
const char *function;
|
||||
const char *filename;
|
||||
uintptr_t lnnoptr, match;
|
||||
uint32_t lnno = 0;
|
||||
|
||||
*found = 1;
|
||||
|
||||
ln = (struct xcoff_line *) bsearch (&pc, fdata->vec.vec.base,
|
||||
fdata->vec.count,
|
||||
sizeof (struct xcoff_line),
|
||||
xcoff_line_search);
|
||||
if (ln == NULL)
|
||||
if ((pc & 3) != 0)
|
||||
++pc;
|
||||
|
||||
/* Find the function first. */
|
||||
fn = ((struct xcoff_func *)
|
||||
bsearch (&pc, fdata->func_vec.vec.base, fdata->func_vec.count,
|
||||
sizeof (struct xcoff_func), xcoff_func_search));
|
||||
if (fn == NULL)
|
||||
{
|
||||
*found = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function = ln->function;
|
||||
filename = fn->filename;
|
||||
|
||||
/* Find the line number next. */
|
||||
|
||||
/* Skip first entry that points to symtab. */
|
||||
lnnoptr = fn->lnnoptr + LINESZ;
|
||||
match = lnnoptr;
|
||||
|
||||
lineptr = fdata->linenos + (lnnoptr - fdata->lnnoptr0);
|
||||
while (lineptr + LINESZ <= fdata->linenos + fdata->linenos_size)
|
||||
{
|
||||
lineno = (const b_xcoff_lineno *) lineptr;
|
||||
if (lineno->l_lnno == 0)
|
||||
break;
|
||||
if (pc <= fdata->base_address + lineno->l_addr.l_paddr - fn->sect_base)
|
||||
break;
|
||||
match = lnnoptr;
|
||||
lnno = lineno->l_lnno;
|
||||
|
||||
lnnoptr += LINESZ;
|
||||
lineptr += LINESZ;
|
||||
}
|
||||
|
||||
/* If part of a function other than the beginning comes from an
|
||||
include file, the line numbers are absolute, rather than
|
||||
relative to the beginning of the function. */
|
||||
incl = ((struct xcoff_incl *)
|
||||
bsearch (&match, fdata->incl_vec.vec.base,
|
||||
fdata->incl_vec.count, sizeof (struct xcoff_incl),
|
||||
xcoff_incl_search));
|
||||
if (incl != NULL)
|
||||
{
|
||||
bincl = ((struct xcoff_incl *)
|
||||
bsearch (&fn->lnnoptr, fdata->incl_vec.vec.base,
|
||||
fdata->incl_vec.count, sizeof (struct xcoff_incl),
|
||||
xcoff_incl_search));
|
||||
if (bincl != NULL && strcmp (incl->filename, bincl->filename) == 0)
|
||||
{
|
||||
lnno += fn->lnno - 1;
|
||||
}
|
||||
filename = incl->filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
lnno += fn->lnno - 1;
|
||||
}
|
||||
|
||||
function = fn->name;
|
||||
/* AIX prepends a '.' to function entry points, remove it. */
|
||||
if (*function == '.')
|
||||
if (function != NULL && *function == '.')
|
||||
++function;
|
||||
return callback (data, pc, ln->filename, ln->lineno, function);
|
||||
return callback (data, pc, filename, lnno, function);
|
||||
}
|
||||
|
||||
/* Return the file/line information for a PC using the XCOFF lineno
|
||||
@@ -760,146 +857,7 @@ xcoff_fileline (struct backtrace_state *state, uintptr_t pc,
|
||||
return callback (data, pc, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
/* Compare struct xcoff_incl for qsort. */
|
||||
|
||||
static int
|
||||
xcoff_incl_compare (const void *v1, const void *v2)
|
||||
{
|
||||
const struct xcoff_incl *in1 = (const struct xcoff_incl *) v1;
|
||||
const struct xcoff_incl *in2 = (const struct xcoff_incl *) v2;
|
||||
|
||||
if (in1->begin < in2->begin)
|
||||
return -1;
|
||||
else if (in1->begin > in2->begin)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find a lnnoptr in an include file. */
|
||||
|
||||
static int
|
||||
xcoff_incl_search (const void *vkey, const void *ventry)
|
||||
{
|
||||
const uintptr_t *key = (const uintptr_t *) vkey;
|
||||
const struct xcoff_incl *entry = (const struct xcoff_incl *) ventry;
|
||||
uintptr_t lnno;
|
||||
|
||||
lnno = *key;
|
||||
if (lnno < entry->begin)
|
||||
return -1;
|
||||
else if (lnno > entry->end)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add a new mapping to the vector of line mappings that we are
|
||||
building. Returns 1 on success, 0 on failure. */
|
||||
|
||||
static int
|
||||
xcoff_add_line (struct backtrace_state *state, uintptr_t pc,
|
||||
const char *filename, const char *function, uint32_t lnno,
|
||||
backtrace_error_callback error_callback, void *data,
|
||||
struct xcoff_line_vector *vec)
|
||||
{
|
||||
struct xcoff_line *ln;
|
||||
|
||||
ln = ((struct xcoff_line *)
|
||||
backtrace_vector_grow (state, sizeof (struct xcoff_line),
|
||||
error_callback, data, &vec->vec));
|
||||
if (ln == NULL)
|
||||
return 0;
|
||||
|
||||
ln->pc = pc;
|
||||
ln->filename = filename;
|
||||
ln->function = function;
|
||||
ln->lineno = lnno;
|
||||
|
||||
++vec->count;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Add the line number entries for a function to the line vector. */
|
||||
|
||||
static int
|
||||
xcoff_process_linenos (struct backtrace_state *state, uintptr_t base_address,
|
||||
const b_xcoff_syment *fsym, const char *filename,
|
||||
const b_xcoff_scnhdr *sects,
|
||||
const unsigned char *strtab, size_t strtab_size,
|
||||
uint32_t fcn_lnno, struct xcoff_incl_vector *vec,
|
||||
struct xcoff_line_vector *lvec,
|
||||
const unsigned char *linenos, size_t linenos_size,
|
||||
uintptr_t lnnoptr0,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
{
|
||||
const b_xcoff_auxent *aux;
|
||||
const b_xcoff_lineno *lineno;
|
||||
const unsigned char *lineptr;
|
||||
const char *function;
|
||||
struct xcoff_incl *incl = NULL;
|
||||
uintptr_t lnnoptr;
|
||||
uintptr_t pc;
|
||||
uint32_t lnno;
|
||||
int begincl;
|
||||
|
||||
aux = (const b_xcoff_auxent *) (fsym + 1);
|
||||
lnnoptr = aux->x_fcn.x_lnnoptr;
|
||||
|
||||
if (lnnoptr < lnnoptr0 || lnnoptr + LINESZ > lnnoptr0 + linenos_size)
|
||||
return 0;
|
||||
|
||||
function = xcoff_symname (fsym, strtab, strtab_size);
|
||||
if (function == NULL)
|
||||
return 0;
|
||||
|
||||
/* Skip first entry that points to symtab. */
|
||||
|
||||
lnnoptr += LINESZ;
|
||||
|
||||
lineptr = linenos + (lnnoptr - lnnoptr0);
|
||||
|
||||
begincl = -1;
|
||||
while (lineptr + LINESZ <= linenos + linenos_size)
|
||||
{
|
||||
lineno = (const b_xcoff_lineno *) lineptr;
|
||||
|
||||
lnno = lineno->l_lnno;
|
||||
if (lnno == 0)
|
||||
break;
|
||||
|
||||
/* If part of a function other than the beginning comes from an
|
||||
include file, the line numbers are absolute, rather than
|
||||
relative to the beginning of the function. */
|
||||
incl = (struct xcoff_incl *) bsearch (&lnnoptr, vec->vec.base,
|
||||
vec->count,
|
||||
sizeof (struct xcoff_incl),
|
||||
xcoff_incl_search);
|
||||
if (begincl == -1)
|
||||
begincl = incl != NULL;
|
||||
if (incl != NULL)
|
||||
{
|
||||
filename = incl->filename;
|
||||
if (begincl == 1)
|
||||
lnno += fcn_lnno - 1;
|
||||
}
|
||||
else
|
||||
lnno += fcn_lnno - 1;
|
||||
|
||||
pc = base_address + lineno->l_addr.l_paddr
|
||||
- sects[fsym->n_scnum - 1].s_paddr;
|
||||
xcoff_add_line (state, pc, filename, function, lnno, error_callback,
|
||||
data, lvec);
|
||||
|
||||
lnnoptr += LINESZ;
|
||||
lineptr += LINESZ;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Initialize the line vector info for xcoff_fileline. */
|
||||
/* Initialize the function vector info for xcoff_fileline. */
|
||||
|
||||
static int
|
||||
xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
@@ -912,15 +870,15 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
{
|
||||
struct xcoff_fileline_data *fdata;
|
||||
struct xcoff_incl_vector vec;
|
||||
struct xcoff_line *ln;
|
||||
struct xcoff_func *fn;
|
||||
const b_xcoff_syment *fsym;
|
||||
const b_xcoff_auxent *aux;
|
||||
const char *filename;
|
||||
const char *name;
|
||||
struct xcoff_incl *incl;
|
||||
uintptr_t begin, end;
|
||||
uintptr_t lnno;
|
||||
uintptr_t lnno, lnnoptr;
|
||||
uint32_t fsize;
|
||||
size_t i;
|
||||
|
||||
fdata = ((struct xcoff_fileline_data *)
|
||||
@@ -928,13 +886,17 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
error_callback, data));
|
||||
if (fdata == NULL)
|
||||
return 0;
|
||||
|
||||
memset (fdata, 0, sizeof *fdata);
|
||||
memset (&vec, 0, sizeof vec);
|
||||
|
||||
/* Process include files first. */
|
||||
fdata->base_address = base_address;
|
||||
fdata->linenos = linenos;
|
||||
fdata->linenos_size = linenos_size;
|
||||
fdata->lnnoptr0 = lnnoptr0;
|
||||
|
||||
begin = 0;
|
||||
filename = NULL;
|
||||
fsym = NULL;
|
||||
lnnoptr = 0;
|
||||
fsize = 0;
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
{
|
||||
const b_xcoff_syment *asym = &syms[i];
|
||||
@@ -951,32 +913,18 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
end = asym->n_value;
|
||||
incl = ((struct xcoff_incl *)
|
||||
backtrace_vector_grow (state, sizeof (struct xcoff_incl),
|
||||
error_callback, data, &vec.vec));
|
||||
error_callback, data,
|
||||
&fdata->incl_vec.vec));
|
||||
if (incl != NULL)
|
||||
{
|
||||
incl->filename = xcoff_symname (asym, strtab, strtab_size);
|
||||
incl->begin = begin;
|
||||
incl->end = end;
|
||||
++vec.count;
|
||||
++fdata->incl_vec.count;
|
||||
}
|
||||
begin = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
i += asym->n_numaux;
|
||||
}
|
||||
|
||||
backtrace_qsort (vec.vec.base, vec.count,
|
||||
sizeof (struct xcoff_incl), xcoff_incl_compare);
|
||||
|
||||
filename = NULL;
|
||||
fsym = NULL;
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
{
|
||||
const b_xcoff_syment *asym = &syms[i];
|
||||
|
||||
switch (asym->n_sclass)
|
||||
{
|
||||
case C_FILE:
|
||||
filename = xcoff_symname (asym, strtab, strtab_size);
|
||||
if (filename == NULL)
|
||||
@@ -988,7 +936,7 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
file auxiliary entry (by convention) contains the source
|
||||
file name. */
|
||||
|
||||
if (asym->n_numaux > 0 && !strcmp (filename, ".file"))
|
||||
if (asym->n_numaux > 0 && strcmp (filename, ".file") == 0)
|
||||
{
|
||||
aux = (const b_xcoff_auxent *) (asym + 1);
|
||||
if (aux->x_file._x.x_zeroes != 0)
|
||||
@@ -1010,10 +958,20 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
case C_HIDEXT:
|
||||
case C_WEAKEXT:
|
||||
fsym = NULL;
|
||||
if (!ISFCN (asym->n_type) || asym->n_numaux == 0)
|
||||
lnnoptr = 0;
|
||||
fsize = 0;
|
||||
if (!ISFCN (asym->n_type) || asym->n_numaux == 0
|
||||
|| asym->n_scnum <= 0)
|
||||
break;
|
||||
if (filename == NULL)
|
||||
break;
|
||||
aux = (const b_xcoff_auxent *) (asym + 1);
|
||||
lnnoptr = aux->x_fcn.x_lnnoptr;
|
||||
if (lnnoptr < lnnoptr0
|
||||
|| lnnoptr + LINESZ > lnnoptr0 + linenos_size)
|
||||
break;
|
||||
/* x_fsize will be 0 if there is no debug information. */
|
||||
fsize = aux->x_fcn.x_fsize;
|
||||
fsym = asym;
|
||||
break;
|
||||
|
||||
@@ -1023,8 +981,11 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
if (fsym == NULL)
|
||||
break;
|
||||
name = xcoff_symname (asym, strtab, strtab_size);
|
||||
if (name == NULL)
|
||||
if (name == NULL || strcmp (name, ".bf") != 0)
|
||||
{
|
||||
fsym = NULL;
|
||||
break;
|
||||
}
|
||||
aux = (const b_xcoff_auxent *) (asym + 1);
|
||||
#if BACKTRACE_XCOFF_SIZE == 32
|
||||
lnno = (uint32_t) aux->x_block.x_lnnohi << 16
|
||||
@@ -1032,39 +993,37 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
||||
#else
|
||||
lnno = aux->x_block.x_lnno;
|
||||
#endif
|
||||
if (!strcmp (name, ".bf"))
|
||||
{
|
||||
xcoff_process_linenos (state, base_address, fsym, filename,
|
||||
sects, strtab, strtab_size, lnno, &vec,
|
||||
&fdata->vec, linenos, linenos_size,
|
||||
lnnoptr0, error_callback, data);
|
||||
}
|
||||
else if (!strcmp (name, ".ef"))
|
||||
{
|
||||
fsym = NULL;
|
||||
}
|
||||
fn = ((struct xcoff_func *)
|
||||
backtrace_vector_grow (state, sizeof (struct xcoff_func),
|
||||
error_callback, data,
|
||||
&fdata->func_vec.vec));
|
||||
if (fn == NULL)
|
||||
break;
|
||||
fn->name = xcoff_symname (fsym, strtab, strtab_size);
|
||||
fn->filename = filename;
|
||||
fn->sect_base = sects[fsym->n_scnum - 1].s_paddr;
|
||||
fn->pc = base_address + fsym->n_value - fn->sect_base;
|
||||
fn->size = fsize;
|
||||
fn->lnno = lnno;
|
||||
fn->lnnoptr = lnnoptr;
|
||||
++fdata->func_vec.count;
|
||||
break;
|
||||
}
|
||||
|
||||
i += asym->n_numaux;
|
||||
}
|
||||
|
||||
/* Allocate one extra entry at the end. */
|
||||
ln = ((struct xcoff_line *)
|
||||
backtrace_vector_grow (state, sizeof (struct xcoff_line),
|
||||
error_callback, data, &fdata->vec.vec));
|
||||
if (ln == NULL)
|
||||
if (!backtrace_vector_release (state, &fdata->func_vec.vec, error_callback,
|
||||
data))
|
||||
goto fail;
|
||||
ln->pc = (uintptr_t) -1;
|
||||
ln->filename = NULL;
|
||||
ln->function = NULL;
|
||||
ln->lineno = 0;
|
||||
backtrace_qsort (fdata->func_vec.vec.base, fdata->func_vec.count,
|
||||
sizeof (struct xcoff_func), xcoff_func_compare);
|
||||
|
||||
if (!backtrace_vector_release (state, &fdata->vec.vec, error_callback, data))
|
||||
if (!backtrace_vector_release (state, &fdata->incl_vec.vec, error_callback,
|
||||
data))
|
||||
goto fail;
|
||||
|
||||
backtrace_qsort (fdata->vec.vec.base, fdata->vec.count,
|
||||
sizeof (struct xcoff_line), xcoff_line_compare);
|
||||
backtrace_qsort (fdata->incl_vec.vec.base, fdata->incl_vec.count,
|
||||
sizeof (struct xcoff_incl), xcoff_incl_compare);
|
||||
|
||||
if (!state->threaded)
|
||||
{
|
||||
@@ -1129,7 +1088,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
off_t str_off;
|
||||
off_t min_offset;
|
||||
off_t max_offset;
|
||||
struct dwsect_info dwsect[DWSECT_MAX];
|
||||
struct dwsect_info dwsect[DEBUG_MAX];
|
||||
size_t sects_size;
|
||||
size_t syms_size;
|
||||
int32_t str_size;
|
||||
@@ -1140,6 +1099,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
int dwarf_view_valid;
|
||||
int magic_ok;
|
||||
int i;
|
||||
struct dwarf_sections dwarf_sections;
|
||||
|
||||
*found_sym = 0;
|
||||
|
||||
@@ -1284,19 +1244,19 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
switch (sects[i].s_flags & 0xffff0000)
|
||||
{
|
||||
case SSUBTYP_DWINFO:
|
||||
idx = DWSECT_INFO;
|
||||
idx = DEBUG_INFO;
|
||||
break;
|
||||
case SSUBTYP_DWLINE:
|
||||
idx = DWSECT_LINE;
|
||||
idx = DEBUG_LINE;
|
||||
break;
|
||||
case SSUBTYP_DWABREV:
|
||||
idx = DWSECT_ABBREV;
|
||||
idx = DEBUG_ABBREV;
|
||||
break;
|
||||
case SSUBTYP_DWARNGE:
|
||||
idx = DWSECT_RANGES;
|
||||
idx = DEBUG_RANGES;
|
||||
break;
|
||||
case SSUBTYP_DWSTR:
|
||||
idx = DWSECT_STR;
|
||||
idx = DEBUG_STR;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
@@ -1317,7 +1277,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
goto fail;
|
||||
dwarf_view_valid = 1;
|
||||
|
||||
for (i = 0; i < (int) DWSECT_MAX; ++i)
|
||||
for (i = 0; i < (int) DEBUG_MAX; ++i)
|
||||
{
|
||||
if (dwsect[i].offset == 0)
|
||||
dwsect[i].data = NULL;
|
||||
@@ -1326,25 +1286,30 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
+ (dwsect[i].offset - min_offset));
|
||||
}
|
||||
|
||||
if (!backtrace_dwarf_add (state, 0,
|
||||
dwsect[DWSECT_INFO].data,
|
||||
dwsect[DWSECT_INFO].size,
|
||||
memset (&dwarf_sections, 0, sizeof dwarf_sections);
|
||||
|
||||
dwarf_sections.data[DEBUG_INFO] = dwsect[DEBUG_INFO].data;
|
||||
dwarf_sections.size[DEBUG_INFO] = dwsect[DEBUG_INFO].size;
|
||||
#if BACKTRACE_XCOFF_SIZE == 32
|
||||
/* XXX workaround for broken lineoff */
|
||||
dwsect[DWSECT_LINE].data - 4,
|
||||
dwarf_sections.data[DEBUG_LINE] = dwsect[DEBUG_LINE].data - 4;
|
||||
#else
|
||||
/* XXX workaround for broken lineoff */
|
||||
dwsect[DWSECT_LINE].data - 12,
|
||||
dwarf_sections.data[DEBUG_LINE] = dwsect[DEBUG_LINE].data - 12;
|
||||
#endif
|
||||
dwsect[DWSECT_LINE].size,
|
||||
dwsect[DWSECT_ABBREV].data,
|
||||
dwsect[DWSECT_ABBREV].size,
|
||||
dwsect[DWSECT_RANGES].data,
|
||||
dwsect[DWSECT_RANGES].size,
|
||||
dwsect[DWSECT_STR].data,
|
||||
dwsect[DWSECT_STR].size,
|
||||
dwarf_sections.size[DEBUG_LINE] = dwsect[DEBUG_LINE].size;
|
||||
dwarf_sections.data[DEBUG_ABBREV] = dwsect[DEBUG_ABBREV].data;
|
||||
dwarf_sections.size[DEBUG_ABBREV] = dwsect[DEBUG_ABBREV].size;
|
||||
dwarf_sections.data[DEBUG_RANGES] = dwsect[DEBUG_RANGES].data;
|
||||
dwarf_sections.size[DEBUG_RANGES] = dwsect[DEBUG_RANGES].size;
|
||||
dwarf_sections.data[DEBUG_STR] = dwsect[DEBUG_STR].data;
|
||||
dwarf_sections.size[DEBUG_STR] = dwsect[DEBUG_STR].size;
|
||||
|
||||
if (!backtrace_dwarf_add (state, 0, &dwarf_sections,
|
||||
1, /* big endian */
|
||||
error_callback, data, fileline_fn))
|
||||
NULL, /* altlink */
|
||||
error_callback, data, fileline_fn,
|
||||
NULL /* returned fileline_entry */))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -1354,6 +1319,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
{
|
||||
size_t linenos_size = (size_t) nlnno * LINESZ;
|
||||
|
||||
/* We never release this view. */
|
||||
if (!backtrace_get_view (state, descriptor, offset + lnnoptr,
|
||||
linenos_size,
|
||||
error_callback, data, &linenos_view))
|
||||
@@ -1366,9 +1332,6 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
||||
linenos_view.data, linenos_size,
|
||||
lnnoptr, error_callback, data))
|
||||
*fileline_fn = xcoff_fileline;
|
||||
|
||||
backtrace_release_view (state, &linenos_view, error_callback, data);
|
||||
linenos_view_valid = 0;
|
||||
}
|
||||
|
||||
backtrace_release_view (state, §s_view, error_callback, data);
|
||||
@@ -1621,7 +1584,8 @@ backtrace_initialize (struct backtrace_state *state,
|
||||
if (found_sym)
|
||||
backtrace_atomic_store_pointer (&state->syminfo_fn, xcoff_syminfo);
|
||||
else
|
||||
__sync_bool_compare_and_swap (&state->syminfo_fn, NULL, xcoff_nosyms);
|
||||
(void) __sync_bool_compare_and_swap (&state->syminfo_fn, NULL,
|
||||
xcoff_nosyms);
|
||||
}
|
||||
|
||||
if (!state->threaded)
|
||||
|
||||
Reference in New Issue
Block a user