diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-02-27 20:36:52 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-02-27 20:40:08 +0100 |
commit | 9130ec74cf55a2531a364ef16b6608489b583f16 (patch) | |
tree | 5efddb36c46c533d1c417ab12a101a8ed52cd6d9 /module/system/base | |
parent | cc2948aa3189b7bd29c23e7a93ccb1217a1b4eff (diff) |
Check whether a triplet's OS part specifies an ABI.
* module/system/base/target.scm (cpu-word-size): Rename to...
(triplet-pointer-size): ... this. Update caller. Take a triplet as
the argument. Check the `triplet-os' part when checking for equality
with the host. Add support "mips64.*-gnuabi64".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")
[ "mips64el-unknown-linux-gnuabi64"]: New test.
Diffstat (limited to 'module/system/base')
-rw-r--r-- | module/system/base/target.scm | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/module/system/base/target.scm b/module/system/base/target.scm index 93c644a08..5cc0c1d75 100644 --- a/module/system/base/target.scm +++ b/module/system/base/target.scm @@ -55,7 +55,7 @@ (let ((cpu (triplet-cpu target))) (with-fluids ((%target-type target) (%target-endianness (cpu-endianness cpu)) - (%target-word-size (cpu-word-size cpu))) + (%target-word-size (triplet-pointer-size target))) (thunk)))) (define (cpu-endianness cpu) @@ -75,21 +75,28 @@ (else (error "unknown CPU endianness" cpu))))) -(define (cpu-word-size cpu) - "Return the word size for CPU." - (if (string=? cpu (triplet-cpu %host-type)) - %native-word-size - (cond ((string-match "^i[0-9]86$" cpu) 4) - - ;; See <http://www.linux-mips.org/wiki/WhatsWrongWithO32N32N64> - ;; for details on the MIPS ABIs. - ((string-match "^mips64" cpu) 4) ; n32 or o32 - - ((string-match "64$" cpu) 8) - ((string-match "64[lbe][lbe]$" cpu) 8) - ((member cpu '("sparc" "powerpc" "mips" "mipsel")) 4) - ((string-match "^arm.*" cpu) 4) - (else (error "unknown CPU word size" cpu))))) +(define (triplet-pointer-size triplet) + "Return the size of pointers in bytes for TRIPLET." + (let ((cpu (triplet-cpu triplet))) + (cond ((and (string=? cpu (triplet-cpu %host-type)) + (string=? (triplet-os triplet) (triplet-os %host-type))) + %native-word-size) + + ((string-match "^i[0-9]86$" cpu) 4) + + ;; Although GNU config.guess doesn't yet recognize them, + ;; Debian (ab)uses the OS part to denote the specific ABI + ;; being used: <http://wiki.debian.org/Multiarch/Tuples>. + ;; See <http://www.linux-mips.org/wiki/WhatsWrongWithO32N32N64> + ;; for details on the MIPS ABIs. + ((string-match "^mips64.*-gnuabi64" triplet) 8) ; n64 ABI + ((string-match "^mips64" cpu) 4) ; n32 or o32 + + ((string-match "64$" cpu) 8) + ((string-match "64[lbe][lbe]$" cpu) 8) + ((member cpu '("sparc" "powerpc" "mips" "mipsel")) 4) + ((string-match "^arm.*" cpu) 4) + (else (error "unknown CPU word size" cpu))))) (define (triplet-cpu t) (substring t 0 (string-index t #\-))) |