diff --git a/0001-add-loongarch64-support-for-CxxFlags.patch b/0001-add-loongarch64-support-for-CxxFlags.patch new file mode 100644 index 0000000000000000000000000000000000000000..367822fd808f78648cec0f900a13bd8610d347a4 --- /dev/null +++ b/0001-add-loongarch64-support-for-CxxFlags.patch @@ -0,0 +1,25 @@ +From c886a137a571bd2bd030a7e00bf0ef287a225851 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Fri, 10 Nov 2023 01:13:17 +0000 +Subject: [PATCH] add loongarch64 support for CxxFlags + +--- + src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake b/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake +index c1a1ba043..2dd752d99 100644 +--- a/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake ++++ b/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake +@@ -28,6 +28,8 @@ if(NOT DEFINED ARROW_CPU_FLAG) + set(ARROW_CPU_FLAG "armv8") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7") + set(ARROW_CPU_FLAG "armv7") ++ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64") ++ set(ARROW_CPU_FLAG "loongarch64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc|ppc") + set(ARROW_CPU_FLAG "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") +-- +2.41.0 + diff --git a/0001-add-loongarch64-support-for-boost-in-ceph.patch b/0001-add-loongarch64-support-for-boost-in-ceph.patch new file mode 100644 index 0000000000000000000000000000000000000000..26154f6960383594bd567d429482f8072c31159a --- /dev/null +++ b/0001-add-loongarch64-support-for-boost-in-ceph.patch @@ -0,0 +1,663 @@ +From efbebdf7ca4942c0fadbfe0918cf6a66aeb38395 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Wed, 29 Nov 2023 09:45:48 +0000 +Subject: [PATCH] add loongarch64 support for boost in ceph + +--- + src/boost/boost/predef/architecture.h | 1 + + .../boost/predef/architecture/loongarch.h | 39 ++++++ + src/boost/boost/predef/other/endian.h | 1 + + src/boost/boostcpp.jam | 5 +- + .../config/checks/architecture/Jamfile.jam | 1 + + .../config/checks/architecture/loongarch.cpp | 11 ++ + src/boost/libs/context/CMakeLists.txt | 4 +- + src/boost/libs/context/build/Jamfile.v2 | 13 ++ + src/boost/libs/context/build/architecture.jam | 4 + + src/boost/libs/context/doc/architectures.qbk | 1 + + src/boost/libs/context/doc/context.xml | 27 ++++ + .../doc/html/context/architectures.html | 27 ++++ + .../src/asm/jump_loongarch64_sysv_elf_gas.S | 121 ++++++++++++++++++ + .../src/asm/make_loongarch64_sysv_elf_gas.S | 72 +++++++++++ + .../src/asm/ontop_loongarch64_sysv_elf_gas.S | 118 +++++++++++++++++ + src/boost/tools/build/src/engine/jam.h | 4 + + .../tools/features/architecture-feature.jam | 3 + + 17 files changed, 448 insertions(+), 4 deletions(-) + create mode 100644 src/boost/boost/predef/architecture/loongarch.h + create mode 100644 src/boost/libs/config/checks/architecture/loongarch.cpp + create mode 100644 src/boost/libs/context/src/asm/jump_loongarch64_sysv_elf_gas.S + create mode 100644 src/boost/libs/context/src/asm/make_loongarch64_sysv_elf_gas.S + create mode 100644 src/boost/libs/context/src/asm/ontop_loongarch64_sysv_elf_gas.S + +diff --git a/src/boost/boost/predef/architecture.h b/src/boost/boost/predef/architecture.h +index f43f9464a..b131a8928 100644 +--- a/src/boost/boost/predef/architecture.h ++++ b/src/boost/boost/predef/architecture.h +@@ -16,6 +16,7 @@ http://www.boost.org/LICENSE_1_0.txt) + #include + #include + #include ++#include + #include + #include + #include +diff --git a/src/boost/boost/predef/architecture/loongarch.h b/src/boost/boost/predef/architecture/loongarch.h +new file mode 100644 +index 000000000..17015d894 +--- /dev/null ++++ b/src/boost/boost/predef/architecture/loongarch.h +@@ -0,0 +1,39 @@ ++/* ++Copyright Zhang Na 2022 ++Distributed under the Boost Software License, Version 1.0. ++(See accompanying file LICENSE_1_0.txt or copy at ++http://www.boost.org/LICENSE_1_0.txt) ++*/ ++ ++#ifndef BOOST_PREDEF_ARCHITECTURE_LOONGARCH_H ++#define BOOST_PREDEF_ARCHITECTURE_LOONGARCH_H ++ ++#include ++#include ++ ++/* tag::reference[] ++= `BOOST_ARCH_LOONGARCH` ++[options="header"] ++|=== ++| {predef_symbol} | {predef_version} ++| `+__loongarch__+` | {predef_detection} ++|=== ++*/ // end::reference[] ++ ++#define BOOST_ARCH_LOONGARCH BOOST_VERSION_NUMBER_NOT_AVAILABLE ++ ++#if defined(__loongarch__) ++# undef BOOST_ARCH_LOONGARCH ++# define BOOST_ARCH_LOONGARCH BOOST_VERSION_NUMBER_AVAILABLE ++#endif ++ ++#if BOOST_ARCH_LOONGARCH ++# define BOOST_ARCH_LOONGARCH_AVAILABLE ++#endif ++ ++#define BOOST_ARCH_LOONGARCH_NAME "LoongArch" ++ ++#endif ++ ++#include ++BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_LOONGARCH,BOOST_ARCH_LOONGARCH_NAME) +diff --git a/src/boost/boost/predef/other/endian.h b/src/boost/boost/predef/other/endian.h +index d8ec63ff5..b7126738c 100644 +--- a/src/boost/boost/predef/other/endian.h ++++ b/src/boost/boost/predef/other/endian.h +@@ -121,6 +121,7 @@ information and acquired knowledge: + defined(__ARMEL__) || \ + defined(__THUMBEL__) || \ + defined(__AARCH64EL__) || \ ++ defined(__loongarch__) || \ + defined(_MIPSEL) || \ + defined(__MIPSEL) || \ + defined(__MIPSEL__) || \ +diff --git a/src/boost/boostcpp.jam b/src/boost/boostcpp.jam +index 082536e2a..7209136ea 100644 +--- a/src/boost/boostcpp.jam ++++ b/src/boost/boostcpp.jam +@@ -634,7 +634,7 @@ rule address-model ( ) + return @boostcpp.deduce-address-model ; + } + +-local deducable-architectures = arm mips1 power riscv s390x sparc x86 combined ; ++local deducable-architectures = arm loongarch mips1 power riscv s390x sparc x86 combined ; + feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ; + for a in $(deducable-architectures) + { +@@ -645,9 +645,10 @@ rule deduce-architecture ( properties * ) + { + local result ; + local filtered = [ toolset-properties $(properties) ] ; +- local names = arm mips1 power riscv s390x sparc x86 combined ; ++ local names = arm loongarch mips1 power riscv s390x sparc x86 combined ; + local idx = [ configure.find-builds "default architecture" : $(filtered) + : /boost/architecture//arm ++ : /boost/architecture//loongarch + : /boost/architecture//mips1 + : /boost/architecture//power + : /boost/architecture//riscv +diff --git a/src/boost/libs/config/checks/architecture/Jamfile.jam b/src/boost/libs/config/checks/architecture/Jamfile.jam +index 2ba54f9ad..e8838b413 100644 +--- a/src/boost/libs/config/checks/architecture/Jamfile.jam ++++ b/src/boost/libs/config/checks/architecture/Jamfile.jam +@@ -18,6 +18,7 @@ obj 64 : 64.cpp ; + + obj arm : arm.cpp ; + obj combined : combined.cpp ; ++obj loongarch : loongarch.cpp ; + obj mips1 : mips1.cpp ; + obj power : power.cpp ; + obj riscv : riscv.cpp ; +diff --git a/src/boost/libs/config/checks/architecture/loongarch.cpp b/src/boost/libs/config/checks/architecture/loongarch.cpp +new file mode 100644 +index 000000000..5be8cb09b +--- /dev/null ++++ b/src/boost/libs/config/checks/architecture/loongarch.cpp +@@ -0,0 +1,11 @@ ++// loongarch.cpp ++// ++// Copyright (c) 2012 Steven Watanabe ++// ++// Distributed under the Boost Software License Version 1.0. (See ++// accompanying file LICENSE_1_0.txt or copy at ++// http://www.boost.org/LICENSE_1_0.txt) ++ ++#if !defined(__loongarch__) ++#error "Not LoongArch" ++#endif +diff --git a/src/boost/libs/context/CMakeLists.txt b/src/boost/libs/context/CMakeLists.txt +index d11a6721d..f2c70e901 100644 +--- a/src/boost/libs/context/CMakeLists.txt ++++ b/src/boost/libs/context/CMakeLists.txt +@@ -48,7 +48,7 @@ unset(_default_abi) + + ## Arch-and-model + +-set(_all_archs arm arm64 mips32 mips64 ppc32 ppc64 riscv64 s390x i386 x86_64 combined) ++set(_all_archs arm arm64 loongarch64 mips32 mips64 ppc32 ppc64 riscv64 s390x i386 x86_64 combined) + + # Try at start to auto determine arch from CMake. + if(CMAKE_SYSTEM_PROCESSOR IN_LIST _all_archs) +@@ -72,7 +72,7 @@ else() + endif() + endif() + +-set(BOOST_CONTEXT_ARCHITECTURE "${_default_arch}" CACHE STRING "Boost.Context architecture (arm, arm64, mips32, mips64, ppc32, ppc64, riscv64, s390x, i386, x86_64, combined)") ++set(BOOST_CONTEXT_ARCHITECTURE "${_default_arch}" CACHE STRING "Boost.Context architecture (arm, arm64, loongarch64, mips32, mips64, ppc32, ppc64, riscv64, s390x, i386, x86_64, combined)") + set_property(CACHE BOOST_CONTEXT_ARCHITECTURE PROPERTY STRINGS ${_all_archs}) + + unset(_all_archs) +diff --git a/src/boost/libs/context/build/Jamfile.v2 b/src/boost/libs/context/build/Jamfile.v2 +index d5e8db153..9df8f0a96 100644 +--- a/src/boost/libs/context/build/Jamfile.v2 ++++ b/src/boost/libs/context/build/Jamfile.v2 +@@ -229,6 +229,19 @@ alias asm_sources + darwin + ; + ++# LOONGARCH64 ++# LOONGARCH64/SYSV/ELF ++alias asm_sources ++ : asm/make_loongarch64_sysv_elf_gas.S ++ asm/jump_loongarch64_sysv_elf_gas.S ++ asm/ontop_loongarch64_sysv_elf_gas.S ++ : sysv ++ 64 ++ loongarch ++ elf ++ gcc ++ ; ++ + # MIPS + # MIPS32/O32/ELF + alias asm_sources +diff --git a/src/boost/libs/context/build/architecture.jam b/src/boost/libs/context/build/architecture.jam +index 56159a744..3eaa1b077 100644 +--- a/src/boost/libs/context/build/architecture.jam ++++ b/src/boost/libs/context/build/architecture.jam +@@ -55,6 +55,10 @@ rule deduce-architecture ( properties * ) + { + return arm ; + } ++ else if [ configure.builds /boost/architecture//loongarch : $(properties) : loongarch ] ++ { ++ return loongarch ; ++ } + else if [ configure.builds /boost/architecture//mips : $(properties) : mips ] + { + return mips ; +diff --git a/src/boost/libs/context/doc/architectures.qbk b/src/boost/libs/context/doc/architectures.qbk +index d9fbece65..8cd33eae0 100644 +--- a/src/boost/libs/context/doc/architectures.qbk ++++ b/src/boost/libs/context/doc/architectures.qbk +@@ -15,6 +15,7 @@ architectures: + [[arm (aarch32)] [AAPCS|ELF] [AAPCS|PE] [-] [AAPCS|MACH-O]] + [[arm (aarch64)] [AAPCS|ELF] [-] [AAPCS|MACH-O] [AAPCS|MACH-O]] + [[i386] [SYSV|ELF] [MS|PE] [SYSV|MACH-O] [-]] ++ [[loongarch64] [SYSV|ELF] [-] [-] [-]] + [[mips] [O32|N64|ELF] [-] [-] [-]] + [[ppc32] [SYSV|ELF|XCOFF] [-] [SYSV|MACH-O] [-]] + [[ppc64] [SYSV|ELF|XCOFF] [-] [SYSV|MACH-O] [-]] +diff --git a/src/boost/libs/context/doc/context.xml b/src/boost/libs/context/doc/context.xml +index d83439dbd..ef920cd81 100644 +--- a/src/boost/libs/context/doc/context.xml ++++ b/src/boost/libs/context/doc/context.xml +@@ -3379,6 +3379,33 @@ + + + ++ ++ ++ ++ loongarch64 ++ ++ ++ ++ ++ SYSV|ELF ++ ++ ++ ++ ++ - ++ ++ ++ ++ ++ - ++ ++ ++ ++ ++ - ++ ++ ++ + + + +diff --git a/src/boost/libs/context/doc/html/context/architectures.html b/src/boost/libs/context/doc/html/context/architectures.html +index 416627d66..29bd80371 100644 +--- a/src/boost/libs/context/doc/html/context/architectures.html ++++ b/src/boost/libs/context/doc/html/context/architectures.html +@@ -151,6 +151,33 @@ + + + ++ ++

