From e07e37569e7db08c82d73d582fb3a488035acd2f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 6 Sep 2021 22:10:58 +0200 Subject: tdf#144340: fix FB configure on Windows ./configure runs on Windows, and sets value of FB_ALIGNMENT, a define that affects the layout of FB's sort memory pool. Trying to include fails on Windows; the test in ./configure considers error value (equal to 2) as the value of the alignment (which should be 4 or 8 depending on arch). This makes the memory misaligned, chunks overlapping and re-written during the sort, memory corrupt, and so on. Removing the include (which is documented in a commit adding a similar include [1] to be needed for m68k) fixes detection. Additionally this cleans up the code added to config.h.in from autoconfig_msvc.h, because the former is auto-generated during configure, and the values get re-written in all occurrences of respective defines anyway. [1] https://github.com/FirebirdSQL/firebird/commit/7ba46163c74211ce4bf1051ee9998db58cb2f396 Change-Id: I8cdc5c764385a04efd130af09138149c748341fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121753 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit c7b5e6566d9b24a0a996c739a945004d9aadee2f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121755 Reviewed-by: Michael Stahl --- external/firebird/firebird-cygwin-msvc.patch | 46 +++++++++++++++++----------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/external/firebird/firebird-cygwin-msvc.patch b/external/firebird/firebird-cygwin-msvc.patch index 9536403886c6..7f4332633316 100644 --- a/external/firebird/firebird-cygwin-msvc.patch +++ b/external/firebird/firebird-cygwin-msvc.patch @@ -27,8 +27,34 @@ grep ODS_VERSION $OdsH | grep -v ENCODE_ODS >$Mini +--- configure 2016-07-07 15:57:04.538983200 +0200 ++++ configure 2016-07-13 11:31:18.132820200 +0200 +@@ -21473,13 +21473,12 @@ + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include + main () { + struct s { + char a; +- union { long long x; sem_t y; } b; ++ long long b; + }; + exit((int)&((struct s*)1024)->b - 1024); + } + _ACEOF + if ac_fn_c_try_run "$LINENO"; then : --- builds/make.new/config/config.h.in 2016-07-07 15:55:55.693112800 +0200 +++ builds/make.new/config/config.h.in 2016-07-08 13:38:49.994986400 +0200 +@@ -211,7 +211,7 @@ + #undef HAVE_GETMNTENT + + /* Define to 1 if you have the `getpagesize' function. */ +-#undef HAVE_GETPAGESIZE ++#define HAVE_GETPAGESIZE 1 + + /* Define to 1 if you have the `getrlimit' function. */ + #undef HAVE_GETRLIMIT @@ -396,7 +396,7 @@ #undef HAVE_SIGSET @@ -56,7 +82,7 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -@@ -703,3 +703,36 @@ +@@ -703,3 +703,20 @@ #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif @@ -66,28 +92,12 @@ +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif +/* target architecture */ -+#if defined(_M_IX86) -+/* sizeof(void *) */ -+#define SIZEOF_VOID_P 4 -+/* sizeof(size_t) */ -+#define SIZEOF_SIZE_T 4 -+/* alignment of long */ -+#define FB_ALIGNMENT 4 -+#elif defined(_M_AMD64) ++#if defined(_M_AMD64) +#define AMD64 -+/* sizeof(void *) */ -+#define SIZEOF_VOID_P 8 -+/* sizeof(size_t) */ -+#define SIZEOF_SIZE_T 8 -+/* alignment of long */ -+#define FB_ALIGNMENT 8 -+#else -+#error unknown target platform +#endif + +#define HAVE_IO_H +#define HAVE_CTIME_S -+#define HAVE_GETPAGESIZE + +#if defined _MSC_VER +#define isnan _isnan -- cgit