summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-02-27 20:36:52 +0100
committerLudovic Courtès <ludo@gnu.org>2013-02-27 20:40:08 +0100
commit9130ec74cf55a2531a364ef16b6608489b583f16 (patch)
tree5efddb36c46c533d1c417ab12a101a8ed52cd6d9
parentcc2948aa3189b7bd29c23e7a93ccb1217a1b4eff (diff)
downloadguile-9130ec74cf55a2531a364ef16b6608489b583f16.tar.gz
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.
-rw-r--r--module/system/base/target.scm39
-rw-r--r--test-suite/tests/asm-to-bytecode.test2
2 files changed, 25 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 #\-)))
diff --git a/test-suite/tests/asm-to-bytecode.test b/test-suite/tests/asm-to-bytecode.test
index 41707b26a..6b1449d6e 100644
--- a/test-suite/tests/asm-to-bytecode.test
+++ b/test-suite/tests/asm-to-bytecode.test
@@ -196,6 +196,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)
(pass-if-exception "unknown target"
exception:miscellaneous-error