diff options
| -rw-r--r-- | meta/recipes-devtools/cargo/cargo-cross-canadian.inc | 4 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-common.inc | 33 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-cross-canadian-common.inc | 6 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-cross.inc | 6 |
4 files changed, 24 insertions, 25 deletions
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc index 01ba151d0a..d12267db3d 100644 --- a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc +++ b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc | |||
| @@ -31,8 +31,8 @@ PN = "cargo-cross-canadian-${TRANSLATED_TARGET_ARCH}" | |||
| 31 | python do_rust_gen_targets () { | 31 | python do_rust_gen_targets () { |
| 32 | wd = d.getVar('WORKDIR') + '/targets/' | 32 | wd = d.getVar('WORKDIR') + '/targets/' |
| 33 | 33 | ||
| 34 | rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH')) | 34 | rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH')) |
| 35 | rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH')) | 35 | rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH')) |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | do_compile:prepend () { | 38 | do_compile:prepend () { |
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc index d00b380dbd..2edc71e0d3 100644 --- a/meta/recipes-devtools/rust/rust-common.inc +++ b/meta/recipes-devtools/rust/rust-common.inc | |||
| @@ -117,6 +117,7 @@ def llvm_features(d): | |||
| 117 | llvm_features_from_cc_arch(d) + | 117 | llvm_features_from_cc_arch(d) + |
| 118 | llvm_features_from_target_fpu(d)) | 118 | llvm_features_from_target_fpu(d)) |
| 119 | 119 | ||
| 120 | llvm_features[vardepvalue] = "${@llvm_features(d)}" | ||
| 120 | 121 | ||
| 121 | ## arm-unknown-linux-gnueabihf | 122 | ## arm-unknown-linux-gnueabihf |
| 122 | DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" | 123 | DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" |
| @@ -232,12 +233,6 @@ TARGET_POINTER_WIDTH[riscv64] = "64" | |||
| 232 | TARGET_C_INT_WIDTH[riscv64] = "64" | 233 | TARGET_C_INT_WIDTH[riscv64] = "64" |
| 233 | MAX_ATOMIC_WIDTH[riscv64] = "64" | 234 | MAX_ATOMIC_WIDTH[riscv64] = "64" |
| 234 | 235 | ||
| 235 | def sys_for(d, thing): | ||
| 236 | return d.getVar('{}_SYS'.format(thing)) | ||
| 237 | |||
| 238 | def prefix_for(d, thing): | ||
| 239 | return d.getVar('{}_PREFIX'.format(thing)) | ||
| 240 | |||
| 241 | # Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something | 236 | # Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something |
| 242 | # rust's internals won't choke on. | 237 | # rust's internals won't choke on. |
| 243 | def arch_to_rust_target_arch(arch): | 238 | def arch_to_rust_target_arch(arch): |
| @@ -285,20 +280,24 @@ def llvm_cpu(d): | |||
| 285 | except: | 280 | except: |
| 286 | return trans.get(target, "generic") | 281 | return trans.get(target, "generic") |
| 287 | 282 | ||
| 288 | TARGET_LLVM_CPU="${@llvm_cpu(d)}" | 283 | llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}" |
| 289 | TARGET_LLVM_FEATURES = "${@llvm_features(d)}" | ||
| 290 | 284 | ||
| 291 | # class-native implies TARGET=HOST, and TUNE_FEATURES only describes the real | 285 | def rust_gen_target(d, thing, wd, arch): |
| 292 | # (original) target. | ||
| 293 | TARGET_LLVM_FEATURES:class-native = "${@','.join(llvm_features_from_cc_arch(d))}" | ||
| 294 | |||
| 295 | def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""): | ||
| 296 | import json | 286 | import json |
| 297 | sys = sys_for(d, thing) | 287 | sys = d.getVar('{}_SYS'.format(thing)) |
| 298 | prefix = prefix_for(d, thing) | 288 | prefix = d.getVar('{}_PREFIX'.format(thing)) |
| 289 | |||
| 290 | abi = None | ||
| 291 | cpu = "generic" | ||
| 292 | features = "" | ||
| 299 | 293 | ||
| 300 | if thing == "TARGET": | 294 | if thing == "TARGET": |
| 301 | abi = d.getVar('ABIEXTENSION') | 295 | abi = d.getVar('ABIEXTENSION') |
| 296 | cpu = llvm_cpu(d) | ||
| 297 | if bb.data.inherits_class('native', d): | ||
| 298 | features = ','.join(llvm_features_from_cc_arch(d)) | ||
| 299 | else: | ||
| 300 | features = llvm_features(d) or "" | ||
| 302 | # arm and armv7 have different targets in llvm | 301 | # arm and armv7 have different targets in llvm |
| 303 | if arch == "arm" and target_is_armv7(d): | 302 | if arch == "arm" and target_is_armv7(d): |
| 304 | arch = 'armv7' | 303 | arch = 'armv7' |
| @@ -355,14 +354,14 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""): | |||
| 355 | json.dump(tspec, f, indent=4) | 354 | json.dump(tspec, f, indent=4) |
| 356 | 355 | ||
| 357 | # These are accounted for in tmpdir path names so don't need to be in the task sig | 356 | # These are accounted for in tmpdir path names so don't need to be in the task sig |
| 358 | rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS" | 357 | rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS ABIEXTENSION llvm_cpu" |
| 359 | 358 | ||
| 360 | do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES" | 359 | do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES" |
| 361 | 360 | ||
| 362 | python do_rust_gen_targets () { | 361 | python do_rust_gen_targets () { |
| 363 | wd = d.getVar('WORKDIR') + '/targets/' | 362 | wd = d.getVar('WORKDIR') + '/targets/' |
| 364 | build_arch = d.getVar('BUILD_ARCH') | 363 | build_arch = d.getVar('BUILD_ARCH') |
| 365 | rust_gen_target(d, 'BUILD', wd, "", "generic", build_arch) | 364 | rust_gen_target(d, 'BUILD', wd, build_arch) |
| 366 | } | 365 | } |
| 367 | 366 | ||
| 368 | addtask rust_gen_targets after do_patch before do_compile | 367 | addtask rust_gen_targets after do_patch before do_compile |
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc index df4901f1fa..5c0644e92d 100644 --- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc +++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc | |||
| @@ -28,9 +28,9 @@ DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP | |||
| 28 | python do_rust_gen_targets () { | 28 | python do_rust_gen_targets () { |
| 29 | wd = d.getVar('WORKDIR') + '/targets/' | 29 | wd = d.getVar('WORKDIR') + '/targets/' |
| 30 | # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last | 30 | # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last |
| 31 | rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH')) | 31 | rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH')) |
| 32 | rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH')) | 32 | rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH')) |
| 33 | rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH')) | 33 | rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH')) |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | INHIBIT_DEFAULT_RUST_DEPS = "1" | 36 | INHIBIT_DEFAULT_RUST_DEPS = "1" |
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc index 2e47a3aa5f..719857ebbb 100644 --- a/meta/recipes-devtools/rust/rust-cross.inc +++ b/meta/recipes-devtools/rust/rust-cross.inc | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | python do_rust_gen_targets () { | 1 | python do_rust_gen_targets () { |
| 2 | wd = d.getVar('WORKDIR') + '/targets/' | 2 | wd = d.getVar('WORKDIR') + '/targets/' |
| 3 | # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last | 3 | # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last |
| 4 | rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH')) | 4 | rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH')) |
| 5 | rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH')) | 5 | rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH')) |
| 6 | rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH')) | 6 | rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH')) |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | # Otherwise we'll depend on what we provide | 9 | # Otherwise we'll depend on what we provide |
