From 775f00c69c584a8cf0945fa68a098f6318f3d2d0 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 24 Sep 2022 21:10:23 +0000 Subject: [PATCH] Build fixes. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3987 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- Makefile | 44 ++++++--------- .../libbacktrace_config/backtrace-supported.h | 0 deps/libbacktrace_config/config.h | 53 +++++++++++++++++++ src/task.c | 5 +- 4 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 deps/libbacktrace_config/backtrace-supported.h create mode 100644 deps/libbacktrace_config/config.h diff --git a/Makefile b/Makefile index 2bf6fcf1..5943713f 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,14 @@ APP_OBJS := $(call get_objs,APP_SOURCES) $(APP_OBJS): CFLAGS += \ -Ideps/base64c/include \ -Ideps/crypt_blowfish \ - -Ideps/quickjs \ - -Ideps/sqlite \ - -Ideps/libuv/include \ - -Ideps/xopt \ + -Ideps/libbacktrace \ -Ideps/libsodium \ -Ideps/libsodium/src/libsodium/include \ + -Ideps/libuv/include \ + -Ideps/quickjs \ + -Ideps/sqlite \ -Ideps/valgrind \ + -Ideps/xopt \ -Werror BASE64C_SOURCES := deps/base64c/src/base64c.c @@ -242,36 +243,21 @@ LIBBACKTRACE_SOURCES := \ deps/libbacktrace/atomic.c \ deps/libbacktrace/backtrace.c \ deps/libbacktrace/dwarf.c \ - deps/libbacktrace/elf.c \ deps/libbacktrace/fileline.c \ - deps/libbacktrace/mmap.c \ - deps/libbacktrace/mmapio.c \ - deps/libbacktrace/posix.c \ deps/libbacktrace/print.c \ deps/libbacktrace/simple.c \ deps/libbacktrace/sort.c \ deps/libbacktrace/state.c - - #deps/libbacktrace/unknown.c - #deps/libbacktrace/read.c \ - #deps/libbacktrace/nounwind.c \ - #deps/libbacktrace/instrumented_alloc.c \ - #deps/libbacktrace/pecoff.c \ - #deps/libbacktrace/xcoff.c - #deps/libbacktrace/macho.c \ - #deps/libbacktrace/alloc.c \ - #deps/libbacktrace/allocfail.c - #deps/libbacktrace/btest.c - #deps/libbacktrace/edtest.c - #deps/libbacktrace/edtest2.c - #deps/libbacktrace/mtest.c - #deps/libbacktrace/stest.c - #deps/libbacktrace/test_format.c - #deps/libbacktrace/testlib.c - #deps/libbacktrace/ttest.c - #deps/libbacktrace/unittest.c - #deps/libbacktrace/xztest.c - #deps/libbacktrace/ztest.c +LIBBACKTRACE_SOURCES_unix := \ + deps/libbacktrace/elf.c \ + deps/libbacktrace/mmap.c \ + deps/libbacktrace/mmapio.c \ + deps/libbacktrace/posix.c +LIBBACKTRACE_SOURCES_win := \ + deps/libbacktrace/alloc.c \ + deps/libbacktrace/pecoff.c \ + deps/libbacktrace/posix.c \ + deps/libbacktrace/read.c LIBBACKTRACE_OBJS := $(call get_objs,LIBBACKTRACE_SOURCES) $(LIBBACKTRACE_OBJS): CFLAGS += \ -Ideps/libbacktrace_config \ diff --git a/deps/libbacktrace_config/backtrace-supported.h b/deps/libbacktrace_config/backtrace-supported.h new file mode 100644 index 00000000..e69de29b diff --git a/deps/libbacktrace_config/config.h b/deps/libbacktrace_config/config.h new file mode 100644 index 00000000..c7ec4be5 --- /dev/null +++ b/deps/libbacktrace_config/config.h @@ -0,0 +1,53 @@ +#define BACKTRACE_ELF_SIZE 64 +#define BACKTRACE_XCOFF_SIZE unused +#define HAVE_ATOMIC_FUNCTIONS 1 +#define HAVE_CLOCK_GETTIME 1 +#define HAVE_DECL_GETPAGESIZE 1 +#define HAVE_DECL_STRNLEN 1 +#define HAVE_DLFCN_H 1 +#define HAVE_DL_ITERATE_PHDR 1 +#if defined(__linux__) +#define HAVE_FCNTL 1 +#endif +#define HAVE_GETIPINFO 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LINK_H 1 +#define HAVE_LSTAT 1 +#define HAVE_MEMORY_H 1 +#define HAVE_READLINK 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYNC_FUNCTIONS 1 +#define HAVE_SYS_MMAN_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define LT_OBJDIR ".libs/" +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "package-unused" +#define PACKAGE_STRING "package-unused version-unused" +#define PACKAGE_TARNAME "libbacktrace" +#define PACKAGE_URL "" +#define PACKAGE_VERSION "version-unused" +#define STDC_HEADERS 1 +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif +#pragma once diff --git a/src/task.c b/src/task.c index 78219229..4718d9d2 100644 --- a/src/task.c +++ b/src/task.c @@ -1148,7 +1148,10 @@ JSValue tf_task_allocate_promise(tf_task_t* task, promiseid_t* out_promise) uint32_t stack_hash = fnv32a((const void*)stack, (int)length, 0); int count = 0; void* buffer[32]; -#ifndef _WIN32 +#ifdef _WIN32 + count = CaptureStackBackTrace(0, sizeof(buffer) / sizeof(*buffer), buffer, NULL); + stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash); +#else count = backtrace(buffer, sizeof(buffer) / sizeof(*buffer)); stack_hash = fnv32a((const void*)buffer, sizeof(void*) * count, stack_hash); #endif