From bfb747de9694c288f48d74795deb0aca2405e89c 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-devtools/rust/rustlib.bb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index a9195bf..743fae8 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -34,7 +34,11 @@ OVERLAP_DEPS = "${@get_overlap_deps(d)}" # See https://github.com/rust-lang/rust/issues/19680 RUSTC_FLAGS += "-C prefer-dynamic" -rustlib="${libdir}/${TUNE_PKGARCH}${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}" diff --git a/recipes-devtools/rust/rustlib.bb b/recipes-devtools/rust/rustlib.bb index ae05dfd..9c8beda 100644 --- a/recipes-devtools/rust/rustlib.bb +++ b/recipes-devtools/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 d5c83f28bf22610932b64e4eb6b27097ec34980b 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-devtools/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-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 2e2efc7..c38657e 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -36,6 +36,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"