diff --git a/golang.spec b/golang.spec index b6cca83b3160e02a1780749b08bffebc138c0276..f649e9700db2208a3a9e9ed3e82697c468333933 100644 --- a/golang.spec +++ b/golang.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 %undefine _missing_build_ids_terminate_build %global bcond_with strict_fips @@ -30,20 +30,20 @@ # Define GOROOT macros %global goroot %{_prefix}/lib/%{name} %global gopath %{_datadir}/gocode -%global golang_arches x86_64 aarch64 ppc64le s390x +%global golang_arches x86_64 aarch64 ppc64le s390x loongarch64 %global golibdir %{_libdir}/%{name} # Golang build options. # Build golang using external/internal(close to cgo disabled) linking. -%ifarch x86_64 ppc64le %{arm} aarch64 s390x +%ifarch x86_64 ppc64le %{arm} aarch64 s390x loongarch64 %global external_linker 1 %else %global external_linker 0 %endif # Build golang with cgo enabled/disabled(later equals more or less to internal linking). -%ifarch x86_64 ppc64le %{arm} aarch64 s390x +%ifarch x86_64 ppc64le %{arm} aarch64 s390x loongarch64 %global cgo_enabled 1 %else %global cgo_enabled 0 @@ -57,7 +57,7 @@ %endif # Controls what ever we fail on failed tests -%ifarch x86_64 %{arm} ppc64le s390x +%ifarch x86_64 %{arm} ppc64le s390x loongarch64 %global fail_on_tests 1 %else %global fail_on_tests 0 @@ -91,6 +91,9 @@ %ifarch s390x %global gohostarch s390x %endif +%ifarch loongarch64 +%global gohostarch loong64 +%endif %global go_api 1.21 %global version 1.21.7 @@ -115,6 +118,10 @@ Source1: https://github.com/golang-fips/go/archive/refs/tags/go%{version}- # make possible to override default traceback level at build time by setting build tag rpm_crashtraceback Source2: fedora.go +Source3: loongarch64.tar.gz +Source4: loongarch64.patches +Source5: race_linux_loong64.syso + # The compiler is written in Go. Needs go(1.4+) compiler for build. # Actual Go based bootstrap compiler provided by above source. %if !%{golang_bootstrap} @@ -254,11 +261,21 @@ ln -s ../go-go%{version} go ./scripts/configure-crypto-tests.sh popd +## Apply loongarch64 patches +tar xf %{SOURCE3} +for p in $(cat %{SOURCE4}); do + patch -p1 -s -i loongarch64/$p +done + +## Delete loongarch64 directory +rm -rf loongarch64 + %autopatch -p1 sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION cp %{SOURCE2} ./src/runtime/ +cp %{SOURCE5} ./src/runtime/race %build set -xe @@ -521,6 +538,9 @@ cd .. %endif %changelog +* Wed May 29 2024 Meidan Li - 1.21.7-2.0.2 +- Add LoongArch64 support + * Mon May 27 2024 Chang Gao - 1.21.7-2.0.1 - disable DISABLE_BoringCertAlgs_TEST test diff --git a/loongarch64.patches b/loongarch64.patches new file mode 100644 index 0000000000000000000000000000000000000000..a6a2cf4fdfcd8724164deb8d18334bf131622270 --- /dev/null +++ b/loongarch64.patches @@ -0,0 +1,53 @@ +0001-oldabi-fix-misc-cgo-test-sigaltstack-size-on-loong64.patch +0002-oldabi-fix-mabi-to-lp64-for-loong64.patch +0003-oldabi-fix-runtime-defs_linux_loong64.patch +0004-oldabi-fix-test-issue11656-for-loong64.patch +0005-oldabi-fixup-stack-growth-after-fork-in-runtime.sigf.patch +0006-oldabi-cmd-internal-obj-loong64-cmd-link-internal-sw.patch +0007-cmd-dist-cmd-link-internal-runtime-add-buildmode-plu.patch +0008-runtime-cmd-go-enable-memory-sanitizer-on-linux-loon.patch +0009-runtime-cmd-go-enable-address-sanitizer-on-linux-loo.patch +0010-internal-sysinfo-print-cpu-type-from-cpuinfo-when-in.patch +0011-cmd-cmd-vendor-pick-up-updates-for-golang.org-x-arch.patch +0012-cmd-internal-objfile-add-loong64-disassembler-suppor.patch +0013-runtime-remove-the-meaningless-offset-of-8-for-duffz.patch +0014-cmd-compiler-remove-the-meaningless-offset-of-8-for-.patch +0015-cmd-internal-obj-loong64-add-atomic-memory-access-in.patch +0016-cmd-compiler-runtime-internal-atomic-optimize-xchg-a.patch +0017-cmd-compiler-runtime-internal-atomic-optimize-xadd-a.patch +0018-cmd-compiler-runtime-internal-atomic-optimize-And-32.patch +0019-cmd-compiler-runtime-internal-atomic-Implementing-xc.patch +0020-cmd-compiler-runtime-internal-atomic-Implementing-xa.patch +0021-cmd-compiler-runtime-internal-atomic-Implementing-An.patch +0022-cmd-internal-obj-loong64-remove-the-invalid-plan9-fo.patch +0023-cmd-internal-obj-loong64-correct-the-instruction-for.patch +0024-cmd-internal-obj-loong64-recheck-jump-offset-boundar.patch +0025-runtime-fix-the-vDSO-symbol-version-for-kernel-4.19-.patch +0026-cmd-link-internal-loadelf-correct-the-relocation-siz.patch +0027-cmd-compile-cmd-internal-runtime-change-the-register.patch +0028-cmd-compile-add-ABI-register-definations-for-loong64.patch +0029-cmd-compile-cmd-internal-runtime-change-registers-on.patch +0030-internal-abi-define-loong64-regABI-constants.patch +0031-cmd-compile-internal-add-register-info-for-loong64-r.patch +0032-cmd-compile-internal-add-spill-support-for-loong64-r.patch +0033-cmd-compile-update-loong64-CALL-ops.patch +0034-runtime-make-duff-device-as-ABIInternal-for-loong64.patch +0035-runtime-support-regABI-and-add-spill-functions-in-ru.patch +0036-reflect-runtime-add-reflect-support-for-regABI-on-lo.patch +0037-internal-bytealg-add-regABI-support-in-bytealg-funct.patch +0038-runtime-add-regABI-support-in-memclr-and-memmove-fun.patch +0039-cmd-internal-obj-set-morestack-arg-spilling-and-rega.patch +0040-cmd-compile-fix-If-lowering-on-loong64.patch +0041-runtime-internal-syscall-use-ABIInternal-for-Syscall.patch +0042-cmd-compile-internal-buildcfg-enable-regABI-on-loong.patch +0043-internal-abi-internal-buildcfg-always-enable-registe.patch +0044-all-delete-loong64-non-register-ABI-fallback-path.patch +0045-cmd-internal-obj-loong64-using-LookupABI-to-find-duf.patch +0046-cmd-internal-cmd-link-unify-the-relocation-nameing-s.patch +0047-oldabi-fix-the-definition-of-members-in-the-PtraceRe.patch +0048-cmd-internal-obj-loong64-remove-unused-register-alia.patch +0049-cmd-internal-runtime-change-the-LR-parameter-registe.patch +0050-cmd-dist-update-isUnsupportedVMASize-test-skip.patch +0051-cmd-runtime-enable-race-detector-on-loong64.patch +0052-runtime-Mark-race-functions-on-loong64-as-ABInternal.patch +0053-runtime-delete-on-register-ABI-fallback-path-for-rac.patch diff --git a/loongarch64.tar.gz b/loongarch64.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1e1ffdb61286e89addb2d9e7f92e9191435fe413 Binary files /dev/null and b/loongarch64.tar.gz differ diff --git a/race_linux_loong64.syso b/race_linux_loong64.syso new file mode 100644 index 0000000000000000000000000000000000000000..0b51b02dbfc4bc98a4688e864eb5c23500104c68 Binary files /dev/null and b/race_linux_loong64.syso differ