mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
records: Fix ABI check in cross-compilation context.
Fixes <https://issues.guix.gnu.org/74296>. * guix/records.scm (define-record-type*)[compute-abi-cookie]: Use 32bit hash value for abi check to prevent `record-abi-mismatch-error` in a cross-compile context. Change-Id: I889747b1a2837bee8bf9b4de5729fdcf1b165380 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
7c9fcc3e6e
commit
23cbbe6860
1 changed files with 13 additions and 5 deletions
|
@ -415,11 +415,19 @@ inherited."
|
||||||
;; list of symbols.
|
;; list of symbols.
|
||||||
(syntax-case field-specs ()
|
(syntax-case field-specs ()
|
||||||
(((field get properties ...) ...)
|
(((field get properties ...) ...)
|
||||||
(string-hash (object->string
|
;; Passing (target-most-positive-fixnum) as the second argument of
|
||||||
(syntax->datum #'((field properties ...) ...)))
|
;; 'string-hash' won't have the intended effect when cross-compiling
|
||||||
(cond-expand
|
;; because that second argument is used to compute a modulo after the
|
||||||
(guile-3 (target-most-positive-fixnum))
|
;; hash has been computed on an 'unsigned long'. Instead, only keep
|
||||||
(else most-positive-fixnum))))))
|
;; the 32 most significant bits on 64-bit platforms, unconditionally.
|
||||||
|
;; See <https://issues.guix.gnu.org/74296>.
|
||||||
|
(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 ()
|
(syntax-case s ()
|
||||||
((_ type syntactic-ctor ctor pred
|
((_ type syntactic-ctor ctor pred
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue