[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/16: syscalls: Cross-build fix for alignof*, sizeof*.
From: |
guix-commits |
Subject: |
04/16: syscalls: Cross-build fix for alignof*, sizeof*. |
Date: |
Tue, 5 May 2020 13:14:14 -0400 (EDT) |
janneke pushed a commit to branch wip-hurd-vm
in repository guix.
commit 67f8bfb5ba3f57cf6a6745f0d1cb69ab58425d52
Author: Ludovic Courtès <address@hidden>
AuthorDate: Tue May 5 11:53:39 2020 +0200
syscalls: Cross-build fix for alignof*, sizeof*.
See <https://lists.gnu.org/archive/html/guix-devel/2020-05/msg00008.html>.
Reported by Jan (janneke) Nieuwenhuizen <address@hidden>.
* guix/build/syscalls.scm (sizeof*, alignof*): When cross-compiling, emit
code
to call at runtime.
---
guix/build/syscalls.scm | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 73b439f..00d8ceb 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -23,6 +23,7 @@
(define-module (guix build syscalls)
#:use-module (system foreign)
+ #:use-module (system base target)
#:use-module (rnrs bytevectors)
#:autoload (ice-9 binary-ports) (get-bytevector-n)
#:use-module (srfi srfi-1)
@@ -194,9 +195,14 @@
(* (sizeof* type) n))
((_ type)
(let-syntax ((v (lambda (s)
- (let ((val (sizeof type)))
- (syntax-case s ()
- (_ val))))))
+ ;; When compiling natively, call 'sizeof' at expansion
+ ;; time; otherwise, emit code to call it at run time.
+ (syntax-case s ()
+ (_
+ (if (= (target-word-size)
+ (with-target %host-type target-word-size))
+ (sizeof type)
+ #'(sizeof type)))))))
v))))
(define-syntax alignof*
@@ -208,9 +214,14 @@
(alignof* type))
((_ type)
(let-syntax ((v (lambda (s)
- (let ((val (alignof type)))
- (syntax-case s ()
- (_ val))))))
+ ;; When compiling natively, call 'sizeof' at expansion
+ ;; time; otherwise, emit code to call it at run time.
+ (syntax-case s ()
+ (_
+ (if (= (target-word-size)
+ (with-target %host-type target-word-size))
+ (alignof type)
+ #'(alignof type)))))))
v))))
(define-syntax align ;as found in (system foreign)
- branch wip-hurd-vm created (now 219db43), guix-commits, 2020/05/05
- 01/16: gnu: glibc/hurd-headers: Cross-build fix for the Hurd., guix-commits, 2020/05/05
- 02/16: system: vm: Fix for cross-build to the Hurd., guix-commits, 2020/05/05
- 03/16: gnu: guix: Update to 52ce01b974., guix-commits, 2020/05/05
- 04/16: syscalls: Cross-build fix for alignof*, sizeof*.,
guix-commits <=
- 06/16: system: hurd: Add hurd-default-essential-services., guix-commits, 2020/05/05
- 07/16: system: hurd: Add hurd-grub-configuration-file., guix-commits, 2020/05/05
- 05/16: system: vm: Add defaults for the Hurd., guix-commits, 2020/05/05
- 09/16: system: Add 'hurd' field to <operating-system>., guix-commits, 2020/05/05
- 12/16: services: hurd: Add hurd-etc-sevcices., guix-commits, 2020/05/05
- 08/16: system: hurd: Add hurd-grub-minimal-bootloader., guix-commits, 2020/05/05
- 11/16: system: examples: Add bare-hurd.tmpl., guix-commits, 2020/05/05
- 16/16: HACK: hurd-etc-service: apply target force, guix-commits, 2020/05/05
- 13/16: system: Add hurd activation., guix-commits, 2020/05/05
- 14/16: DRAFT services: hurd: Use activation-service, hurd-etc-service., guix-commits, 2020/05/05