This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 35670859fa Add a Linux aarch64 port, reusing the FreeBSD aarch64 UNO 
bridge
35670859fa is described below

commit 35670859fae6dc03c6f6f1cf3c5ebb18a0abf34b
Author: Jim Jagielski <[email protected]>
AuthorDate: Sat Oct 31 05:56:37 2026 -0400

    Add a Linux aarch64 port, reusing the FreeBSD aarch64 UNO bridge
    
    Also fixes that bridge's RTTI lookup, which dereferenced the dlsym result 
and crashed when an exception crossed the bridge. Built and run on Ubuntu 24.04 
arm64 only.
---
 main/bridges/Library_cpp_uno.mk                    | 15 +++++++++++
 .../source/cpp_uno/gcc3_freebsd_aarch64/except.cxx |  4 +--
 main/icu/icu-aarch64.patch                         | 24 +++++++++++++++++
 main/icu/makefile.mk                               |  4 +++
 main/openssl/makefile.mk                           |  2 ++
 main/set_soenv.in                                  | 11 ++++++++
 .../unxlngr.mk => bin/refresh_config_guess.sh}     | 31 +++++-----------------
 main/solenv/gbuild/platform/linux.mk               |  5 ++++
 main/solenv/inc/tg_ext.mk                          |  7 ++++-
 main/solenv/inc/unxlngr.mk                         |  6 +++++
 main/source_soenv.sh                               |  3 +++
 11 files changed, 83 insertions(+), 29 deletions(-)

diff --git a/main/bridges/Library_cpp_uno.mk b/main/bridges/Library_cpp_uno.mk
index e3bce187d3..8b1b010db4 100644
--- a/main/bridges/Library_cpp_uno.mk
+++ b/main/bridges/Library_cpp_uno.mk
@@ -210,6 +210,21 @@ $(eval $(call gb_Library_add_libs,$(COMNAME)_uno,\
        -ldl \
 ))
 
+#########################################################
+else ifeq ($(OS)-$(CPUNAME)-$(COMNAME),LINUX-AARCH64-gcc3)
+#########################################################
+
+$(eval $(call gb_Library_add_exception_objects,$(COMNAME)_uno,\
+       bridges/source/cpp_uno/gcc3_freebsd_aarch64/abi \
+       bridges/source/cpp_uno/gcc3_freebsd_aarch64/except \
+       bridges/source/cpp_uno/gcc3_freebsd_aarch64/cpp2uno \
+       bridges/source/cpp_uno/gcc3_freebsd_aarch64/uno2cpp \
+))
+
+$(eval $(call gb_Library_add_asmobjects,$(COMNAME)_uno,\
+       bridges/source/cpp_uno/gcc3_freebsd_aarch64/call \
+))
+
 #######################################################
 else ifeq ($(OS)-$(CPUNAME)-$(COMNAME),LINUX-HPPA-gcc3)
 #######################################################
diff --git a/main/bridges/source/cpp_uno/gcc3_freebsd_aarch64/except.cxx 
b/main/bridges/source/cpp_uno/gcc3_freebsd_aarch64/except.cxx
index fa0189d17d..2730e89963 100644
--- a/main/bridges/source/cpp_uno/gcc3_freebsd_aarch64/except.cxx
+++ b/main/bridges/source/cpp_uno/gcc3_freebsd_aarch64/except.cxx
@@ -230,9 +230,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription 
*pTypeDescr ) SAL_THR
 
        type_info * p = 0;
        {
-               void * sym = dlsym( RTLD_DEFAULT, mangled.getStr() );
-               if ( sym )
-                       p = *reinterpret_cast< type_info ** >( sym );
+               p = static_cast< type_info * >( dlsym( RTLD_DEFAULT, 
mangled.getStr() ) );
        }
 
        if ( p )
diff --git a/main/icu/icu-aarch64.patch b/main/icu/icu-aarch64.patch
new file mode 100644
index 0000000000..43f8a37f0d
--- /dev/null
+++ b/main/icu/icu-aarch64.patch
@@ -0,0 +1,24 @@
+diff -ru misc/icu/source/configure misc/build/icu/source/configure
+--- misc/icu/source/configure
++++ misc/build/icu/source/configure
+@@ -6106,7 +6106,7 @@
+ # Check to see if genccode can generate simple assembly.
+ GENCCODE_ASSEMBLY=
+ case "${host}" in
+-i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
++i*86-*-linux*|x86_64-*-linux*|aarch64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+     if test "$GCC" = yes; then
+         # We're using gcc, and the simple -a gcc command line works for 
genccode
+         GENCCODE_ASSEMBLY="-a gcc"
+diff -ru misc/icu/source/configure.in misc/build/icu/source/configure.in
+--- misc/icu/source/configure.in
++++ misc/build/icu/source/configure.in
+@@ -462,7 +462,7 @@
+ # Check to see if genccode can generate simple assembly.
+ GENCCODE_ASSEMBLY=
+ case "${host}" in
+-i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
++i*86-*-linux*|x86_64-*-linux*|aarch64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+     if test "$GCC" = yes; then
+         # We're using gcc, and the simple -a gcc command line works for 
genccode
+         GENCCODE_ASSEMBLY="-a gcc"
diff --git a/main/icu/makefile.mk b/main/icu/makefile.mk
index c649c0206c..8075c5b9e6 100644
--- a/main/icu/makefile.mk
+++ b/main/icu/makefile.mk
@@ -52,6 +52,10 @@ PATCH_FILES=${TARFILE_NAME}.patch icu-win-layout.patch \
 PATCH_FILES+=icu-darwin.patch
 .ENDIF
 
+.IF "$(OS)$(CPUNAME)"=="LINUXAARCH64"
+PATCH_FILES+=icu-aarch64.patch
+.ENDIF
+
 # ADDITIONAL_FILES=
 
 .IF "$(GUI)"=="UNX"
diff --git a/main/openssl/makefile.mk b/main/openssl/makefile.mk
index 789c2a7424..587ed7f322 100644
--- a/main/openssl/makefile.mk
+++ b/main/openssl/makefile.mk
@@ -77,6 +77,8 @@ UNAME=$(shell uname)
                        CONFIGURE_ACTION=Configure debian-kfreebsd-amd64 no-dso 
no-shared $(NO_ASM)
                .ELIF "$(UNAME)" == "FreeBSD"
                        CONFIGURE_ACTION=Configure BSD-x86_64 no-dso no-shared 
$(NO_ASM)
+               .ELIF "$(UNAME)" == "Linux" && "$(CPUNAME)" == "AARCH64"
+                       CONFIGURE_ACTION=Configure linux-aarch64 no-dso 
no-shared $(NO_ASM)
                .ELSE
                        CONFIGURE_ACTION=Configure linux-x86_64 no-dso 
no-shared $(NO_ASM)
                .ENDIF
diff --git a/main/set_soenv.in b/main/set_soenv.in
index c4814ef895..14c7f05e68 100644
--- a/main/set_soenv.in
+++ b/main/set_soenv.in
@@ -620,6 +620,17 @@ elsif ( $platform =~ m/linux/ )
       $JRETHREADDIR   = 
'$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
       $EPM_FLAGS      = "-a arm";
    }
+   elsif ($platform =~ m/^aarch64/)
+   {  print "Setting Linux AArch64 specific values... ";
+      $outfile        = "LinuxAARCH64Env.Set";
+      $CPU            = "R";
+      $CPUNAME        = "AARCH64";
+      $OUTPATH        = "unxlngr";
+      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."aarch64";
+      $JRETOOLKITDIR  = 
'$JAVA_HOME'.$ds."jre".$ds."lib".$ds."aarch64".$ds."server";
+      $JRETHREADDIR   = 
'$JAVA_HOME'.$ds."jre".$ds."lib".$ds."aarch64".$ds."native_threads";
+      $EPM_FLAGS      = "-a aarch64";
+   }
    elsif ($platform =~ m/^mips/)
    {  print "Setting Linux MIPS specific values... ";
       $outfile        = "LinuxMIPSEnv.Set";
diff --git a/main/solenv/inc/unxlngr.mk 
b/main/solenv/bin/refresh_config_guess.sh
old mode 100644
new mode 100755
similarity index 67%
copy from main/solenv/inc/unxlngr.mk
copy to main/solenv/bin/refresh_config_guess.sh
index fa1e0024d5..1090365793
--- a/main/solenv/inc/unxlngr.mk
+++ b/main/solenv/bin/refresh_config_guess.sh
@@ -1,3 +1,4 @@
+#! /bin/sh
 #**************************************************************
 #
 #  Licensed to the Apache Software Foundation (ASF) under one
@@ -18,28 +19,8 @@
 #  under the License.
 #
 #**************************************************************
-
-
-
-# mk file for Unix Linux ARM using GCC, please make generic modifications to 
unxlng.mk
-
-CDEFAULTOPT=-Os
-.INCLUDE : unxlng.mk
-CDEFS+=-DARM32
-CFLAGS+=-fno-omit-frame-pointer
-DLLPOSTFIX=
-
-.IF "$(ARM_TARGET)" == "ARMV4T"
-ARCH_FLAGS+=-march=armv4t
-CDEFS+=-DARMV4T
-.ENDIF
-
-.IF "$(ARM_TARGET)" == "ARMV6"
-ARCH_FLAGS+=-march=armv6
-CDEFS+=-DARMV6
-.ENDIF
-
-.IF "$(ARM_TARGET)" == "ARMV7"
-ARCH_FLAGS+=-march=armv7-a -mtune=cortex-a8 -mfpu=neon
-CDEFS+=-DARMV7
-.ENDIF
+# usage: refresh_config_guess.sh <dir holding current config.guess and 
config.sub>
+# Run in an external's configure directory; replaces every bundled copy 
beneath it.
+find . \( -name config.guess -o -name config.sub \) -print | while read f; do
+    cp "$1/${f##*/}" "$f" || exit 1
+done
diff --git a/main/solenv/gbuild/platform/linux.mk 
b/main/solenv/gbuild/platform/linux.mk
index a4c57e51ca..4a20578ef0 100644
--- a/main/solenv/gbuild/platform/linux.mk
+++ b/main/solenv/gbuild/platform/linux.mk
@@ -92,6 +92,11 @@ gb_CXXFLAGS := \
        -std=gnu++11 \
        -pipe \
 
+ifeq ($(CPUNAME),AARCH64)
+# with -Os, GCC 13 leaves inline thunks unresolved at link time (libsot)
+gb_CXXFLAGS += -fno-devirtualize
+endif
+
 ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
 # C++11 deprecation/narrowing warnings (std::auto_ptr, dynamic exception specs,
 # braced-init narrowing) must not be fatal.  Mirrors macosx.mk.
diff --git a/main/solenv/inc/tg_ext.mk b/main/solenv/inc/tg_ext.mk
index b093603dc9..89b4399fa1 100644
--- a/main/solenv/inc/tg_ext.mk
+++ b/main/solenv/inc/tg_ext.mk
@@ -231,6 +231,11 @@ CONFIG_SHELL=sh.exe
 .EXPORT: CONFIG_SHELL
 .ENDIF
 
+# the bundled config.guess/config.sub files predate aarch64 Linux
+.IF "$(OS)$(CPUNAME)" == "LINUXAARCH64"
+CONFIGURE_REFRESH=sh $(SOLARENV)/bin/refresh_config_guess.sh $(SRC_ROOT) &&
+.ENDIF
+
 $(PACKAGE_DIR)/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)/$(PATCH_FLAG_FILE)
        @@-$(RM) $@
 .IF "$(CONFIGURE_ACTION)" == "none" || "$(CONFIGURE_ACTION)"==""
