aboutsummaryrefslogtreecommitdiffstats
path: root/main/guile/0003-Recognize-more-ARM-targets.patch
blob: 59fc857f3cc0743586af079af54dbed46e180764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From ff888821b2bd221ed74ce9bef8d28d94327450d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Fri, 4 Jul 2014 17:26:41 +0200
Subject: Recognize more ARM targets.

Suggested by Dale P. Smith.

* module/system/base/target.scm (cpu-endianness): Add cases for
  "arm.*eb", "^aarch64.*be", and "aarch64".  Change "arm" case to
  "arm.*".
  (triplet-pointer-size): Allow underscore as in 'aarch64_be'.
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")["armeb-unknown-linux-gnu",
  "aarch64-linux-gnu", "aarch64_be-linux-gnu"]: New tests.

Origin: upstream, commit: ffd3e55cfd12a3559621e3130d613d319243512d
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758463
Added-by: Rob Browning <rlb@defaultvalue.org>
---
 module/system/base/target.scm         | 10 +++++++++-
 test-suite/tests/asm-to-bytecode.test |  9 +++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/module/system/base/target.scm b/module/system/base/target.scm
index c74ae67..9d65184 100644
--- a/module/system/base/target.scm
+++ b/module/system/base/target.scm
@@ -72,6 +72,14 @@
              (endianness big))
             ((string-match "^arm.*el" cpu)
              (endianness little))
+            ((string-match "^arm.*eb" cpu)
+             (endianness big))
+            ((string-prefix? "arm" cpu)          ;ARMs are LE by default
+             (endianness little))
+            ((string-match "^aarch64.*be" cpu)
+             (endianness big))
+            ((string=? "aarch64" cpu)
+             (endianness little))
             (else
              (error "unknown CPU endianness" cpu)))))
 
@@ -95,7 +103,7 @@
           ((string-match "^x86_64-.*-gnux32" triplet) 4)  ; x32
 
           ((string-match "64$" cpu) 8)
-          ((string-match "64[lbe][lbe]$" 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)))))
diff --git a/test-suite/tests/asm-to-bytecode.test b/test-suite/tests/asm-to-bytecode.test
index 6d2f20e..937e990 100644
--- a/test-suite/tests/asm-to-bytecode.test
+++ b/test-suite/tests/asm-to-bytecode.test
@@ -205,6 +205,15 @@
   (test-target "x86_64-unknown-linux-gnux32"      ; x32 ABI (Debian tuplet)
                (endianness little) 4)
 
+  (test-target "arm-unknown-linux-androideabi"
+               (endianness little) 4)
+  (test-target "armeb-unknown-linux-gnu"
+               (endianness big) 4)
+  (test-target "aarch64-linux-gnu"
+               (endianness little) 8)
+  (test-target "aarch64_be-linux-gnu"
+               (endianness big) 8)
+
   (pass-if-exception "unknown target"
     exception:miscellaneous-error
     (call-with-values (lambda ()