From 55c3c457ebf02c3b7c849315a62b1222b9801b7c Mon Sep 17 00:00:00 2001 From: Eric Lagergren Date: Fri, 10 Mar 2023 10:42:25 -0800 Subject: [PATCH] add VxWorks support Signed-off-by: Eric Lagergren --- .gitignore | 2 + Makefile.am | 9 +++++ Makefile.in | 109 +++++++++++++++++++++++++++------------------------ config.h.in | 4 ++ configure | 61 ++++++++++++++++++++++++---- configure.ac | 12 +++++- mmap.c | 6 ++- mmapio.c | 6 ++- posix.c | 2 +- 9 files changed, 147 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index 86a40a0..c565c42 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.lo *.a *.la + +autom4te.cache/ diff --git a/Makefile.am b/Makefile.am index 5f1d0f8..765c182 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,8 +32,14 @@ ACLOCAL_AMFLAGS = -I config AM_CPPFLAGS = +if LIBBACKTRACE_IS_VXWORKS +AM_CPPFLAGS += -mrtp +endif AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) +if LIBBACKTRACE_IS_VXWORKS +AM_CFLAGS += -mrtp +endif include_HEADERS = backtrace.h backtrace-supported.h @@ -106,6 +112,9 @@ check_DATA = # Flags to use when compiling test programs. libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g +if LIBBACKTRACE_IS_VXWORKS +libbacktrace_TEST_CFLAGS += -mrtp +endif if USE_DSYMUTIL diff --git a/Makefile.in b/Makefile.in index f5ea83f..0544be4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,52 +121,55 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +@LIBBACKTRACE_IS_VXWORKS_TRUE@am__append_1 = -mrtp +@LIBBACKTRACE_IS_VXWORKS_TRUE@am__append_2 = -mrtp check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ $(am__EXEEXT_16) -TESTS = $(am__append_4) $(MAKETESTS) $(am__EXEEXT_16) -@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_1 = libbacktrace_elf_for_test.la -@NATIVE_TRUE@am__append_2 = test_elf_32 test_elf_64 test_macho \ +TESTS = $(am__append_7) $(MAKETESTS) $(am__EXEEXT_16) +@LIBBACKTRACE_IS_VXWORKS_TRUE@am__append_3 = -mrtp +@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_4 = libbacktrace_elf_for_test.la +@NATIVE_TRUE@am__append_5 = test_elf_32 test_elf_64 test_macho \ @NATIVE_TRUE@ test_xcoff_32 test_xcoff_64 test_pecoff \ @NATIVE_TRUE@ test_unknown unittest unittest_alloc btest -@NATIVE_TRUE@am__append_3 = allocfail -@NATIVE_TRUE@am__append_4 = allocfail.sh -@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_5 = allocfail.dSYM \ +@NATIVE_TRUE@am__append_6 = allocfail +@NATIVE_TRUE@am__append_7 = allocfail.sh +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_8 = allocfail.dSYM \ @NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ btest.dSYM btest_alloc.dSYM \ @NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ stest.dSYM stest_alloc.dSYM \ @NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ edtest.dSYM edtest_alloc.dSYM -@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_6 = b2test -@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_7 = b2test_buildid -@HAVE_BUILDID_TRUE@@HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_8 = b3test -@HAVE_BUILDID_TRUE@@HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_9 = b3test_dwz_buildid -@HAVE_ELF_TRUE@@NATIVE_TRUE@am__append_10 = btest_lto -@NATIVE_TRUE@am__append_11 = btest_alloc stest stest_alloc -@HAVE_DWZ_TRUE@@NATIVE_TRUE@am__append_12 = btest_dwz -@HAVE_DWZ_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_13 = btest_dwz_gnudebuglink -@HAVE_ELF_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_14 = -lz -@HAVE_ELF_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_15 = -lz -@HAVE_ELF_TRUE@@NATIVE_TRUE@am__append_16 = ztest ztest_alloc zstdtest \ +@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_9 = b2test +@HAVE_BUILDID_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_10 = b2test_buildid +@HAVE_BUILDID_TRUE@@HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_11 = b3test +@HAVE_BUILDID_TRUE@@HAVE_DWZ_TRUE@@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_12 = b3test_dwz_buildid +@HAVE_ELF_TRUE@@NATIVE_TRUE@am__append_13 = btest_lto +@NATIVE_TRUE@am__append_14 = btest_alloc stest stest_alloc +@HAVE_DWZ_TRUE@@NATIVE_TRUE@am__append_15 = btest_dwz +@HAVE_DWZ_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_16 = btest_dwz_gnudebuglink +@HAVE_ELF_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_17 = -lz +@HAVE_ELF_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_TRUE@am__append_18 = -lz +@HAVE_ELF_TRUE@@NATIVE_TRUE@am__append_19 = ztest ztest_alloc zstdtest \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ zstdtest_alloc -@HAVE_ELF_TRUE@@HAVE_ZSTD_TRUE@@NATIVE_TRUE@am__append_17 = -lzstd -@HAVE_ELF_TRUE@@HAVE_ZSTD_TRUE@@NATIVE_TRUE@am__append_18 = -lzstd -@NATIVE_TRUE@am__append_19 = edtest edtest_alloc -@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_20 = ttest ttest_alloc -@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_21 = \ +@HAVE_ELF_TRUE@@HAVE_ZSTD_TRUE@@NATIVE_TRUE@am__append_20 = -lzstd +@HAVE_ELF_TRUE@@HAVE_ZSTD_TRUE@@NATIVE_TRUE@am__append_21 = -lzstd +@NATIVE_TRUE@am__append_22 = edtest edtest_alloc +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__append_23 = ttest ttest_alloc +@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_24 = \ @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ ttest.dSYM \ @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ ttest_alloc.dSYM -@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_22 = btest_gnudebuglink -@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_23 = ctestg ctesta -@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@am__append_24 = ctestzstd -@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_25 = ctestg_alloc ctesta_alloc -@HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__append_26 = dwarf5 dwarf5_alloc -@HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_27 = \ +@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_25 = btest_gnudebuglink +@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_26 = ctestg ctesta +@HAVE_COMPRESSED_DEBUG_TRUE@@HAVE_COMPRESSED_DEBUG_ZSTD_TRUE@@NATIVE_TRUE@am__append_27 = ctestzstd +@HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__append_28 = ctestg_alloc ctesta_alloc +@HAVE_DWARF5_TRUE@@NATIVE_TRUE@am__append_29 = dwarf5 dwarf5_alloc +@HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_30 = \ @HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ dwarf5.dSYM \ @HAVE_DWARF5_TRUE@@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@ dwarf5_alloc.dSYM -@NATIVE_TRUE@am__append_28 = mtest -@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_29 = mtest.dSYM -@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@am__append_30 = mtest_minidebug -@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_31 = -llzma -@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_32 = -llzma -@HAVE_ELF_TRUE@am__append_33 = xztest xztest_alloc +@NATIVE_TRUE@am__append_31 = mtest +@NATIVE_TRUE@@USE_DSYMUTIL_TRUE@am__append_32 = mtest.dSYM +@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@am__append_33 = mtest_minidebug +@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_34 = -llzma +@HAVE_ELF_TRUE@@HAVE_LIBLZMA_TRUE@am__append_35 = -llzma +@HAVE_ELF_TRUE@am__append_36 = xztest xztest_alloc subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/lead-dot.m4 \ @@ -961,6 +964,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -974,8 +978,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I config -AM_CPPFLAGS = -AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) +AM_CPPFLAGS = $(am__append_1) +AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) $(am__append_2) include_HEADERS = backtrace.h backtrace-supported.h lib_LTLIBRARIES = libbacktrace.la libbacktrace_la_SOURCES = \ @@ -1025,24 +1029,25 @@ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) # Add a test to this variable if you want it to be built as a Makefile # target and run. -MAKETESTS = $(am__append_7) $(am__append_9) $(am__append_12) \ - $(am__append_13) $(am__append_22) $(am__append_30) +MAKETESTS = $(am__append_10) $(am__append_12) $(am__append_15) \ + $(am__append_16) $(am__append_25) $(am__append_33) # Add a test to this variable if you want it to be built as a program, # with SOURCES, etc., and run. -BUILDTESTS = $(am__append_2) $(am__append_10) $(am__append_11) \ - $(am__append_16) $(am__append_19) $(am__append_20) \ - $(am__append_23) $(am__append_24) $(am__append_25) \ - $(am__append_26) $(am__append_28) $(am__append_33) +BUILDTESTS = $(am__append_5) $(am__append_13) $(am__append_14) \ + $(am__append_19) $(am__append_22) $(am__append_23) \ + $(am__append_26) $(am__append_27) $(am__append_28) \ + $(am__append_29) $(am__append_31) $(am__append_36) # Add a file to this variable if you want it to be built for testing. -check_DATA = $(am__append_5) $(am__append_21) $(am__append_27) \ - $(am__append_29) +check_DATA = $(am__append_8) $(am__append_24) $(am__append_30) \ + $(am__append_32) # Flags to use when compiling test programs. -libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g +libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g \ + $(am__append_3) @NATIVE_TRUE@check_LTLIBRARIES = libbacktrace_alloc.la \ -@NATIVE_TRUE@ libbacktrace_noformat.la $(am__append_1) \ +@NATIVE_TRUE@ libbacktrace_noformat.la $(am__append_4) \ @NATIVE_TRUE@ libbacktrace_instrumented_alloc.la @NATIVE_TRUE@libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES) @NATIVE_TRUE@libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.lo alloc.lo @@ -1118,21 +1123,21 @@ libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_SOURCES = ztest.c testlib.c @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_LDADD = libbacktrace.la \ -@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_14) \ +@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_17) \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_alloc_LDADD = libbacktrace_alloc.la \ -@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_15) \ +@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_18) \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_alloc_SOURCES = $(ztest_SOURCES) @HAVE_ELF_TRUE@@NATIVE_TRUE@ztest_alloc_CFLAGS = $(ztest_CFLAGS) @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_SOURCES = zstdtest.c testlib.c @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_LDADD = libbacktrace.la \ -@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_17) \ +@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_20) \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_alloc_LDADD = \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ libbacktrace_alloc.la \ -@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_18) \ +@HAVE_ELF_TRUE@@NATIVE_TRUE@ $(am__append_21) \ @HAVE_ELF_TRUE@@NATIVE_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_alloc_SOURCES = $(zstdtest_SOURCES) @HAVE_ELF_TRUE@@NATIVE_TRUE@zstdtest_alloc_CFLAGS = $(zstdtest_CFLAGS) @@ -1179,12 +1184,12 @@ libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g @NATIVE_TRUE@mtest_LDADD = libbacktrace.la @HAVE_ELF_TRUE@xztest_SOURCES = xztest.c testlib.c @HAVE_ELF_TRUE@xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" -@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_31) \ +@HAVE_ELF_TRUE@xztest_LDADD = libbacktrace.la $(am__append_34) \ @HAVE_ELF_TRUE@ $(CLOCK_GETTIME_LINK) @HAVE_ELF_TRUE@xztest_alloc_SOURCES = $(xztest_SOURCES) @HAVE_ELF_TRUE@xztest_alloc_CFLAGS = $(xztest_CFLAGS) @HAVE_ELF_TRUE@xztest_alloc_LDADD = libbacktrace_alloc.la \ -@HAVE_ELF_TRUE@ $(am__append_32) $(CLOCK_GETTIME_LINK) +@HAVE_ELF_TRUE@ $(am__append_35) $(CLOCK_GETTIME_LINK) CLEANFILES = \ $(MAKETESTS) $(BUILDTESTS) *.debug elf_for_test.c edtest2_build.c \ gen_edtest2_build \ diff --git a/config.h.in b/config.h.in index dd594d9..1ed22b0 100644 --- a/config.h.in +++ b/config.h.in @@ -20,6 +20,10 @@ don't. */ #undef HAVE_DECL_STRNLEN +/* Define to 1 if you have the declaration of `sysconf', and to 0 if you + don't. */ +#undef HAVE_DECL_SYSCONF + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/configure b/configure index 90594c6..6455ae8 100755 --- a/configure +++ b/configure @@ -680,6 +680,8 @@ PIC_FLAG WARN_FLAGS EXTRA_FLAGS BACKTRACE_FILE +LIBBACKTRACE_IS_VXWORKS_FALSE +LIBBACKTRACE_IS_VXWORKS_TRUE OTOOL64 OTOOL LIPO @@ -772,6 +774,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -859,6 +862,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1111,6 +1115,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1248,7 +1261,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1401,6 +1414,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -11278,7 +11292,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11281 "configure" +#line 11295 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11384,7 +11398,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11387 "configure" +#line 11401 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11648,7 +11662,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11694,7 +11708,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11718,7 +11732,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11763,7 +11777,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11787,7 +11801,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -11824,6 +11838,23 @@ rm -rf conftest* fi +is_vxworks=no +case "${host}" in + *-*-vxworks*) is_vxworks=yes ;; +esac + if test $is_vxworks = yes; then + LIBBACKTRACE_IS_VXWORKS_TRUE= + LIBBACKTRACE_IS_VXWORKS_FALSE='#' +else + LIBBACKTRACE_IS_VXWORKS_TRUE='#' + LIBBACKTRACE_IS_VXWORKS_FALSE= +fi + + +if test "x%is_vxworks" = "xyes"; then + CFLAGS="$CFLAGS -mrtp" +fi + backtrace_supported=yes if test -n "${with_target_subdir}"; then @@ -12482,6 +12513,16 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETPAGESIZE $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "sysconf" "ac_cv_have_decl_sysconf" "$ac_includes_default" +if test "x$ac_cv_have_decl_sysconf" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYSCONF $ac_have_decl +_ACEOF for ac_func in lstat readlink do : @@ -13467,6 +13508,10 @@ if test -z "${HAVE_DWZ_TRUE}" && test -z "${HAVE_DWZ_FALSE}"; then as_fn_error $? "conditional \"HAVE_DWZ\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBBACKTRACE_IS_VXWORKS_TRUE}" && test -z "${LIBBACKTRACE_IS_VXWORKS_FALSE}"; then + as_fn_error $? "conditional \"LIBBACKTRACE_IS_VXWORKS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_ELF_TRUE}" && test -z "${HAVE_ELF_FALSE}"; then as_fn_error $? "conditional \"HAVE_ELF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 557b2c2..cb2ec55 100644 --- a/configure.ac +++ b/configure.ac @@ -92,6 +92,16 @@ AM_PROG_LIBTOOL AC_SYS_LARGEFILE +is_vxworks=no +case "${host}" in + *-*-vxworks*) is_vxworks=yes ;; +esac +AM_CONDITIONAL(LIBBACKTRACE_IS_VXWORKS, test $is_vxworks = yes) + +if test "x%is_vxworks" = "xyes"; then + CFLAGS="$CFLAGS -mrtp" +fi + backtrace_supported=yes if test -n "${with_target_subdir}"; then @@ -388,7 +398,7 @@ if test "$have_fcntl" = "yes"; then [Define to 1 if you have the fcntl function]) fi -AC_CHECK_DECLS([strnlen, getpagesize]) +AC_CHECK_DECLS([strnlen, getpagesize, sysconf]) AC_CHECK_FUNCS(lstat readlink) # Check for getexecname function. diff --git a/mmap.c b/mmap.c index d7313be..fd58e55 100644 --- a/mmap.c +++ b/mmap.c @@ -42,8 +42,12 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "backtrace.h" #include "internal.h" -#ifndef HAVE_DECL_GETPAGESIZE +#if !defined(HAVE_DECL_GETPAGESIZE) || !HAVE_DECL_GETPAGESIZE +#ifdef __VXWORKS__ +#define getpagesize() sysconf(_SC_PAGESIZE) +#else extern int getpagesize (void); +#endif /* __VXWORKS__ */ #endif /* Memory allocation on systems that provide anonymous mmap. This diff --git a/mmapio.c b/mmapio.c index 7f6fa8d..921016b 100644 --- a/mmapio.c +++ b/mmapio.c @@ -40,8 +40,12 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "backtrace.h" #include "internal.h" -#ifndef HAVE_DECL_GETPAGESIZE +#if !defined(HAVE_DECL_GETPAGESIZE) || !HAVE_DECL_GETPAGESIZE +#ifdef __VXWORKS__ +#define getpagesize() sysconf(_SC_PAGESIZE) +#else extern int getpagesize (void); +#endif /* __VXWORKS__ */ #endif #ifndef MAP_FAILED diff --git a/posix.c b/posix.c index 924631d..31bd77c 100644 --- a/posix.c +++ b/posix.c @@ -64,7 +64,7 @@ backtrace_open (const char *filename, backtrace_error_callback error_callback, if (does_not_exist != NULL) *does_not_exist = 0; - descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC)); + descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC), S_IRWXU); if (descriptor < 0) { /* If DOES_NOT_EXIST is not NULL, then don't call ERROR_CALLBACK