@@ -240,7 +245,7 @@ $(PACKAGE_DIR)/$(CONFIGURE_FLAG_FILE) : 
$(PACKAGE_DIR)/$(PATCH_FLAG_FILE)
 .IF "$(OS)"=="OS2"
        $(COMMAND_ECHO)cd $(P_CONFIGURE_DIR) && sh -c 
"$(CONFIGURE_ACTION:s!\!/!) $(CONFIGURE_FLAGS:s!\!/!)" && $(TOUCH) 
$(CONFIGURE_FLAG_FILE)
 .ELSE
-       $(COMMAND_ECHO)cd $(P_CONFIGURE_DIR) && $(CONFIGURE_ACTION) 
$(CONFIGURE_FLAGS) && $(TOUCH) $(CONFIGURE_FLAG_FILE)
+       $(COMMAND_ECHO)cd $(P_CONFIGURE_DIR) && $(CONFIGURE_REFRESH) 
$(CONFIGURE_ACTION) $(CONFIGURE_FLAGS) && $(TOUCH) $(CONFIGURE_FLAG_FILE)
 .ENDIF
        $(COMMAND_ECHO)mv $(P_CONFIGURE_DIR)/$(CONFIGURE_FLAG_FILE) 
$(PACKAGE_DIR)/$(CONFIGURE_FLAG_FILE)
 .ENDIF                 # "$(CONFIGURE_ACTION)"=="none" ||      
"$(CONFIGURE_ACTION)"==""
diff --git a/main/solenv/inc/unxlngr.mk b/main/solenv/inc/unxlngr.mk
index fa1e0024d5..3d5128c3b7 100644
--- a/main/solenv/inc/unxlngr.mk
+++ b/main/solenv/inc/unxlngr.mk
@@ -25,7 +25,13 @@
 
 CDEFAULTOPT=-Os
 .INCLUDE : unxlng.mk
+.IF "$(CPUNAME)" == "AARCH64"
+CDEFS+=-DAARCH64
+BUILD64=1
+CFLAGSCXX+=-fno-devirtualize
+.ELSE
 CDEFS+=-DARM32
+.ENDIF
 CFLAGS+=-fno-omit-frame-pointer
 DLLPOSTFIX=
 
diff --git a/main/source_soenv.sh b/main/source_soenv.sh
index 153f2d35c9..cb2b1d7e4e 100644
--- a/main/source_soenv.sh
+++ b/main/source_soenv.sh
@@ -83,6 +83,9 @@ else
         alpha-*-linux*)
             . ./LinuxAlphaEnv.Set.sh
         ;;
+        aarch64-*-linux*)
+            . ./LinuxAARCH64Env.Set.sh
+        ;;
         arm*-*-linux*)
             . ./LinuxARMEnv.Set.sh
         ;;

Reply via email to