diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-10-10 21:10:08 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 11:48:45 +0100 |
commit | d6b563710e6cc0857843433d85023d47f9f2037d (patch) | |
tree | c80b1492f65f5d562fb4d76cb07678ac253f1e77 /meta | |
parent | 463bcb876eef2a7faf50916e921b0d8ea0daefa5 (diff) | |
download | poky-d6b563710e6cc0857843433d85023d47f9f2037d.tar.gz |
rust: generate target definitions from (arch, abi), not just arch
This allows to add the missing x32 definition and others in the future.
(From OE-Core rev: 79bd6389585327820dfc1a1d29f60779ef08b2e0)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/rust/rust-common.inc | 57 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust-cross.inc | 4 |
2 files changed, 38 insertions, 23 deletions
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc index 797284316e..7f92602e16 100644 --- a/meta/recipes-devtools/rust/rust-common.inc +++ b/meta/recipes-devtools/rust/rust-common.inc | |||
@@ -119,22 +119,22 @@ def llvm_features(d): | |||
119 | 119 | ||
120 | 120 | ||
121 | ## arm-unknown-linux-gnueabihf | 121 | ## arm-unknown-linux-gnueabihf |
122 | DATA_LAYOUT[arm] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" | 122 | DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" |
123 | LLVM_TARGET[arm] = "${RUST_TARGET_SYS}" | 123 | LLVM_TARGET[arm-eabi] = "${RUST_TARGET_SYS}" |
124 | TARGET_ENDIAN[arm] = "little" | 124 | TARGET_ENDIAN[arm-eabi] = "little" |
125 | TARGET_POINTER_WIDTH[arm] = "32" | 125 | TARGET_POINTER_WIDTH[arm-eabi] = "32" |
126 | TARGET_C_INT_WIDTH[arm] = "32" | 126 | TARGET_C_INT_WIDTH[arm-eabi] = "32" |
127 | MAX_ATOMIC_WIDTH[arm] = "64" | 127 | MAX_ATOMIC_WIDTH[arm-eabi] = "64" |
128 | FEATURES[arm] = "+v6,+vfp2" | 128 | FEATURES[arm-eabi] = "+v6,+vfp2" |
129 | 129 | ||
130 | ## armv7-unknown-linux-gnueabihf | 130 | ## armv7-unknown-linux-gnueabihf |
131 | DATA_LAYOUT[armv7] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" | 131 | DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" |
132 | LLVM_TARGET[armv7] = "${RUST_TARGET_SYS}" | 132 | LLVM_TARGET[armv7-eabi] = "${RUST_TARGET_SYS}" |
133 | TARGET_ENDIAN[armv7] = "little" | 133 | TARGET_ENDIAN[armv7-eabi] = "little" |
134 | TARGET_POINTER_WIDTH[armv7] = "32" | 134 | TARGET_POINTER_WIDTH[armv7-eabi] = "32" |
135 | TARGET_C_INT_WIDTH[armv7] = "32" | 135 | TARGET_C_INT_WIDTH[armv7-eabi] = "32" |
136 | MAX_ATOMIC_WIDTH[armv7] = "64" | 136 | MAX_ATOMIC_WIDTH[armv7-eabi] = "64" |
137 | FEATURES[armv7] = "+v7,+vfp2,+thumb2" | 137 | FEATURES[armv7-eabi] = "+v7,+vfp2,+thumb2" |
138 | 138 | ||
139 | ## aarch64-unknown-linux-{gnu, musl} | 139 | ## aarch64-unknown-linux-{gnu, musl} |
140 | DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | 140 | DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
@@ -152,6 +152,14 @@ TARGET_POINTER_WIDTH[x86_64] = "64" | |||
152 | TARGET_C_INT_WIDTH[x86_64] = "32" | 152 | TARGET_C_INT_WIDTH[x86_64] = "32" |
153 | MAX_ATOMIC_WIDTH[x86_64] = "64" | 153 | MAX_ATOMIC_WIDTH[x86_64] = "64" |
154 | 154 | ||
155 | ## x86_64-unknown-linux-gnux32 | ||
156 | DATA_LAYOUT[x86_64-x32] = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
157 | LLVM_TARGET[x86_64-x32] = "${RUST_TARGET_SYS}" | ||
158 | TARGET_ENDIAN[x86_64-x32] = "little" | ||
159 | TARGET_POINTER_WIDTH[x86_64-x32] = "32" | ||
160 | TARGET_C_INT_WIDTH[x86_64-x32] = "32" | ||
161 | MAX_ATOMIC_WIDTH[x86_64-x32] = "64" | ||
162 | |||
155 | ## i686-unknown-linux-{gnu, musl} | 163 | ## i686-unknown-linux-{gnu, musl} |
156 | DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" | 164 | DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" |
157 | LLVM_TARGET[i686] = "${RUST_TARGET_SYS}" | 165 | LLVM_TARGET[i686] = "${RUST_TARGET_SYS}" |
@@ -292,22 +300,27 @@ TARGET_LLVM_FEATURES = "${@llvm_features(d)}" | |||
292 | # (original) target. | 300 | # (original) target. |
293 | TARGET_LLVM_FEATURES:class-native = "${@','.join(llvm_features_from_cc_arch(d))}" | 301 | TARGET_LLVM_FEATURES:class-native = "${@','.join(llvm_features_from_cc_arch(d))}" |
294 | 302 | ||
295 | def rust_gen_target(d, thing, wd, features, cpu, arch): | 303 | def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""): |
296 | import json | 304 | import json |
297 | sys = sys_for(d, thing) | 305 | sys = sys_for(d, thing) |
298 | prefix = prefix_for(d, thing) | 306 | prefix = prefix_for(d, thing) |
299 | 307 | ||
300 | features = features or d.getVarFlag('FEATURES', arch) or "" | 308 | if abi: |
309 | arch_abi = "{}-{}".format(arch, abi) | ||
310 | else: | ||
311 | arch_abi = arch | ||
312 | |||
313 | features = features or d.getVarFlag('FEATURES', arch_abi) or "" | ||
301 | features = features.strip() | 314 | features = features.strip() |
302 | 315 | ||
303 | # build tspec | 316 | # build tspec |
304 | tspec = {} | 317 | tspec = {} |
305 | tspec['llvm-target'] = d.getVarFlag('LLVM_TARGET', arch) | 318 | tspec['llvm-target'] = d.getVarFlag('LLVM_TARGET', arch_abi) |
306 | tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch) | 319 | tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi) |
307 | tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch)) | 320 | tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi)) |
308 | tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch) | 321 | tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi) |
309 | tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch) | 322 | tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) |
310 | tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch) | 323 | tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) |
311 | tspec['arch'] = arch_to_rust_target_arch(arch) | 324 | tspec['arch'] = arch_to_rust_target_arch(arch) |
312 | tspec['os'] = "linux" | 325 | tspec['os'] = "linux" |
313 | if "musl" in tspec['llvm-target']: | 326 | if "musl" in tspec['llvm-target']: |
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc index bee7c9f12f..42163f7b81 100644 --- a/meta/recipes-devtools/rust/rust-cross.inc +++ b/meta/recipes-devtools/rust/rust-cross.inc | |||
@@ -11,13 +11,15 @@ python do_rust_gen_targets () { | |||
11 | features = "" | 11 | features = "" |
12 | cpu = "generic" | 12 | cpu = "generic" |
13 | arch = d.getVar('{}_ARCH'.format(thing)) | 13 | arch = d.getVar('{}_ARCH'.format(thing)) |
14 | abi = "" | ||
14 | if thing is "TARGET": | 15 | if thing is "TARGET": |
16 | abi = d.getVar('ABIEXTENSION') | ||
15 | # arm and armv7 have different targets in llvm | 17 | # arm and armv7 have different targets in llvm |
16 | if arch == "arm" and target_is_armv7(d): | 18 | if arch == "arm" and target_is_armv7(d): |
17 | arch = 'armv7' | 19 | arch = 'armv7' |
18 | features = d.getVar('TARGET_LLVM_FEATURES') or "" | 20 | features = d.getVar('TARGET_LLVM_FEATURES') or "" |
19 | cpu = d.getVar('TARGET_LLVM_CPU') | 21 | cpu = d.getVar('TARGET_LLVM_CPU') |
20 | rust_gen_target(d, thing, wd, features, cpu, arch) | 22 | rust_gen_target(d, thing, wd, features, cpu, arch, abi) |
21 | } | 23 | } |
22 | 24 | ||
23 | # Otherwise we'll depend on what we provide | 25 | # Otherwise we'll depend on what we provide |