++ loongarch64 ++

++ ++ ++

++ SYSV|ELF ++

++ ++ ++

++ - ++

++ ++ ++

++ - ++

++ ++ ++

++ - ++

++ ++ ++ + +

+ mips +diff --git a/src/boost/libs/context/src/asm/jump_loongarch64_sysv_elf_gas.S b/src/boost/libs/context/src/asm/jump_loongarch64_sysv_elf_gas.S +new file mode 100644 +index 000000000..74c081e07 +--- /dev/null ++++ b/src/boost/libs/context/src/asm/jump_loongarch64_sysv_elf_gas.S +@@ -0,0 +1,121 @@ ++/******************************************************* ++ * * ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | FS0 | FS1 | FS2 | FS3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | FS4 | FS5 | FS6 | FS7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | S0 | S1 | S2 | S3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * ++ * ------------------------------------------------- * ++ * | S4 | S5 | S6 | S7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * ++ * ------------------------------------------------- * ++ * | S8 | FP | RA | PC | * ++ * ------------------------------------------------- * ++ * * ++ * *****************************************************/ ++ ++.file "jump_loongarch64_sysv_elf_gas.S" ++.text ++.globl jump_fcontext ++.align 2 ++.type jump_fcontext,@function ++jump_fcontext: ++ # reserve space on stack ++ addi.d $sp, $sp, -160 ++ ++ # save fs0 - fs7 ++ fst.d $fs0, $sp, 0 ++ fst.d $fs1, $sp, 8 ++ fst.d $fs2, $sp, 16 ++ fst.d $fs3, $sp, 24 ++ fst.d $fs4, $sp, 32 ++ fst.d $fs5, $sp, 40 ++ fst.d $fs6, $sp, 48 ++ fst.d $fs7, $sp, 56 ++ ++ # save s0 - s8, fp, ra ++ st.d $s0, $sp, 64 ++ st.d $s1, $sp, 72 ++ st.d $s2, $sp, 80 ++ st.d $s3, $sp, 88 ++ st.d $s4, $sp, 96 ++ st.d $s5, $sp, 104 ++ st.d $s6, $sp, 112 ++ st.d $s7, $sp, 120 ++ st.d $s8, $sp, 128 ++ st.d $fp, $sp, 136 ++ st.d $ra, $sp, 144 ++ ++ # save RA as PC ++ st.d $ra, $sp, 152 ++ ++ # store SP (pointing to context-data) in A2 ++ move $a2, $sp ++ ++ # restore SP (pointing to context-data) from A0 ++ move $sp, $a0 ++ ++ # load fs0 - fs7 ++ fld.d $fs0, $sp, 0 ++ fld.d $fs1, $sp, 8 ++ fld.d $fs2, $sp, 16 ++ fld.d $fs3, $sp, 24 ++ fld.d $fs4, $sp, 32 ++ fld.d $fs5, $sp, 40 ++ fld.d $fs6, $sp, 48 ++ fld.d $fs7, $sp, 56 ++ ++ #load s0 - s7 ++ ld.d $s0, $sp, 64 ++ ld.d $s1, $sp, 72 ++ ld.d $s2, $sp, 80 ++ ld.d $s3, $sp, 88 ++ ld.d $s4, $sp, 96 ++ ld.d $s5, $sp, 104 ++ ld.d $s6, $sp, 112 ++ ld.d $s7, $sp, 120 ++ ld.d $s8, $sp, 128 ++ ld.d $fp, $sp, 136 ++ ld.d $ra, $sp, 144 ++ ++ # return transfer_t from jump ++ # pass transfer_t as first arg in context function ++ # a0 == FCTX, a1 == DATA ++ move $a0, $a2 ++ ++ # load PC ++ ld.d $a2, $sp, 152 ++ ++ # restore stack ++ addi.d $sp, $sp, 160 ++ ++ # jump to context ++ jr $a2 ++.size jump_fcontext, .-jump_fcontext ++ ++/* Mark that we don't need executable stack. */ ++.section .note.GNU-stack,"",%progbits +diff --git a/src/boost/libs/context/src/asm/make_loongarch64_sysv_elf_gas.S b/src/boost/libs/context/src/asm/make_loongarch64_sysv_elf_gas.S +new file mode 100644 +index 000000000..55062702f +--- /dev/null ++++ b/src/boost/libs/context/src/asm/make_loongarch64_sysv_elf_gas.S +@@ -0,0 +1,72 @@ ++/******************************************************* ++ * * ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | FS0 | FS1 | FS2 | FS3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | FS4 | FS5 | FS6 | FS7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | S0 | S1 | S2 | S3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * ++ * ------------------------------------------------- * ++ * | S4 | S5 | S6 | S7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * ++ * ------------------------------------------------- * ++ * | S8 | FP | RA | PC | * ++ * ------------------------------------------------- * ++ * * ++ * *****************************************************/ ++ ++.file "make_loongarch64_sysv_elf_gas.S" ++.text ++.globl make_fcontext ++.align 2 ++.type make_fcontext,@function ++make_fcontext: ++ # shift address in A0 to lower 16 byte boundary ++ bstrins.d $a0, $zero, 3, 0 ++ ++ # reserve space for context-data on context-stack ++ addi.d $a0, $a0, -160 ++ ++ # third arg of make_fcontext() == address of context-function ++ st.d $a2, $a0, 152 ++ ++ # save address of finish as return-address for context-function ++ # will be entered after context-function returns ++ la.local $a4, finish ++ st.d $a4, $a0, 144 ++ ++ # return pointer to context-data ++ jr $ra ++ ++finish: ++ # exit code is zero ++ li.d $a0, 0 ++ # call _exit(0) ++ b %plt(_exit) ++ ++.size make_fcontext, .-make_fcontext ++/* Mark that we don't need executable stack. */ ++.section .note.GNU-stack,"",%progbits +diff --git a/src/boost/libs/context/src/asm/ontop_loongarch64_sysv_elf_gas.S b/src/boost/libs/context/src/asm/ontop_loongarch64_sysv_elf_gas.S +new file mode 100644 +index 000000000..c6ea04485 +--- /dev/null ++++ b/src/boost/libs/context/src/asm/ontop_loongarch64_sysv_elf_gas.S +@@ -0,0 +1,118 @@ ++/******************************************************* ++ * * ++ * ------------------------------------------------- * ++ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ++ * ------------------------------------------------- * ++ * | 0 | 8 | 16 | 24 | * ++ * ------------------------------------------------- * ++ * | FS0 | FS1 | FS2 | FS3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ++ * ------------------------------------------------- * ++ * | 32 | 40 | 48 | 56 | * ++ * ------------------------------------------------- * ++ * | FS4 | FS5 | FS6 | FS7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ++ * ------------------------------------------------- * ++ * | 64 | 72 | 80 | 88 | * ++ * ------------------------------------------------- * ++ * | S0 | S1 | S2 | S3 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * ++ * ------------------------------------------------- * ++ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * ++ * ------------------------------------------------- * ++ * | S4 | S5 | S6 | S7 | * ++ * ------------------------------------------------- * ++ * ------------------------------------------------- * ++ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * ++ * ------------------------------------------------- * ++ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * ++ * ------------------------------------------------- * ++ * | S8 | FP | RA | PC | * ++ * ------------------------------------------------- * ++ * * ++ * *****************************************************/ ++ ++.file "ontop_loongarch64_sysv_elf_gas.S" ++.text ++.globl ontop_fcontext ++.align 2 ++.type ontop_fcontext,@function ++ontop_fcontext: ++ # reserve space on stack ++ addi.d $sp, $sp, -160 ++ ++ # save fs0 - fs7 ++ fst.d $fs0, $sp, 0 ++ fst.d $fs1, $sp, 8 ++ fst.d $fs2, $sp, 16 ++ fst.d $fs3, $sp, 24 ++ fst.d $fs4, $sp, 32 ++ fst.d $fs5, $sp, 40 ++ fst.d $fs6, $sp, 48 ++ fst.d $fs7, $sp, 56 ++ ++ # save s0 - s8, fp, ra ++ st.d $s0, $sp, 64 ++ st.d $s1, $sp, 72 ++ st.d $s2, $sp, 80 ++ st.d $s3, $sp, 88 ++ st.d $s4, $sp, 96 ++ st.d $s5, $sp, 104 ++ st.d $s6, $sp, 112 ++ st.d $s7, $sp, 120 ++ st.d $s8, $sp, 128 ++ st.d $fp, $sp, 136 ++ st.d $ra, $sp, 144 ++ ++ # save RA as PC ++ st.d $ra, $sp, 152 ++ ++ # store SP (pointing to context-data) in A3 ++ move $a3, $sp ++ ++ # restore SP (pointing to context-data) from A0 ++ move $sp, $a0 ++ ++ # load fs0 - fs11 ++ fld.d $fs0, $sp, 0 ++ fld.d $fs1, $sp, 8 ++ fld.d $fs2, $sp, 16 ++ fld.d $fs3, $sp, 24 ++ fld.d $fs4, $sp, 32 ++ fld.d $fs5, $sp, 40 ++ fld.d $fs6, $sp, 48 ++ fld.d $fs7, $sp, 56 ++ ++ #load s0 - s11, fp, ra ++ ld.d $s0, $sp, 64 ++ ld.d $s1, $sp, 72 ++ ld.d $s2, $sp, 80 ++ ld.d $s3, $sp, 88 ++ ld.d $s4, $sp, 96 ++ ld.d $s5, $sp, 104 ++ ld.d $s6, $sp, 112 ++ ld.d $s7, $sp, 120 ++ ld.d $s8, $sp, 128 ++ ld.d $fp, $sp, 136 ++ ld.d $ra, $sp, 144 ++ ++ # return transfer_t from jump ++ # pass transfer_t as first arg in context function ++ # a0 == FCTX, a1 == DATA ++ move $a0, $a3 ++ ++ # adjust stack ++ addi.d $sp, $sp, 160 ++ ++ # jump to context ++ jr $a2 ++.size ontop_fcontext, .-ontop_fcontext ++ ++/* Mark that we don't need executable stack. */ ++.section .note.GNU-stack,"",%progbits +diff --git a/src/boost/tools/build/src/engine/jam.h b/src/boost/tools/build/src/engine/jam.h +index 34a6fbeaa..91c3dd85d 100644 +--- a/src/boost/tools/build/src/engine/jam.h ++++ b/src/boost/tools/build/src/engine/jam.h +@@ -441,6 +441,10 @@ + #define OSPLAT "OSPLAT=PARISC" + #endif + ++#ifdef __loongarch64 ++ #define OSPLAT "OSPLAT=LOONGARCH64" ++#endif ++ + #ifndef OSPLAT + #define OSPLAT "" + #endif +diff --git a/src/boost/tools/build/src/tools/features/architecture-feature.jam b/src/boost/tools/build/src/tools/features/architecture-feature.jam +index 3fb0059f4..842498c8f 100644 +--- a/src/boost/tools/build/src/tools/features/architecture-feature.jam ++++ b/src/boost/tools/build/src/tools/features/architecture-feature.jam +@@ -42,6 +42,9 @@ feature.feature architecture + # RISC-V + riscv + ++ # loongarch ++ loongarch ++ + # z Systems (aka s390x) + s390x + : +-- +2.41.0 + diff --git a/0001-add-loongarch64-support-for-double-conversion.patch b/0001-add-loongarch64-support-for-double-conversion.patch new file mode 100644 index 0000000000000000000000000000000000000000..d5b04ddea64225cd63a0cb59d37ebe03f84d499c --- /dev/null +++ b/0001-add-loongarch64-support-for-double-conversion.patch @@ -0,0 +1,24 @@ +From 5b6d22820f7f7322b610aaccbea464344b885e73 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Fri, 10 Nov 2023 01:40:31 +0000 +Subject: [PATCH 1/2] add loongarch64 support for double-conversion + +--- + src/arrow/cpp/src/arrow/vendored/double-conversion/utils.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/arrow/cpp/src/arrow/vendored/double-conversion/utils.h b/src/arrow/cpp/src/arrow/vendored/double-conversion/utils.h +index 4328344d7..e7b4b3751 100644 +--- a/src/arrow/cpp/src/arrow/vendored/double-conversion/utils.h ++++ b/src/arrow/cpp/src/arrow/vendored/double-conversion/utils.h +@@ -101,6 +101,7 @@ int main(int argc, char** argv) { + defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\ + defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \ + defined(__riscv) || \ ++ defined(__loongarch64) || \ + defined(__or1k__) || defined(__arc__) || \ + defined(__EMSCRIPTEN__) + #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 +-- +2.41.0 + diff --git a/0001-add-loongarch64-support-for-fast_float.patch b/0001-add-loongarch64-support-for-fast_float.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ab64a3504f1df05b6620592655ffc3536d91b89 --- /dev/null +++ b/0001-add-loongarch64-support-for-fast_float.patch @@ -0,0 +1,24 @@ +From 9a554978b0fcadadf922d5298fd00c80b79ea7b8 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Fri, 10 Nov 2023 01:47:07 +0000 +Subject: [PATCH 2/2] add loongarch64 support for fast_float + +--- + src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h b/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h +index f7b7662b9..117a5d455 100644 +--- a/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h ++++ b/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h +@@ -9,6 +9,7 @@ + || defined(__amd64) || defined(__aarch64__) || defined(_M_ARM64) \ + || defined(__MINGW64__) \ + || defined(__s390x__) \ ++ || defined(__loongarch64) \ + || (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) \ + || defined(__EMSCRIPTEN__)) + #define FASTFLOAT_64BIT +-- +2.41.0 + diff --git a/boost_1_78_0.tar.gz b/boost_1_78_0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..190dc53c072f2cac18dee9d1fc1c171a7582668e Binary files /dev/null and b/boost_1_78_0.tar.gz differ diff --git a/ceph.spec b/ceph.spec index 70756a84c203b899ec8328d4629c56ac75c58c68..e4e2ffcb43511fe13ad9a444d7eeed18dd0c1e9e 100644 --- a/ceph.spec +++ b/ceph.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 %global _hardened_build 1 %bcond_with make_check @@ -13,7 +13,7 @@ %else %bcond_with rbd_rwl_cache %endif -%ifarch %{arm64} +%ifarch %{arm64} loongarch64 %bcond_with system_pmdk %else %bcond_without system_pmdk @@ -77,6 +77,9 @@ Summary: User space components of the Ceph file system License: (LGPLv2+ or LGPLv3) and CC-BY-SA-3.0 and GPLv2 and Boost and BSD and MIT URL: http://ceph.com/ Source0: https://download.ceph.com/tarballs/ceph-%{version}.tar.gz +#https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz +Source1: boost_1_78_0.tar.gz +Source2: 0001-add-loongarch64-support-for-boost-in-ceph.patch Patch0001: 0001-src-common-crc32c_intel_fast.patch Patch0003: 0003-src-common-bitstr.h.patch Patch0008: 0008-cmake-modules-Finduring.cmake.patch @@ -96,6 +99,9 @@ Patch1001: ceph-17.2.0-pybind-boost-1.74.patch Patch1002: ceph-17.2.5-boost-1.81.patch Patch1003: ceph-17.2.0-deprecated-boost.patch %endif +Patch1004: 0001-add-loongarch64-support-for-CxxFlags.patch +Patch1005: 0001-add-loongarch64-support-for-double-conversion.patch +Patch1006: 0001-add-loongarch64-support-for-fast_float.patch ################################################################################# # dependencies that apply across all distro families ################################################################################# @@ -861,6 +867,12 @@ This package provides Ceph default alerts for Prometheus. ################################################################################# %prep %autosetup -p1 +%ifarch loongarch64 +rm -rf %{_builddir}/%{name}-%{version}/src/boost/* +#SOURCE2 boost-1.78.0 +tar -xf %{SOURCE1} -C %{_builddir}/%{name}-%{version}/src/boost --strip-components 1 +patch -p1 < %{SOURCE2} +%endif %build @@ -1943,6 +1955,12 @@ exit 0 %config %{_sysconfdir}/prometheus/ceph/ceph_default_alerts.yml %changelog +* Thu Nov 30 2023 Wenlong Zhang - 17.2.5-4 +- add loongarch64 support for double-conversion +- add loongarch64 support for fast_float +- add loongarch64 support for ARROW_CPU_FLAG +- update boost to 1.78.0 in ceph for loongarch64 + * Wed Jun 14 2023 Bo Ren - 17.2.5-3 - rebuild with thrift-0.18.1-1