From aaaeaeed3f99ee2e9267da2f2db145fad0642c88 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Fri, 8 Jan 2016 16:16:26 -0500 Subject: [PATCH 1/2] rustlib: libdir may be different between build and host With multilib, we may want to install under lib64 but the rust libraries get published in the build sysroot under the libdir for the build machine which is usually just lib. Support these being different. --- classes/rust-bin.bbclass | 6 +++++- recipes/rust/rustlib.bb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index 8a0f7af..4221fed 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -36,7 +36,11 @@ OVERLAP_DEPS = "${@get_overlap_deps(d)}" # See https://github.com/rust-lang/rust/issues/19680 RUSTC_FLAGS += "-C prefer-dynamic" -rustlib="${libdir}/${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib" +rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib" +# Native sysroot standard library path +rustlib_src="${prefix}/lib/${rustlib_suffix}" +# Host sysroot standard library path +rustlib="${libdir}/${rustlib_suffix}" CRATE_NAME ?= "${@d.getVar('BPN', True).replace('-rs', '').replace('-', '_')}" BINNAME ?= "${BPN}" LIBNAME ?= "lib${CRATE_NAME}-rs" diff --git a/recipes/rust/rustlib.bb b/recipes/rust/rustlib.bb index ae05dfd..9c8beda 100644 --- a/recipes/rust/rustlib.bb +++ b/recipes/rust/rustlib.bb @@ -9,7 +9,7 @@ DEPENDS += "virtual/${TARGET_PREFIX}rust" RUSTLIB_DEP = "" do_install () { - for f in ${STAGING_DIR_NATIVE}/${rustlib}/*.so; do + for f in ${STAGING_DIR_NATIVE}/${rustlib_src}/*.so; do echo Installing $f install -D -m 755 $f ${D}/${rustlib}/$(basename $f) done From 483334f02b3b231854719048a6bd26ebc99e970e Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Fri, 8 Jan 2016 16:17:46 -0500 Subject: [PATCH 2/2] rust: aarch64 support --- classes/rust.bbclass | 2 ++ recipes/rust/rust.inc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 6535131..7b71197 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -33,6 +33,8 @@ def rust_base_triple(d, thing): if arch.startswith("arm"): if os.endswith("gnueabi"): os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) + elif arch.startswith("aarch64"): + os = "linux-gnu" elif arch.startswith("x86_64"): os = "linux-gnu" elif arch.startswith("i586"): diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index 288e2f5..1919136 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -37,6 +37,12 @@ TARGET_POINTER_WIDTH[arm] = "32" FEATURES[arm] = "+v6,+vfp2" PRE_LINK_ARGS[arm] = "-Wl,--as-needed" +DATA_LAYOUT[aarch64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n32:64-S128" +LLVM_TARGET[aarch64] = "aarch64-unknown-linux-gnu" +TARGET_ENDIAN[aarch64] = "little" +TARGET_POINTER_WIDTH[aarch64] = "64" +PRE_LINK_ARGS[aarch64] = "-Wl,--as-needed" + ## x86_64-unknown-linux-gnu DATA_LAYOUT[x86_64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu"