On 23-11-18 21:56, Tom de Vries wrote: > Hi, > > When building libbacktrace, we typically use elf.c, and don't build pecoff.c, > xcoff.c or unknown.c > > Add testcases that use unused format to ensure that we also build and > test those on a typical development setup. > > Bootstrapped and reg-tested on x86_64. > > OK for trunk? >
Hi Jeff, to follow up on your question about relevance of the remaining patches: If we would have had the test-cases in this patch already committed, we would have immediately noticed that the patch I proposed here ( https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01091.html ) breaks libbacktrace for xcoff and pecoff builds. I realized this eventually while continuing to work on PR82857, but I'd prefer to find this sort of problem asap. Thanks, - Tom > [libbacktrace] Add tests for unused formats > > 2018-11-23 Tom de Vries <tdevr...@suse.de> > > * configure.ac (NOT_HAVE_FORMAT_ELF, NOT_HAVE_FORMAT_PECOFF) > (NOT_HAVE_FORMAT_UNKNOWN, NOT_HAVE_FORMAT_XCOFF_32) > (NOT_HAVE_FORMAT_XCOFF_64): New AM_CONDITIONAL. > * configure: Regenerate. > * Makefile.am (check_PROGRAMS): Add test_elf, test_xcoff_32, > test_xcoff_64, test_pecoff and test_unknown. > * Makefile.in: Regenerate. > * test_format.c: New file. > > --- > libbacktrace/Makefile.am | 40 ++++++++++ > libbacktrace/Makefile.in | 182 > +++++++++++++++++++++++++++++++++++++-------- > libbacktrace/configure | 74 +++++++++++++++++- > libbacktrace/configure.ac | 5 ++ > libbacktrace/test_format.c | 55 ++++++++++++++ > 5 files changed, 322 insertions(+), 34 deletions(-) > > diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am > index 4b28984c4e0..26c0b67a4c1 100644 > --- a/libbacktrace/Makefile.am > +++ b/libbacktrace/Makefile.am > @@ -89,6 +89,46 @@ check_PROGRAMS = > TESTS = $(check_PROGRAMS) > > if NATIVE > +libbacktrace_without_format = $(libbacktrace_la_OBJECTS) \ > + $(filter-out elf.lo pecoff.lo xcoff.lo,$(libbacktrace_la_LIBADD)) > + > +xcoff_%.c: xcoff.c > + SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ > + REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define BACKTRACE_XCOFF_SIZE'; \ > + $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ > + $(srcdir)/xcoff.c \ > + > $@ > + > +if NOT_HAVE_FORMAT_ELF > +test_elf_SOURCES = test_format.c testlib.c > +test_elf_LDADD = $(libbacktrace_without_format) elf.lo > +check_PROGRAMS += test_elf > +endif > + > +if NOT_HAVE_FORMAT_XCOFF_32 > +test_xcoff_32_SOURCES = test_format.c xcoff_32.c testlib.c > +test_xcoff_32_LDADD = $(libbacktrace_without_format) > +check_PROGRAMS += test_xcoff_32 > +endif > + > +if NOT_HAVE_FORMAT_XCOFF_64 > +test_xcoff_64_SOURCES = test_format.c xcoff_64.c testlib.c > +test_xcoff_64_LDADD = $(libbacktrace_without_format) > +check_PROGRAMS += test_xcoff_64 > +endif > + > +if NOT_HAVE_FORMAT_PECOFF > +test_pecoff_SOURCES = test_format.c testlib.c > +test_pecoff_LDADD = $(libbacktrace_without_format) pecoff.lo > +check_PROGRAMS += test_pecoff > +endif > + > +if NOT_HAVE_FORMAT_UNKNOWN > +test_unknown_SOURCES = test_format.c testlib.c > +test_unknown_LDADD = $(libbacktrace_without_format) unknown.lo > +check_PROGRAMS += test_unknown > +endif > + > unittest_SOURCES = unittest.c testlib.c > unittest_LDADD = libbacktrace.la > > diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in > index c79b67636c9..6e153085e29 100644 > --- a/libbacktrace/Makefile.in > +++ b/libbacktrace/Makefile.in > @@ -123,21 +123,28 @@ target_triplet = @target@ > check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ > $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \ > $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \ > - $(am__EXEEXT_10) $(am__EXEEXT_11) $(am__EXEEXT_12) > -@NATIVE_TRUE@am__append_1 = unittest btest > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_2 = btest_with_alloc > -@NATIVE_TRUE@am__append_3 = stest > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_4 = stest_with_alloc > -@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_5 = -lz > -@NATIVE_TRUE@am__append_6 = ztest > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_7 = ztest_with_alloc > -@NATIVE_TRUE@am__append_8 = edtest > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_9 = edtest_with_alloc > -@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_10 = ttest > -@HAVE_MMAP_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_11 = > ttest_with_alloc > -@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_12 = dtest > -@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_13 = ctestg ctesta > -@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_14 = > ctestg_with_alloc ctesta_with_alloc > + $(am__EXEEXT_10) $(am__EXEEXT_11) $(am__EXEEXT_12) \ > + $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) \ > + $(am__EXEEXT_16) $(am__EXEEXT_17) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@am__append_1 = test_elf > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@am__append_2 = test_xcoff_32 > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@am__append_3 = test_xcoff_64 > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@am__append_4 = test_pecoff > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@am__append_5 = test_unknown > +@NATIVE_TRUE@am__append_6 = unittest btest > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_7 = btest_with_alloc > +@NATIVE_TRUE@am__append_8 = stest > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_9 = stest_with_alloc > +@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_10 = -lz > +@NATIVE_TRUE@am__append_11 = ztest > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_12 = ztest_with_alloc > +@NATIVE_TRUE@am__append_13 = edtest > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_14 = edtest_with_alloc > +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_15 = ttest > +@HAVE_MMAP_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_16 = > ttest_with_alloc > +@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_17 = dtest > +@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_18 = ctestg ctesta > +@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__append_19 = > ctestg_with_alloc ctesta_with_alloc > subdir = . > ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 > am__aclocal_m4_deps = $(top_srcdir)/../config/cet.m4 \ > @@ -170,21 +177,28 @@ AM_V_lt = $(am__v_lt_@AM_V@) > am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) > am__v_lt_0 = --silent > am__v_lt_1 = > -@NATIVE_TRUE@am__EXEEXT_1 = unittest$(EXEEXT) btest$(EXEEXT) > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_2 = btest_with_alloc$(EXEEXT) > -@NATIVE_TRUE@am__EXEEXT_3 = stest$(EXEEXT) > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_4 = stest_with_alloc$(EXEEXT) > -@NATIVE_TRUE@am__EXEEXT_5 = ztest$(EXEEXT) > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_6 = ztest_with_alloc$(EXEEXT) > -@NATIVE_TRUE@am__EXEEXT_7 = edtest$(EXEEXT) > -@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_8 = \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@am__EXEEXT_1 = \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@ test_elf$(EXEEXT) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@am__EXEEXT_2 = > test_xcoff_32$(EXEEXT) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@am__EXEEXT_3 = > test_xcoff_64$(EXEEXT) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@am__EXEEXT_4 = test_pecoff$(EXEEXT) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@am__EXEEXT_5 = > test_unknown$(EXEEXT) > +@NATIVE_TRUE@am__EXEEXT_6 = unittest$(EXEEXT) btest$(EXEEXT) > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_7 = btest_with_alloc$(EXEEXT) > +@NATIVE_TRUE@am__EXEEXT_8 = stest$(EXEEXT) > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_9 = stest_with_alloc$(EXEEXT) > +@NATIVE_TRUE@am__EXEEXT_10 = ztest$(EXEEXT) > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_11 = \ > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@ ztest_with_alloc$(EXEEXT) > +@NATIVE_TRUE@am__EXEEXT_12 = edtest$(EXEEXT) > +@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_13 = \ > @HAVE_MMAP_TRUE@@NATIVE_TRUE@ edtest_with_alloc$(EXEEXT) > -@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_9 = ttest$(EXEEXT) > -@HAVE_MMAP_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_10 = > ttest_with_alloc$(EXEEXT) > -@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__EXEEXT_11 = \ > +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_14 = ttest$(EXEEXT) > +@HAVE_MMAP_TRUE@@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_15 = > ttest_with_alloc$(EXEEXT) > +@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__EXEEXT_16 = \ > @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctestg$(EXEEXT) \ > @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta$(EXEEXT) > -@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_12 = > ctestg_with_alloc$(EXEEXT) \ > +@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_MMAP_TRUE@@NATIVE_TRUE@am__EXEEXT_17 = > ctestg_with_alloc$(EXEEXT) \ > @HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_MMAP_TRUE@@NATIVE_TRUE@ > ctesta_with_alloc$(EXEEXT) > @NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT) \ > @NATIVE_TRUE@ btest-testlib.$(OBJEXT) > @@ -258,6 +272,32 @@ stest_OBJECTS = $(am_stest_OBJECTS) > stest_with_alloc_OBJECTS = $(am_stest_with_alloc_OBJECTS) > @HAVE_MMAP_TRUE@@NATIVE_TRUE@stest_with_alloc_DEPENDENCIES = \ > @HAVE_MMAP_TRUE@@NATIVE_TRUE@ $(libbacktrace_with_alloc) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@am_test_elf_OBJECTS = \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@ test_format.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@ testlib.$(OBJEXT) > +test_elf_OBJECTS = $(am_test_elf_OBJECTS) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@test_elf_DEPENDENCIES = > $(libbacktrace_without_format) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@ elf.lo > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@am_test_pecoff_OBJECTS = > test_format.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@ testlib.$(OBJEXT) > +test_pecoff_OBJECTS = $(am_test_pecoff_OBJECTS) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@test_pecoff_DEPENDENCIES = > $(libbacktrace_without_format) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@ pecoff.lo > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@am_test_unknown_OBJECTS = > test_format.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@ testlib.$(OBJEXT) > +test_unknown_OBJECTS = $(am_test_unknown_OBJECTS) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@test_unknown_DEPENDENCIES = > $(libbacktrace_without_format) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@ unknown.lo > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@am_test_xcoff_32_OBJECTS = > test_format.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@ xcoff_32.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@ testlib.$(OBJEXT) > +test_xcoff_32_OBJECTS = $(am_test_xcoff_32_OBJECTS) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@test_xcoff_32_DEPENDENCIES = > $(libbacktrace_without_format) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@am_test_xcoff_64_OBJECTS = > test_format.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@ xcoff_64.$(OBJEXT) \ > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@ testlib.$(OBJEXT) > +test_xcoff_64_OBJECTS = $(am_test_xcoff_64_OBJECTS) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@test_xcoff_64_DEPENDENCIES = > $(libbacktrace_without_format) > @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am_ttest_OBJECTS = \ > @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest-ttest.$(OBJEXT) \ > @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest-testlib.$(OBJEXT) > @@ -338,9 +378,12 @@ SOURCES = $(libbacktrace_la_SOURCES) > $(EXTRA_libbacktrace_la_SOURCES) \ > $(ctesta_with_alloc_SOURCES) $(ctestg_SOURCES) \ > $(ctestg_with_alloc_SOURCES) $(edtest_SOURCES) \ > $(edtest_with_alloc_SOURCES) $(stest_SOURCES) \ > - $(stest_with_alloc_SOURCES) $(ttest_SOURCES) \ > - $(ttest_with_alloc_SOURCES) $(unittest_SOURCES) \ > - $(ztest_SOURCES) $(ztest_with_alloc_SOURCES) > + $(stest_with_alloc_SOURCES) $(test_elf_SOURCES) \ > + $(test_pecoff_SOURCES) $(test_unknown_SOURCES) \ > + $(test_xcoff_32_SOURCES) $(test_xcoff_64_SOURCES) \ > + $(ttest_SOURCES) $(ttest_with_alloc_SOURCES) \ > + $(unittest_SOURCES) $(ztest_SOURCES) \ > + $(ztest_with_alloc_SOURCES) > am__can_run_installinfo = \ > case $$AM_UPDATE_INFO_DIR in \ > n|no|NO) false;; \ > @@ -748,7 +791,20 @@ libbacktrace_la_LIBADD = \ > $(ALLOC_FILE) > > libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) > -TESTS = $(check_PROGRAMS) $(am__append_12) > +TESTS = $(check_PROGRAMS) $(am__append_17) > +@NATIVE_TRUE@libbacktrace_without_format = $(libbacktrace_la_OBJECTS) \ > +@NATIVE_TRUE@ $(filter-out elf.lo pecoff.lo > xcoff.lo,$(libbacktrace_la_LIBADD)) > + > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@test_elf_SOURCES = test_format.c > testlib.c > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_ELF_TRUE@test_elf_LDADD = > $(libbacktrace_without_format) elf.lo > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@test_xcoff_32_SOURCES = > test_format.c xcoff_32.c testlib.c > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_32_TRUE@test_xcoff_32_LDADD = > $(libbacktrace_without_format) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@test_xcoff_64_SOURCES = > test_format.c xcoff_64.c testlib.c > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_XCOFF_64_TRUE@test_xcoff_64_LDADD = > $(libbacktrace_without_format) > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@test_pecoff_SOURCES = > test_format.c testlib.c > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_PECOFF_TRUE@test_pecoff_LDADD = > $(libbacktrace_without_format) pecoff.lo > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@test_unknown_SOURCES = > test_format.c testlib.c > +@NATIVE_TRUE@@NOT_HAVE_FORMAT_UNKNOWN_TRUE@test_unknown_LDADD = > $(libbacktrace_without_format) unknown.lo > @NATIVE_TRUE@unittest_SOURCES = unittest.c testlib.c > @NATIVE_TRUE@unittest_LDADD = libbacktrace.la > @NATIVE_TRUE@btest_SOURCES = btest.c testlib.c > @@ -767,7 +823,7 @@ TESTS = $(check_PROGRAMS) $(am__append_12) > @HAVE_MMAP_TRUE@@NATIVE_TRUE@stest_with_alloc_LDADD = > $(libbacktrace_with_alloc) > @NATIVE_TRUE@ztest_SOURCES = ztest.c testlib.c > @NATIVE_TRUE@ztest_CFLAGS = -DSRCDIR=\"$(srcdir)\" > -@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_5) \ > +@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_10) \ > @NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) > @HAVE_MMAP_TRUE@@NATIVE_TRUE@ztest_with_alloc_SOURCES = $(ztest_SOURCES) > @HAVE_MMAP_TRUE@@NATIVE_TRUE@ztest_with_alloc_CFLAGS = $(ztest_CFLAGS) > @@ -939,6 +995,26 @@ stest_with_alloc$(EXEEXT): $(stest_with_alloc_OBJECTS) > $(stest_with_alloc_DEPEND > @rm -f stest_with_alloc$(EXEEXT) > $(AM_V_CCLD)$(LINK) $(stest_with_alloc_OBJECTS) > $(stest_with_alloc_LDADD) $(LIBS) > > +test_elf$(EXEEXT): $(test_elf_OBJECTS) $(test_elf_DEPENDENCIES) > $(EXTRA_test_elf_DEPENDENCIES) > + @rm -f test_elf$(EXEEXT) > + $(AM_V_CCLD)$(LINK) $(test_elf_OBJECTS) $(test_elf_LDADD) $(LIBS) > + > +test_pecoff$(EXEEXT): $(test_pecoff_OBJECTS) $(test_pecoff_DEPENDENCIES) > $(EXTRA_test_pecoff_DEPENDENCIES) > + @rm -f test_pecoff$(EXEEXT) > + $(AM_V_CCLD)$(LINK) $(test_pecoff_OBJECTS) $(test_pecoff_LDADD) $(LIBS) > + > +test_unknown$(EXEEXT): $(test_unknown_OBJECTS) $(test_unknown_DEPENDENCIES) > $(EXTRA_test_unknown_DEPENDENCIES) > + @rm -f test_unknown$(EXEEXT) > + $(AM_V_CCLD)$(LINK) $(test_unknown_OBJECTS) $(test_unknown_LDADD) > $(LIBS) > + > +test_xcoff_32$(EXEEXT): $(test_xcoff_32_OBJECTS) > $(test_xcoff_32_DEPENDENCIES) $(EXTRA_test_xcoff_32_DEPENDENCIES) > + @rm -f test_xcoff_32$(EXEEXT) > + $(AM_V_CCLD)$(LINK) $(test_xcoff_32_OBJECTS) $(test_xcoff_32_LDADD) > $(LIBS) > + > +test_xcoff_64$(EXEEXT): $(test_xcoff_64_OBJECTS) > $(test_xcoff_64_DEPENDENCIES) $(EXTRA_test_xcoff_64_DEPENDENCIES) > + @rm -f test_xcoff_64$(EXEEXT) > + $(AM_V_CCLD)$(LINK) $(test_xcoff_64_OBJECTS) $(test_xcoff_64_LDADD) > $(LIBS) > + > ttest$(EXEEXT): $(ttest_OBJECTS) $(ttest_DEPENDENCIES) > $(EXTRA_ttest_DEPENDENCIES) > @rm -f ttest$(EXEEXT) > $(AM_V_CCLD)$(ttest_LINK) $(ttest_OBJECTS) $(ttest_LDADD) $(LIBS) > @@ -1303,6 +1379,41 @@ recheck: all $(check_PROGRAMS) > am__force_recheck=am--force-recheck \ > TEST_LOGS="$$log_list"; \ > exit $$? > +test_elf.log: test_elf$(EXEEXT) > + @p='test_elf$(EXEEXT)'; \ > + b='test_elf'; \ > + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ > + --log-file $$b.log --trs-file $$b.trs \ > + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) > -- $(LOG_COMPILE) \ > + "$$tst" $(AM_TESTS_FD_REDIRECT) > +test_xcoff_32.log: test_xcoff_32$(EXEEXT) > + @p='test_xcoff_32$(EXEEXT)'; \ > + b='test_xcoff_32'; \ > + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ > + --log-file $$b.log --trs-file $$b.trs \ > + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) > -- $(LOG_COMPILE) \ > + "$$tst" $(AM_TESTS_FD_REDIRECT) > +test_xcoff_64.log: test_xcoff_64$(EXEEXT) > + @p='test_xcoff_64$(EXEEXT)'; \ > + b='test_xcoff_64'; \ > + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ > + --log-file $$b.log --trs-file $$b.trs \ > + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) > -- $(LOG_COMPILE) \ > + "$$tst" $(AM_TESTS_FD_REDIRECT) > +test_pecoff.log: test_pecoff$(EXEEXT) > + @p='test_pecoff$(EXEEXT)'; \ > + b='test_pecoff'; \ > + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ > + --log-file $$b.log --trs-file $$b.trs \ > + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) > -- $(LOG_COMPILE) \ > + "$$tst" $(AM_TESTS_FD_REDIRECT) > +test_unknown.log: test_unknown$(EXEEXT) > + @p='test_unknown$(EXEEXT)'; \ > + b='test_unknown'; \ > + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ > + --log-file $$b.log --trs-file $$b.trs \ > + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) > -- $(LOG_COMPILE) \ > + "$$tst" $(AM_TESTS_FD_REDIRECT) > unittest.log: unittest$(EXEEXT) > @p='unittest$(EXEEXT)'; \ > b='unittest'; \ > @@ -1563,6 +1674,13 @@ uninstall-am: > .PRECIOUS: Makefile > > > +@NATIVE_TRUE@xcoff_%.c: xcoff.c > +@NATIVE_TRUE@ SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ > +@NATIVE_TRUE@ REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define > BACKTRACE_XCOFF_SIZE'; \ > +@NATIVE_TRUE@ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ > +@NATIVE_TRUE@ $(srcdir)/xcoff.c \ > +@NATIVE_TRUE@ > $@ > + > @NATIVE_TRUE@edtest2_build.c: gen_edtest2_build; @true > @NATIVE_TRUE@gen_edtest2_build: $(srcdir)/edtest2.c > @NATIVE_TRUE@ cat $(srcdir)/edtest2.c > tmp-edtest2_build.c > diff --git a/libbacktrace/configure b/libbacktrace/configure > index ad2e27cbc62..65218ecc512 100755 > --- a/libbacktrace/configure > +++ b/libbacktrace/configure > @@ -653,6 +653,16 @@ ALLOC_FILE > VIEW_FILE > BACKTRACE_SUPPORTS_DATA > BACKTRACE_SUPPORTED > +NOT_HAVE_FORMAT_XCOFF_64_FALSE > +NOT_HAVE_FORMAT_XCOFF_64_TRUE > +NOT_HAVE_FORMAT_XCOFF_32_FALSE > +NOT_HAVE_FORMAT_XCOFF_32_TRUE > +NOT_HAVE_FORMAT_ELF_FALSE > +NOT_HAVE_FORMAT_ELF_TRUE > +NOT_HAVE_FORMAT_PECOFF_FALSE > +NOT_HAVE_FORMAT_PECOFF_TRUE > +NOT_HAVE_FORMAT_UNKNOWN_FALSE > +NOT_HAVE_FORMAT_UNKNOWN_TRUE > FORMAT_FILE > BACKTRACE_SUPPORTS_THREADS > PIC_FLAG > @@ -11442,7 +11452,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 11445 "configure" > +#line 11455 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -11548,7 +11558,7 @@ else > lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 > lt_status=$lt_dlunknown > cat > conftest.$ac_ext <<_LT_EOF > -#line 11551 "configure" > +#line 11561 "configure" > #include "confdefs.h" > > #if HAVE_DLFCN_H > @@ -12452,6 +12462,30 @@ $as_echo "$as_me: WARNING: could not determine > output file type" >&2;} > ;; > esac > > + if test "$FORMAT_FILE" != "unknown.lo"; then > + NOT_HAVE_FORMAT_UNKNOWN_TRUE= > + NOT_HAVE_FORMAT_UNKNOWN_FALSE='#' > +else > + NOT_HAVE_FORMAT_UNKNOWN_TRUE='#' > + NOT_HAVE_FORMAT_UNKNOWN_FALSE= > +fi > + > + if test "$FORMAT_FILE" != "pecoff.lo"; then > + NOT_HAVE_FORMAT_PECOFF_TRUE= > + NOT_HAVE_FORMAT_PECOFF_FALSE='#' > +else > + NOT_HAVE_FORMAT_PECOFF_TRUE='#' > + NOT_HAVE_FORMAT_PECOFF_FALSE= > +fi > + > + if test "$FORMAT_FILE" != "elf.lo"; then > + NOT_HAVE_FORMAT_ELF_TRUE= > + NOT_HAVE_FORMAT_ELF_FALSE='#' > +else > + NOT_HAVE_FORMAT_ELF_TRUE='#' > + NOT_HAVE_FORMAT_ELF_FALSE= > +fi > + > > # ELF defines. > elfsize= > @@ -12478,6 +12512,22 @@ cat >>confdefs.h <<_ACEOF > #define BACKTRACE_XCOFF_SIZE $xcoffsize > _ACEOF > > + if test "$xcoffsize" != "32"; then > + NOT_HAVE_FORMAT_XCOFF_32_TRUE= > + NOT_HAVE_FORMAT_XCOFF_32_FALSE='#' > +else > + NOT_HAVE_FORMAT_XCOFF_32_TRUE='#' > + NOT_HAVE_FORMAT_XCOFF_32_FALSE= > +fi > + > + if test "$xcoffsize" != "64"; then > + NOT_HAVE_FORMAT_XCOFF_64_TRUE= > + NOT_HAVE_FORMAT_XCOFF_64_FALSE='#' > +else > + NOT_HAVE_FORMAT_XCOFF_64_TRUE='#' > + NOT_HAVE_FORMAT_XCOFF_64_FALSE= > +fi > + > > BACKTRACE_SUPPORTED=0 > if test "$backtrace_supported" = "yes"; then > @@ -13568,6 +13618,26 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z > "${MAINTAINER_MODE_FALSE}"; then > as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. > Usually this means the macro was only invoked conditionally." "$LINENO" 5 > fi > +if test -z "${NOT_HAVE_FORMAT_UNKNOWN_TRUE}" && test -z > "${NOT_HAVE_FORMAT_UNKNOWN_FALSE}"; then > + as_fn_error $? "conditional \"NOT_HAVE_FORMAT_UNKNOWN\" was never defined. > +Usually this means the macro was only invoked conditionally." "$LINENO" 5 > +fi > +if test -z "${NOT_HAVE_FORMAT_PECOFF_TRUE}" && test -z > "${NOT_HAVE_FORMAT_PECOFF_FALSE}"; then > + as_fn_error $? "conditional \"NOT_HAVE_FORMAT_PECOFF\" was never defined. > +Usually this means the macro was only invoked conditionally." "$LINENO" 5 > +fi > +if test -z "${NOT_HAVE_FORMAT_ELF_TRUE}" && test -z > "${NOT_HAVE_FORMAT_ELF_FALSE}"; then > + as_fn_error $? "conditional \"NOT_HAVE_FORMAT_ELF\" was never defined. > +Usually this means the macro was only invoked conditionally." "$LINENO" 5 > +fi > +if test -z "${NOT_HAVE_FORMAT_XCOFF_32_TRUE}" && test -z > "${NOT_HAVE_FORMAT_XCOFF_32_FALSE}"; then > + as_fn_error $? "conditional \"NOT_HAVE_FORMAT_XCOFF_32\" was never defined. > +Usually this means the macro was only invoked conditionally." "$LINENO" 5 > +fi > +if test -z "${NOT_HAVE_FORMAT_XCOFF_64_TRUE}" && test -z > "${NOT_HAVE_FORMAT_XCOFF_64_FALSE}"; then > + as_fn_error $? "conditional \"NOT_HAVE_FORMAT_XCOFF_64\" was never defined. > +Usually this means the macro was only invoked conditionally." "$LINENO" 5 > +fi > if test -z "${HAVE_MMAP_TRUE}" && test -z "${HAVE_MMAP_FALSE}"; then > as_fn_error $? "conditional \"HAVE_MMAP\" was never defined. > Usually this means the macro was only invoked conditionally." "$LINENO" 5 > diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac > index 4eb9b06d781..5e201e65a70 100644 > --- a/libbacktrace/configure.ac > +++ b/libbacktrace/configure.ac > @@ -247,6 +247,9 @@ xcoff*) FORMAT_FILE="xcoff.lo" > ;; > esac > AC_SUBST(FORMAT_FILE) > +AM_CONDITIONAL(NOT_HAVE_FORMAT_UNKNOWN, test "$FORMAT_FILE" != "unknown.lo") > +AM_CONDITIONAL(NOT_HAVE_FORMAT_PECOFF, test "$FORMAT_FILE" != "pecoff.lo") > +AM_CONDITIONAL(NOT_HAVE_FORMAT_ELF, test "$FORMAT_FILE" != "elf.lo") > > # ELF defines. > elfsize= > @@ -265,6 +268,8 @@ xcoff64) xcoffsize=64 ;; > *) xcoffsize=unused > esac > AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or > 64]) > +AM_CONDITIONAL(NOT_HAVE_FORMAT_XCOFF_32, test "$xcoffsize" != "32") > +AM_CONDITIONAL(NOT_HAVE_FORMAT_XCOFF_64, test "$xcoffsize" != "64") > > BACKTRACE_SUPPORTED=0 > if test "$backtrace_supported" = "yes"; then > diff --git a/libbacktrace/test_format.c b/libbacktrace/test_format.c > new file mode 100644 > index 00000000000..bb65b8c083a > --- /dev/null > +++ b/libbacktrace/test_format.c > @@ -0,0 +1,55 @@ > +/* test_format.c -- Test for libbacktrace library > + Copyright (C) 2018 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); > +} >