diff mbox series

[bug#74296,1/1] guix: records: Fix abi check in cross compile context

Message ID c31ee4b87114ec5785854395991bc46293d0202e.1731253918.git.dev@icepic.de
State New
Headers show
Series Fix abi mismatch error on boot for cross-compiled images | expand

Commit Message

Christoph Buck Nov. 10, 2024, 6:23 p.m. UTC
* guix/records.scm: Use 32bit hash value for abi check to prevent
`record-abi-mismatch-error` in a cross-compile context

Change-Id: I889747b1a2837bee8bf9b4de5729fdcf1b165380
---
 guix/records.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/guix/records.scm b/guix/records.scm
index dca1e3c2e7..2084499e36 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -415,11 +415,13 @@  (define-syntax define-record-type*
       ;; list of symbols.
       (syntax-case field-specs ()
         (((field get properties ...) ...)
-         (string-hash (object->string
-                       (syntax->datum #'((field properties ...) ...)))
-                      (cond-expand
-                        (guile-3 (target-most-positive-fixnum))
-                        (else most-positive-fixnum))))))
+         (let ((hash-value
+                (string-hash
+                 (object->string (syntax->datum #'((field properties ...) ...))))))
+           (cond
+            ((< most-positive-fixnum (ash 1 32)) hash-value)
+            ((< most-positive-fixnum (ash 1 64)) (ash hash-value -32))
+            (else (error "unexpected!" most-positive-fixnum)))))))
 
     (syntax-case s ()
       ((_ type syntactic-ctor ctor pred