From 9749593fa6a9f5278c4c86dcf9aaf61b76165ff1 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 19:50:38 +0200 Subject: [PATCH 1/6] configure: drop the now unused X86_HOST variable --- configure.ac | 8 -------- 1 file changed, 8 deletions(-) diff --git a/configure.ac b/configure.ac index bf2eea14..4e510606 100644 --- a/configure.ac +++ b/configure.ac @@ -149,14 +149,6 @@ esac AM_CONDITIONAL(WINE_HOST, test x$WINDOWS_HOST = xtrue -a x$WINDOWS_BUILD != xtrue) -# Some tools (like mac ones) only support x86 currently. -case $host_cpu in - i?86|x86_64) - X86_HOST=true - ;; -esac -AM_CONDITIONAL(X86_HOST, test x$X86_HOST = xtrue) - AC_ARG_ENABLE(processor, AS_HELP_STRING([--disable-processor], [Don't build processor library] From bc70ca584af01e401b3e46749c2db25b28a0e6b4 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 20:13:53 +0200 Subject: [PATCH 2/6] src/common/mac/byteswap: define byteswap symbols for MinGW --- src/common/mac/byteswap.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/mac/byteswap.h b/src/common/mac/byteswap.h index c4c7e617..44636366 100644 --- a/src/common/mac/byteswap.h +++ b/src/common/mac/byteswap.h @@ -45,12 +45,19 @@ static inline int16_t ByteSwap(int16_t v) { return OSSwapInt16(v); } static inline int32_t ByteSwap(int32_t v) { return OSSwapInt32(v); } static inline int64_t ByteSwap(int64_t v) { return OSSwapInt64(v); } -#elif defined(__linux__) +#else // For NXByteOrder #include #include +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#define bswap_16(x) __builtin_bswap16(x) +#define bswap_32(x) __builtin_bswap32(x) +#define bswap_64(x) __builtin_bswap64(x) +#else #include #include_next +#endif static inline uint16_t ByteSwap(uint16_t v) { return bswap_16(v); } static inline uint32_t ByteSwap(uint32_t v) { return bswap_32(v); } From 3ed05c877c09d0b82ea3c2058e781ecf93df2851 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 20:14:43 +0200 Subject: [PATCH 3/6] src/common/mac/byteswap: add compat/linux.h compatibility to define pread() on MinGW --- src/common/mac/byteswap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/mac/byteswap.h b/src/common/mac/byteswap.h index 44636366..39a342c3 100644 --- a/src/common/mac/byteswap.h +++ b/src/common/mac/byteswap.h @@ -35,6 +35,8 @@ #ifndef COMMON_MAC_BYTESWAP_H_ #define COMMON_MAC_BYTESWAP_H_ +#include "compat/linux.h" + #ifdef __APPLE__ #include From cfb60a6b9987f1399c5bc350c44bea8d62c753cb Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 19:47:11 +0200 Subject: [PATCH 4/6] configure: detect macOS build machine --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 4e510606..66f97472 100644 --- a/configure.ac +++ b/configure.ac @@ -142,11 +142,16 @@ esac AM_CONDITIONAL(ANDROID_HOST, test x$ANDROID_HOST = xtrue) case $build_os in + darwin*) + MACOS_BUILD=true + ;; mingw* | msys* | cygwin*) WINDOWS_BUILD=true ;; esac +AM_CONDITIONAL(MACOS_BUILD, test x$MACOS_BUILD = xtrue) + AM_CONDITIONAL(WINE_HOST, test x$WINDOWS_HOST = xtrue -a x$WINDOWS_BUILD != xtrue) AC_ARG_ENABLE(processor, From 5209fe40a3c63062f1b738decf47af3ccf04aaa9 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 19:48:04 +0200 Subject: [PATCH 5/6] makefile: only use vendored macOS headers on non-macOS build systems --- Makefile.am | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index aaa1701f..183bfef1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -781,8 +781,12 @@ src_tools_mac_dump_syms_dump_syms_mac_SOURCES = \ src/common/mac/macho_walker.cc \ src/common/mac/macho_walker.h \ src/tools/mac/dump_syms/dump_syms_tool.cc -src_tools_mac_dump_syms_dump_syms_mac_CXXFLAGS= \ - -I$(top_srcdir)/src/third_party/mac_headers \ +src_tools_mac_dump_syms_dump_syms_mac_CXXFLAGS = +if !MACOS_BUILD +src_tools_mac_dump_syms_dump_syms_mac_CXXFLAGS += \ + -I$(top_srcdir)/src/third_party/mac_headers +endif +src_tools_mac_dump_syms_dump_syms_mac_CXXFLAGS += \ $(RUSTC_DEMANGLE_CFLAGS) \ -DHAVE_MACH_O_NLIST_H src_tools_mac_dump_syms_dump_syms_mac_LDADD= \ @@ -905,8 +909,12 @@ src_common_mac_macho_reader_unittest_SOURCES = \ src/common/mac/macho_walker.cc \ src/common/tests/file_utils.cc src_common_mac_macho_reader_unittest_CPPFLAGS = \ - $(AM_CPPFLAGS) $(TEST_CFLAGS) \ - -I$(top_srcdir)/src/third_party/mac_headers \ + $(AM_CPPFLAGS) $(TEST_CFLAGS) +if !MACOS_BUILD +src_common_mac_macho_reader_unittest_CPPFLAGS += \ + -I$(top_srcdir)/src/third_party/mac_headers +endif +src_common_mac_macho_reader_unittest_CPPFLAGS += \ -DHAVE_MACH_O_NLIST_H \ $(PTHREAD_CFLAGS) src_common_mac_macho_reader_unittest_LDADD = \ From 95a0d15e6b99e39d50120ac1cf2b82cc3ab1c4b8 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 19:28:06 +0200 Subject: [PATCH 6/6] makefile: enable the building of dump_syms_mac on every system --- Makefile.am | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 183bfef1..5f470335 100644 --- a/Makefile.am +++ b/Makefile.am @@ -258,6 +258,21 @@ check_SCRIPTS = \ src/processor/minidump_stackwalk_test \ src/processor/minidump_stackwalk_machine_readable_test +## dump_syms tests +check_DEPS = \ + src/tools/linux/dump_syms/dump_syms \ + src/tools/windows/dump_syms_dwarf/dump_syms_dwarf + +check_SCRIPTS = \ + src/tools/linux/dump_syms/dump_syms_test \ + src/tools/windows/dump_syms_dwarf/dump_syms_dwarf_test + +check_DEPS += \ + src/tools/mac/dump_syms/dump_syms_mac + +check_SCRIPTS += \ + src/tools/mac/dump_syms/dump_syms_mac_test + endif !DISABLE_PROCESSOR @@ -305,6 +320,12 @@ check_PROGRAMS += \ # src/tools/linux/symupload/minidump_upload \ # src/tools/linux/symupload/sym_upload +bin_PROGRAMS += \ + src/tools/mac/dump_syms/dump_syms_mac + +check_PROGRAMS += \ + src/common/mac/macho_reader_unittest + if LINUX_HOST bin_PROGRAMS += \ @@ -312,9 +333,6 @@ bin_PROGRAMS += \ src/tools/linux/pid2md/pid2md \ src/tools/linux/md2core/minidump-2-core -bin_PROGRAMS += \ - src/tools/mac/dump_syms/dump_syms_mac - if HAVE_MEMFD_CREATE libexec_PROGRAMS += \ src/tools/linux/core_handler/core_handler @@ -323,9 +341,6 @@ endif check_PROGRAMS += \ src/tools/linux/md2core/minidump_2_core_unittest -check_PROGRAMS += \ - src/common/mac/macho_reader_unittest - endif LINUX_HOST endif !DISABLE_TOOLS