mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
"RTL" didn't make any sense, and now that there's no other bytecode to disambiguate against, just call it bytecode. * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/bytecode.scm: * module/language/bytecode/spec.scm: * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/contification.scm: * module/language/cps/elide-values.scm: * module/language/cps/primitives.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/spec.scm: * module/language/cps/specialize-primcalls.scm: * module/language/rtl.scm: * module/language/rtl/spec.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * module/system/repl/common.scm: * module/system/vm/assembler.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/dwarf.scm: * test-suite/tests/cross-compilation.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: * test-suite/vm/run-vm-tests.scm: Fixups.
90 lines
3.5 KiB
Scheme
90 lines
3.5 KiB
Scheme
;;;; Cross compilation -*- mode: scheme; coding: utf-8; -*-
|
|
;;;;
|
|
;;;; Copyright (C) 2010, 2011, 2012, 2013 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
|
|
;;;; License as published by the Free Software Foundation; either
|
|
;;;; version 3 of the License, or (at your option) any later version.
|
|
;;;;
|
|
;;;; This library is distributed in the hope that it will be useful,
|
|
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
;;;; Lesser General Public License for more details.
|
|
;;;;
|
|
;;;; You should have received a copy of the GNU Lesser General Public
|
|
;;;; License along with this library; if not, write to the Free Software
|
|
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
(define-module (tests cross-compilation)
|
|
#:use-module (test-suite lib)
|
|
#:use-module (rnrs bytevectors)
|
|
#:use-module (system vm elf)
|
|
#:use-module (system base compile)
|
|
#:use-module (system base target))
|
|
|
|
(define (test-triplet cpu vendor os)
|
|
(let ((triplet (string-append cpu "-" vendor "-" os)))
|
|
(pass-if (format #f "triplet ~a" triplet)
|
|
(with-target triplet
|
|
(lambda ()
|
|
(and (string=? (target-cpu) cpu)
|
|
(string=? (target-vendor) vendor)
|
|
(string=? (target-os) os)))))))
|
|
|
|
(define (native-cpu)
|
|
(with-target %host-type target-cpu))
|
|
|
|
(define (native-os)
|
|
(with-target %host-type target-os))
|
|
|
|
(define (native-word-size)
|
|
((@ (system foreign) sizeof) '*))
|
|
|
|
(define (test-target triplet endian word-size)
|
|
(pass-if (format #f "target `~a' honored" triplet)
|
|
(with-target triplet
|
|
(lambda ()
|
|
(let ((word-size
|
|
;; When the target is the native CPU, rather trust
|
|
;; the native CPU's word size. This is because
|
|
;; Debian's `sparc64-linux-gnu' port, for instance,
|
|
;; actually has a 32-bit user-land, for instance (see
|
|
;; <http://www.debian.org/ports/sparc/#sparc64bit>
|
|
;; for details.)
|
|
(if (and (string=? (native-cpu) (target-cpu))
|
|
(string=? (native-os) (target-os)))
|
|
(native-word-size)
|
|
word-size))
|
|
(bv (compile '(hello-world) #:to 'bytecode)))
|
|
(and=> (parse-elf bv)
|
|
(lambda (elf)
|
|
(and (equal? (elf-byte-order elf) endian)
|
|
(equal? (elf-word-size elf) word-size)))))))))
|
|
|
|
(with-test-prefix "cross-compilation"
|
|
|
|
(test-triplet "i586" "pc" "gnu0.3")
|
|
(test-triplet "x86_64" "unknown" "linux-gnu")
|
|
(test-triplet "x86_64" "unknown" "kfreebsd-gnu")
|
|
|
|
(test-target "i586-pc-gnu0.3" (endianness little) 4)
|
|
(test-target "x86_64-pc-linux-gnu" (endianness little) 8)
|
|
(test-target "powerpc-unknown-linux-gnu" (endianness big) 4)
|
|
(test-target "sparc64-unknown-freebsd8.2" (endianness big) 8)
|
|
|
|
(test-target "mips64el-unknown-linux-gnu" ; n32 or o32 ABI
|
|
(endianness little) 4)
|
|
(test-target "mips64el-unknown-linux-gnuabi64" ; n64 ABI (Debian tuplet)
|
|
(endianness little) 8)
|
|
(test-target "x86_64-unknown-linux-gnux32" ; x32 ABI (Debian tuplet)
|
|
(endianness little) 4)
|
|
|
|
(pass-if-exception "unknown target" exception:miscellaneous-error
|
|
(with-target "fcpu-unknown-gnu1.0"
|
|
(lambda ()
|
|
(compile '(ohai) #:to 'bytecode)))))
|
|
|
|
;; Local Variables:
|
|
;; eval: (put 'with-target 'scheme-indent-function 1)
|
|
;; End:
|