office-gobmx/external/firebird/macos-arm64.patch.0
Stephan Bergmann f6be6cd82b external/firebird: Missing include in configure check
...so that with Clang 15 trunk after
<7d644e1215>
"[C11/C2x] Change the behavior of the implicit function declaration warning" the
check now failed to compile with

> configure:21471: checking alignment of long
[...]
> conftest.c:177:3: error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>   exit((int)&((struct s*)1024)->b - 1024);
>   ^
> conftest.c:177:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'

and an exit code of 1 from the compiler invocation, which the check than
silently mistook as an alignment requirement of 1.  (Which then caused the
somewhat obscure fallout of

> workdir/UnpackedTarball/firebird/src/gpre/msc.cpp:463:10: runtime error: member access within misaligned address 0x7f59d8e68196 for type 'gpre_sym', which requires 8 byte alignment

while building ExternalProject_firebird with UBSan.)

The corresponding "checking alignment of double" a few lines further down had
already been modified in ccd0e5f445 "Make firebird
build for macOS on arm64", but without stating what actual problem (if any) it
fixed.  I thus moved that patch into the new
external/firebird/configure-include.patch too, to have them grouped together.

(An alternative fix could be to replace the use of exit with return from main
in those configure checks.)

Change-Id: Iefa02a06d45c83add5f56fad5d726aaecee6d815
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133368
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-25 16:50:59 +02:00

109 lines
2.9 KiB
Diff

-*- Mode: diff -*-
--- configure
+++ configure
@@ -2901,6 +2901,22 @@
RAW_DEVICES_FLG=N
;;
+ aarch64-*-darwin*)
+ MAKEFILE_PREFIX=darwin_arm64
+ MAKEFILE_POSTFIX=darwin
+ PLATFORM=DARWIN
+ INSTALL_PREFIX=darwin
+
+$as_echo "#define DARWIN 1" >>confdefs.h
+
+ LIBS="$LIBS -framework CoreFoundation"
+ EDITLINE_FLG=Y
+ SHRLIB_EXT=dylib
+ CPU_TYPE=arm64
+ EXPORT_SYMBOLS_STYLE=darwin
+ RAW_DEVICES_FLG=N
+ ;;
+
i*86-*-darwin*)
MAKEFILE_PREFIX=darwin_i386
MAKEFILE_POSTFIX=darwin
--- src/common/common.h
+++ src/common/common.h
@@ -234,6 +234,12 @@
#define DARWINPPC64
#define FB_CPU CpuPowerPc64
#endif
+#ifdef __aarch64__
+// This means x86_64, but does it matter? There is no arch_arm64, arch_aarch64, arch_darwin_arm64,
+// or arch_darwin_aarch64 in the P_ARCH enum in src/remote/protocol.h.
+#define DARWIN64
+#define FB_CPU CpuArm64
+#endif
#define IEEE
#define QUADCONST(n) (n##LL)
#define QUADFORMAT "q"
--- src/jrd/license.h
+++ src/jrd/license.h
@@ -128,6 +128,9 @@
#if defined(ARM)
#define FB_PLATFORM "UA"
#endif
+#if defined(__aarch64__)
+#define FB_PLATFORM "UB"
+#endif
#endif
#ifdef DEV_BUILD
--- /dev/null
+++ builds/posix/prefix.darwin_arm64
@@ -0,0 +0,42 @@
+# The contents of this file are subject to the Interbase Public
+# License Version 1.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy
+# of the License at http://www.Inprise.com/IPL.html
+#
+# Software distributed under the License is distributed on an
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
+# or implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code was created by Inprise Corporation
+# and its predecessors. Portions created by Inprise Corporation are
+#
+# Copyright (C) 2000 Inprise Corporation
+# All Rights Reserved.
+# Contributor(s): ______________________________________.
+# Start of file prefix.darwin: $(VERSION) @PLATFORM@
+# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
+#
+
+
+#DYLD_PRINT_ENV=1
+#export DYLD_PRINT_ENV
+
+#DYLD_PRINT_LIBRARIES=1
+#export DYLD_PRINT_LIBRARIES
+
+MACOSX_DEPLOYMENT_TARGET=11.0
+export MACOSX_DEPLOYMENT_TARGET
+
+PROD_FLAGS=-DDARWIN -pipe -O2 -MMD -fPIC -fno-common
+DEV_FLAGS=-ggdb -DDARWIN -pipe -MMD -fPIC -fno-omit-frame-pointer -fno-common -Wall -fno-optimize-sibling-calls -Wno-non-virtual-dtor
+CXXFLAGS:=$(CXXFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden
+
+EXE_LINK_OPTIONS:=
+UNDEF_PLATFORM=
+
+LINK_LIBS+=-liconv
+#MATHLIB=$(ROOT)/extern/libtommath/.libs/libtommath.a
+SO_LINK_LIBS+=-liconv
+
+include $(ROOT)/gen/darwin.defaults
--- src/isql/InputDevices.cpp
+++ src/isql/InputDevices.cpp
@@ -23,7 +23,7 @@
#include "firebird.h"
#if defined(DARWIN) && !defined(IOS)
-#if defined(i386) || defined(__x86_64__)
+#if defined(i386) || defined(__x86_64__) || defined(__arm64__)
#include <architecture/i386/io.h>
#else
#include <io.h>