From patchwork Wed Jun 7 05:42:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Z572 <873216071@qq.com> X-Patchwork-Id: 50741 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 99D2B27BBE9; Wed, 7 Jun 2023 06:44:34 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT, MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3F4DE27BBE9 for ; Wed, 7 Jun 2023 06:44:32 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6lxm-00030w-Or; Wed, 07 Jun 2023 01:44:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6lxj-000304-5M for guix-patches@gnu.org; Wed, 07 Jun 2023 01:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6lxi-0005tl-TA for guix-patches@gnu.org; Wed, 07 Jun 2023 01:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q6lxi-0004Sw-KT for guix-patches@gnu.org; Wed, 07 Jun 2023 01:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63940] [PATCH] gnu: sbcl: fix build on riscv64-linux. Resent-From: Z572 <873216071@qq.com> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Jun 2023 05:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63940 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63940@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168611660317105 (code B ref -1); Wed, 07 Jun 2023 05:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jun 2023 05:43:23 +0000 Received: from localhost ([127.0.0.1]:53384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6lx3-0004Rl-9N for submit@debbugs.gnu.org; Wed, 07 Jun 2023 01:43:23 -0400 Received: from lists.gnu.org ([209.51.188.17]:47848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <873216071@qq.com>) id 1q6lww-0004RU-Mh for submit@debbugs.gnu.org; Wed, 07 Jun 2023 01:43:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <873216071@qq.com>) id 1q6lww-0002jL-As for guix-patches@gnu.org; Wed, 07 Jun 2023 01:43:14 -0400 Received: from out203-205-221-192.mail.qq.com ([203.205.221.192]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <873216071@qq.com>) id 1q6lwr-0005i0-Gy for guix-patches@gnu.org; Wed, 07 Jun 2023 01:43:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1686116575; bh=vZxS3MJxDP2eZx+88lWq5rSO4Qb7Mww13ol3jmDll2w=; h=From:To:Subject:Date; b=TXaZs9hozSkzI6vwQ2MXlt+YOC+LeVswrSAIiOHwHqFf5SNk5JNtGzaZasQOYqdnP 2OYGpkNZCPswJhipTo0s1iSmULlzSGNhvJh+leFi+Xmhv3P0OeVMdXuVm0x8M56VDG D587i6naLAjyGLSqsCw6rjxrY5Ooc+4zqcTvQUek= Received: from localhost.localdomain ([111.0.51.197]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id AB50D40A; Wed, 07 Jun 2023 13:42:53 +0800 X-QQ-mid: xmsmtpt1686116573to63brey3 Message-ID: X-QQ-XMAILINFO: My/elTziho8Nd3tGrwKrmmLctm7swgrwpPqQW9uVMVfSuXAn+7UPsc8lvmtlWM Yp6hz6Mj/Cu0/LPuUHfOQ4mBeLutvgtivo5KPDWOBa/8aLMf3aIJleA/5PdO1Ed4FSMr4XC78Wad /UjINmDlb5/GmpYBtI+IO3aqvTrf+Y5uTLVlPDrSSCiSgck+CGQS0o4bf0WdNWzSEBoHbJoHxA7w bkZ9XjvJlM/viD4BhdmiCzNQQ2Bwmp3NSaIRxe8DnjaUrhZkC1glmadQxSi5u6ersuTVGvHWzbWI 45zFDLCylahL9H6b6cmq8nuM1vTlSatZ2mvSKUgyQgyhxQqS8k7SxXQOAs3hZCdiAfL2kYy4yWIE d5v1nL7IwczxFWanDNqETN+/luzA5MeRRtrzekh2rTxYzYjQUtJjm3etP53+K/h6+GyFM7c6W3pb UX/H4fvUt1hdIOAohpURcP7tdQgLZE97WpOQUJD5r4I20Sgukp4nVI4A1NUeR7YAT6v7r486fyVz UWwlcmurBwOQY5c8n5icytRysmoNzORCozW3G00o5YNzz/Wwr06utWHMW9z4a4WnY3R4fKnZzqUu afB4CEkXlfAYqVyfzjjPADsIdccmJNFDd9/Ca6hbSyb5Y2u9x9EM49L1seE/ozYnt1Ruz9xgu+Mw s1Obv96qyTg8FI8mlXIttIaI4uQKUuWHdfyTK3AfLa36FoNozIcpPC4S0MXqUvS2xRdvGEk9qP0w a6iqR+sUzoXdHdyI1zkjhHqurXISc8Tseu8lVoRtwP/jKq4LUT1hFL2EKNtFeadRZWyyFgtcJ0g6 OgvL91TphAAHm3JPr1g1p59tzRIHdC4kllH2Fn6O98T8mpW+b+IIqukv9I0mJAgUHdSTKfECqJ9g KbjoaIS2Z+O7EVvxqL3XAOZhFQflsC6YXDMFimCxTs/zYG5a5tdx8CirzOQwm0RGYDQsAApJbM Date: Wed, 7 Jun 2023 13:42:52 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Received-SPF: pass client-ip=203.205.221.192; envelope-from=873216071@qq.com; helo=out203-205-221-192.mail.qq.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HELO_DYNAMIC_IPADDR=1.951, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Z572 <873216071@qq.com> X-ACL-Warn: , Z572 via Guix-patches X-Patchwork-Original-From: Z572 via Guix-patches via From: Z572 <873216071@qq.com> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/sbcl-riscv-Make-contribs-build-again.patch: new file. * gnu/local.mk(dist_patch_DATA): register it. * gnu/packages/lisp.scm (sbcl): [source]: Use it here. --- gnu/local.mk | 1 + gnu/packages/lisp.scm | 3 + ...sbcl-riscv-Make-contribs-build-again.patch | 71 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 gnu/packages/patches/sbcl-riscv-Make-contribs-build-again.patch diff --git a/gnu/local.mk b/gnu/local.mk index f9afb433e6..254037a3af 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1895,6 +1895,7 @@ dist_patch_DATA = \ %D%/packages/patches/sbcl-clml-fix-types.patch \ %D%/packages/patches/sbcl-eazy-gnuplot-skip-path-check.patch \ %D%/packages/patches/sbcl-png-fix-sbcl-compatibility.patch \ + %D%/packages/patches/sbcl-riscv-Make-contribs-build-again.patch \ %D%/packages/patches/scalapack-gcc-10-compilation.patch \ %D%/packages/patches/scheme48-tests.patch \ %D%/packages/patches/scons-test-environment.patch \ diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 9e896cc8a5..296ed6b5f2 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -23,6 +23,7 @@ ;;; Copyright © 2022 Joeke de Graaf ;;; Copyright © 2021, 2022 jgart ;;; Copyright © 2022 ( +;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -440,6 +441,8 @@ (define-public sbcl (sha256 (base32 "11ji5n65l31249r0v7hm0wc0yk2ila0y746nj36xn1cxrwh0gjc9")) (modules '((guix build utils))) + ;; backport from upstream. + (patches (search-patches "sbcl-riscv-Make-contribs-build-again.patch")) (snippet '(begin ;; Don't force ARMv5. diff --git a/gnu/packages/patches/sbcl-riscv-Make-contribs-build-again.patch b/gnu/packages/patches/sbcl-riscv-Make-contribs-build-again.patch new file mode 100644 index 0000000000..85b96e1b20 --- /dev/null +++ b/gnu/packages/patches/sbcl-riscv-Make-contribs-build-again.patch @@ -0,0 +1,71 @@ +From 8704f528f227f587d0e06dfd2f807aeca7a69a71 Mon Sep 17 00:00:00 2001 +From: Charles Zhang +Date: Thu, 1 Jun 2023 16:39:26 +0200 +Subject: [PATCH] riscv: Make contribs build again. + +The issue was that the LINKAGE_TEMP_REG being NL3 was a C argument +register, so of course that caused clashing on C call-out, causing +problems with run-program. Going back to NL7 didn't work either +because it wasn't getting saved before entry into the trampoline. The +code here used to have NL7 before the trampoline code was gutted and +then restored, so I'm wondering how this ever worked before, because +it definitely did. Pick LIP as the TEMP_REG now because not only does +it get saved, it's also the least likely thing to get disturbed by +clobbering. + +Fixes #lp2002930. + +Also remove assembly routine printing because it doesn't need to be +part of the build script (unlike the other files in output/ which +can't trivially be recovered from a built image), and because not all +disassembler printers have been written on riscv yet. +--- + NEWS | 3 +++ + make-target-2-load.lisp | 4 ---- + src/runtime/riscv-arch.c | 2 +- + 3 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/NEWS b/NEWS +index 17537ff92..5c0f7777b 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,8 @@ + ;;;; -*- coding: utf-8; fill-column: 78 -*- + ++changes relative to sbcl-2.3.5: ++ * bug fix: riscv can build contribs again. ++ + changes in sbcl-2.3.5 relative to sbcl-2.3.4: + * enhancement: Unicode support has been updated to support version 15.0.0 of + the Unicode standard, including addition of characters and their collation +diff --git a/make-target-2-load.lisp b/make-target-2-load.lisp +index 885ebda74..b9a1a1e36 100644 +--- a/make-target-2-load.lisp ++++ b/make-target-2-load.lisp +@@ -6,10 +6,6 @@ + (defvar *compile-files-p* nil) + (load (merge-pathnames "src/cold/warm.lisp" *load-pathname*)) + +-(with-open-file (stream "output/asm-routines.txt" :direction :output +- :if-does-not-exist :create :if-exists :supersede) +- (sb-c:dis sb-fasl:*assembler-routines* stream)) +- + ;; sb-xref-for-internals is actively harmful to tree-shaking. + ;; Remove some symbols to make the hide-packages test pass. + #+sb-xref-for-internals +diff --git a/src/runtime/riscv-arch.c b/src/runtime/riscv-arch.c +index 6c1994829..062623899 100644 +--- a/src/runtime/riscv-arch.c ++++ b/src/runtime/riscv-arch.c +@@ -159,7 +159,7 @@ arch_install_interrupt_handlers(void) + * Linkage entry size is 8 or 20, because we need 2 instructions for the 32-bit case and we need 3 instructions and an 8 byte address in the 64-bit case. + */ + +-#define LINKAGE_TEMP_REG reg_NL3 ++#define LINKAGE_TEMP_REG reg_LIP // Lisp needs to save before entry. + + void arch_write_linkage_table_entry(int index, void *target_addr, int datap) + { +-- +2.40.1 +