summaryrefslogtreecommitdiff
path: root/module/system/base
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-06-11 01:52:40 -0400
committerMark H Weaver <mhw@netris.org>2018-06-11 10:12:54 -0400
commitbff75635e5ed08de63b02c661cf65f2e1b28c995 (patch)
tree7a75ea6cd0b1970461211016eb0cd58edd66147e /module/system/base
parent9fbb36725634d05c3e46de7619e2f6019fbeb6fe (diff)
elisp: Fix cross-compilation support.
* module/system/base/target.scm (with-native-target): New exported procedure. * module/language/elisp/spec.scm: In the top-level body expression, call 'compile-and-load' within 'with-native-target' to compile native code. * module/language/elisp/compile-tree-il.scm (eval-when-compile, defmacro): Compile native code.
Diffstat (limited to 'module/system/base')
-rw-r--r--module/system/base/target.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/module/system/base/target.scm b/module/system/base/target.scm
index 8af199537..a3f6f8ff9 100644
--- a/module/system/base/target.scm
+++ b/module/system/base/target.scm
@@ -1,6 +1,6 @@
;;; Compilation targets
-;; Copyright (C) 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2014, 2018 Free Software Foundation, Inc.
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@
(define-module (system base target)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 regex)
- #:export (target-type with-target
+ #:export (target-type with-target with-native-target
target-cpu target-vendor target-os
@@ -56,6 +56,12 @@
(%target-word-size (triplet-pointer-size target)))
(thunk))))
+(define (with-native-target thunk)
+ (with-fluids ((%target-type %host-type)
+ (%target-endianness (native-endianness))
+ (%target-word-size %native-word-size))
+ (thunk)))
+
(define (cpu-endianness cpu)
"Return the endianness for CPU."
(if (string=? cpu (triplet-cpu %host-type))