public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] rust-cross-canadian: Fix for the linker issues caused by using the shell
@ 2022-09-04 18:09 Sundeep KOKKONDA
  2022-09-04 18:12 ` Sundeep KOKKONDA
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sundeep KOKKONDA @ 2022-09-04 18:09 UTC (permalink / raw)
  To: openembedded-core
  Cc: rwmacleod, umesh.kalappa0, pgowda.cve, shivams, Sundeep KOKKONDA

[Yocto #14892]
This is a fix for YOCTO #14878 patch. When sheband is more than 128 characters the default shell /bin/sh is used to execute the linker instead of SDK shell, which causes problems with LD_LIBRARY_PATH.
With this patch shell usage is avoided.

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com>
---
 .../rust/files/target-rust-ccld.c             | 39 +++++++++++++++++++
 .../rust/rust-cross-canadian.inc              | 11 +++---
 2 files changed, 44 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-devtools/rust/files/target-rust-ccld.c

diff --git a/meta/recipes-devtools/rust/files/target-rust-ccld.c b/meta/recipes-devtools/rust/files/target-rust-ccld.c
new file mode 100644
index 0000000000..13f06b38f8
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/target-rust-ccld.c
@@ -0,0 +1,39 @@
+/*
+*
+* Copyright (C) 2022      Wind River Systems
+*
+* SPDX-License-Identifier: GPL-2.0-only
+*
+*/
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main (int argc, char *argv[])
+{
+        int i=0;
+        char cc[1024];
+        char *cmd[1024];
+        char *ccargs[2][1024];
+
+        strcpy(cc,getenv("LD"));
+        char * pch;
+        pch = strtok (cc," ");
+        while (pch != NULL)
+        {
+                strcpy(ccargs+i,pch);
+                printf ("%s\n",ccargs+i);
+                pch = strtok (NULL, " ");
+                i++;
+        }
+
+        strcpy(cmd,ccargs+0);
+
+        unsetenv("LD_LIBRARY_PATH");
+        execv(cmd,argv);
+
+return 0;
+}
+
+
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 7bf75a4712..375c435bff 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -7,16 +7,15 @@ LICENSE = "MIT"
 
 MODIFYTOS = "0"
 
+DEPENDS += "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+SRC_URI += "file://target-rust-ccld.c"
+
 # Need to use our SDK's sh here, see #14878
 create_sdk_wrapper () {
         file="$1"
         shift
-
-        cat <<- EOF > "${file}"
-		#!${base_prefix}/bin/sh
-		\$$1 \$@
-		EOF
-
+	${CC} ${WORKDIR}/target-rust-ccld.c -o "${file}"
         chmod +x "$file"
 }
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-06 12:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-04 18:09 [PATCH] rust-cross-canadian: Fix for the linker issues caused by using the shell Sundeep KOKKONDA
2022-09-04 18:12 ` Sundeep KOKKONDA
2022-09-04 21:34 ` [OE-core] " Richard Purdie
     [not found] ` <1711C5DF821D6301.14041@lists.openembedded.org>
2022-09-04 22:01   ` Richard Purdie
2022-09-05  7:12     ` Sundeep KOKKONDA
2022-09-05 11:53       ` [OE-core] " Richard Purdie
2022-09-06 12:21         ` Randy MacLeod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox