summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2022-07-10 13:43:00 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-23 12:10:32 +0100
commit3006c37706d73b49f487fb45984620e22d66ed92 (patch)
treefa36084ee8ccd37b422522850d1db724abe5048b
parente1c4953f5587621d4911416c2e9350ad0c27b296 (diff)
downloadopenembedded-core-contrib-3006c37706d73b49f487fb45984620e22d66ed92.tar.gz
cargo-cross-canadian: Use SDK's flags during target linking
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--meta/recipes-devtools/cargo/cargo-cross-canadian.inc20
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
index 7fc22a4128..01ba151d0a 100644
--- a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
+++ b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
@@ -39,6 +39,18 @@ do_compile:prepend () {
PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
}
+create_sdk_wrapper () {
+ file="$1"
+ shift
+
+ cat <<- EOF > "${file}"
+ #!/bin/sh
+ \$$1 \$@
+ EOF
+
+ chmod +x "$file"
+}
+
do_install () {
SYS_BINDIR=$(dirname ${D}${bindir})
install -d "${SYS_BINDIR}"
@@ -47,6 +59,9 @@ do_install () {
chrpath -r "\$ORIGIN/../lib" ${i}
done
+ # Uses SDK's CC as linker so linked binaries works out of box.
+ create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld" "CC"
+
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
mkdir "${ENV_SETUP_DIR}"
ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
@@ -58,7 +73,10 @@ do_install () {
touch "\$CARGO_HOME/config"
echo "[build]" >> "\$CARGO_HOME/config"
echo 'target = "'${TARGET_SYS}'"' >> "\$CARGO_HOME/config"
- fi
+ echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
+ echo '[target.'${TARGET_SYS}']' >> "\$CARGO_HOME/config"
+ echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config"
+ fi
# Keep the below off as long as HTTP/2 is disabled.
export CARGO_HTTP_MULTIPLEXING=false