diff --git a/0011-add-boost-context-support-for-loongarch64.patch b/0011-add-boost-context-support-for-loongarch64.patch new file mode 100644 index 0000000000000000000000000000000000000000..ffd4b15d6b593c35771f00d020509225e7907781 --- /dev/null +++ b/0011-add-boost-context-support-for-loongarch64.patch @@ -0,0 +1,237 @@ +From 691fa7b2997f4107a024d08f6684f1d70195d133 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Thu, 9 Nov 2023 12:38:46 +0000 +Subject: [PATCH] add boost context support for loongarch64 + +--- + boostcpp.jam | 5 ++-- + libs/config/checks/architecture/Jamfile.jam | 1 + + libs/config/checks/architecture/loongarch.cpp | 11 ++++++++ + libs/context/build/Jamfile.v2 | 13 +++++++++ + libs/context/build/architecture.jam | 4 +++ + libs/context/doc/context.xml | 27 +++++++++++++++++++ + .../doc/html/context/architectures.html | 27 +++++++++++++++++++ + tools/build/src/engine/jam.h | 4 +++ + .../tools/features/architecture-feature.jam | 7 +++-- + 9 files changed, 95 insertions(+), 4 deletions(-) + create mode 100644 libs/config/checks/architecture/loongarch.cpp + +diff --git a/boostcpp.jam b/boostcpp.jam +index 082536e2a..315104be0 100644 +--- a/boostcpp.jam ++++ b/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 loongarch64 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 loongarch64 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/libs/config/checks/architecture/Jamfile.jam b/libs/config/checks/architecture/Jamfile.jam +index c3779d917..ea41afb4a 100644 +--- a/libs/config/checks/architecture/Jamfile.jam ++++ b/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 mips : mips.cpp ; + alias mips1 : mips ; # Backwards compatibility + obj power : power.cpp ; +diff --git a/libs/config/checks/architecture/loongarch.cpp b/libs/config/checks/architecture/loongarch.cpp +new file mode 100644 +index 000000000..5be8cb09b +--- /dev/null ++++ b/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/libs/context/build/Jamfile.v2 b/libs/context/build/Jamfile.v2 +index fb6bcf027..b271a5ff9 100644 +--- a/libs/context/build/Jamfile.v2 ++++ b/libs/context/build/Jamfile.v2 +@@ -254,6 +254,19 @@ alias asm_sources + gcc + ; + ++# 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/libs/context/build/architecture.jam b/libs/context/build/architecture.jam +index 3eaa1b077..39a19f464 100644 +--- a/libs/context/build/architecture.jam ++++ b/libs/context/build/architecture.jam +@@ -59,6 +59,10 @@ rule deduce-architecture ( properties * ) + { + return loongarch ; + } ++ 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/libs/context/doc/context.xml b/libs/context/doc/context.xml +index ef920cd81..1638ea4b0 100644 +--- a/libs/context/doc/context.xml ++++ b/libs/context/doc/context.xml +@@ -3406,6 +3406,33 @@ + + + ++ ++ ++ ++ loongarch64 ++ ++ ++ ++ ++ SYSV|ELF ++ ++ ++ ++ ++ - ++ ++ ++ ++ ++ - ++ ++ ++ ++ ++ - ++ ++ ++ + + + +diff --git a/libs/context/doc/html/context/architectures.html b/libs/context/doc/html/context/architectures.html +index 29bd80371..a1091d829 100644 +--- a/libs/context/doc/html/context/architectures.html ++++ b/libs/context/doc/html/context/architectures.html +@@ -178,6 +178,33 @@ + + + ++ ++

++ loongarch64 ++

++ ++ ++

++ SYSV|ELF ++

++ ++ ++

++ - ++

++ ++ ++

++ - ++

++ ++ ++

++ - ++

++ ++ ++ + +

+ mips +diff --git a/tools/build/src/engine/jam.h b/tools/build/src/engine/jam.h +index b6f291865..27772284e 100644 +--- a/tools/build/src/engine/jam.h ++++ b/tools/build/src/engine/jam.h +@@ -437,6 +437,10 @@ + #define OSPLAT "OSPLAT=PARISC" + #endif + ++#ifdef __loongarch64 ++ #define OSPLAT "OSPLAT=LOONGARCH64" ++#endif ++ + #ifndef OSPLAT + #define OSPLAT "" + #endif +diff --git a/tools/build/src/tools/features/architecture-feature.jam b/tools/build/src/tools/features/architecture-feature.jam +index a47c4bfdc..e40740c1c 100644 +--- a/tools/build/src/tools/features/architecture-feature.jam ++++ b/tools/build/src/tools/features/architecture-feature.jam +@@ -10,7 +10,7 @@ import feature ; + [[bbv2.builtin.features.architecture]]`architecture`:: + *Allowed values:* `x86`, `ia64`, `sparc`, `power`, `mips`, `mips1`, `mips2`, + `mips3`, `mips4`, `mips32`, `mips32r2`, `mips64`, `parisc`, `arm`, +-`s390x`, `loongarch`. ++`s390x`, `loongarch64`. + + + Specifies the general processor family to generate code for. + +@@ -31,7 +31,7 @@ feature.feature architecture + power + + # LoongArch +- loongarch ++ loongarch64 + + # MIPS/SGI + mips mips1 mips2 mips3 mips4 mips32 mips32r2 mips64 +@@ -45,6 +45,9 @@ feature.feature architecture + # RISC-V + riscv + ++ # loongarch ++ loongarch ++ + # z Systems (aka s390x) + s390x + +-- +2.41.0 + diff --git a/boost.spec b/boost.spec index ad8ce93da5e91b7c2d90c33d7f791dbdc18261bc..1ac4ea021ad9b212f73c2ee6a77a472706bcb35c 100644 --- a/boost.spec +++ b/boost.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 %global boost_docdir __tmp_docdir %global boost_examplesdir __tmp_examplesdir @@ -13,7 +13,7 @@ %bcond_without openmpi %endif -%ifnarch x86_64 aarch64 +%ifnarch x86_64 aarch64 loongarch64 %bcond_with context %else %bcond_without context @@ -60,6 +60,7 @@ Patch0009: 0009-boost-1.72.0-mpi-python-build.patch # https://github.com/boostorg/phoenix/issues/111 # https://github.com/boostorg/phoenix/pull/112 Patch0010: 0010-stl-tuple-change-uarg-N-to-internal-linkage.patch +Patch0011: 0011-add-boost-context-support-for-loongarch64.patch BuildRequires: gcc-c++ python3 m4 lua-posix bison zlib-devel libicu-devel BuildRequires: libstdc++-devel bzip2-devel xz-devel libzstd-devel @@ -1249,6 +1250,9 @@ fi %doc %{boost_docdir}/* %changelog +* Tue Nov 7 2023 Wenlong Zhang - 1.81.0-4 +- add boost context support for loongarch64 + * Fri Apr 14 2023 yuanhui - 1.81.0-3 - Optimize the spec file