Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Porcedda <fabio.porcedda@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC v4 08/16] toolchain-external: use the wrapper even for the linker "ld"
Date: Sun, 28 Jun 2015 21:42:42 +0200	[thread overview]
Message-ID: <1435520570-20332-9-git-send-email-fabio.porcedda@gmail.com> (raw)
In-Reply-To: <1435520570-20332-1-git-send-email-fabio.porcedda@gmail.com>

In order to add the per-package staging feature we need to use the
wrappper even for the linker "ld".

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
---
 .../toolchain-external/ext-toolchain-wrapper.c      | 21 +++++++++++++++------
 toolchain/toolchain-external/toolchain-external.mk  |  2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c
index f8695a4..c839377 100644
--- a/toolchain/toolchain-external/ext-toolchain-wrapper.c
+++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c
@@ -39,9 +39,12 @@ static char sysroot[PATH_MAX];
  */
 #define EXCLUSIVE_ARGS	3
 
-static char *predef_args[] = {
+static char *predef_common_args[] = {
 	path,
-	"--sysroot", sysroot,
+	"--sysroot", sysroot
+};
+
+static char *predef_gcc_args[] = {
 #ifdef BR_ABI
 	"-mabi=" BR_ABI,
 #endif
@@ -197,7 +200,8 @@ int main(int argc, char **argv)
 		return 3;
 	}
 
-	cur = args = malloc(sizeof(predef_args) +
+	cur = args = malloc(sizeof(predef_common_args) +
+			    sizeof(predef_gcc_args) +
 			    (sizeof(char *) * (argc + EXCLUSIVE_ARGS)));
 	if (args == NULL) {
 		perror(__FILE__ ": malloc");
@@ -205,10 +209,15 @@ int main(int argc, char **argv)
 	}
 
 	/* start with predefined args */
-	memcpy(cur, predef_args, sizeof(predef_args));
-	cur += sizeof(predef_args) / sizeof(predef_args[0]);
+	memcpy(cur, predef_common_args, sizeof(predef_common_args));
+	cur += sizeof(predef_common_args) / sizeof(predef_common_args[0]);
 
-	cur = add_gcc_args(argc, argv, cur);
+	if (strcmp(path + strlen(path) - 2, "ld") !=  0) {
+		memcpy(cur, predef_gcc_args, sizeof(predef_gcc_args));
+		cur += sizeof(predef_gcc_args) / sizeof(predef_gcc_args[0]);
+
+		cur = add_gcc_args(argc, argv, cur);
+	}
 
 	paranoid_wrapper = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
 	if (paranoid_wrapper && strlen(paranoid_wrapper) > 0)
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 22f8118..75d61a9 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -673,7 +673,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
 		*-ar|*-ranlib|*-nm) \
 			ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
 			;; \
-		*cc|*cc-*|*++|*++-*|*cpp) \
+		*cc|*cc-*|*++|*++-*|*cpp|*ld) \
 			ln -sf ext-toolchain-wrapper $$base; \
 			;; \
 		*gdb|*gdbtui) \
-- 
2.4.3

  parent reply	other threads:[~2015-06-28 19:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28 19:42 [Buildroot] [RFC v4 00/16] Add per-package staging feature Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 01/16] packages: use TARGET_MAKE_ENV to add pps support Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 02/16] packages: for staging stuff use backtick instead of the shell function Fabio Porcedda
2015-07-12 14:39   ` Arnout Vandecappelle
2015-06-28 19:42 ` [Buildroot] [RFC v4 03/16] packages/scons: make avaiable the GCC_SYSROOT environment variable Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 04/16] packages/qt: read spec files from the per-package staging directory Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 05/16] pkg-perl: use TARGET_MAKE_ENV to add pps support Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 06/16] tooclahin-external: add support for GCC_SYSROOT Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 07/16] toolchain-external: move some code in a new function Fabio Porcedda
2015-06-28 19:42 ` Fabio Porcedda [this message]
2015-06-28 19:42 ` [Buildroot] [RFC v4 09/16] infra: add GCC_SYSROOT environment variable to support pps feature Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 10/16] pkg-cmake: " Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 11/16] pkg-python: add GCC_SYSROOT variable to add pps support Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 12/16] pacakge/luarocks: add GCC_SYSROOT environment variable to support pps Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 13/16] package/pkgconf: use GCC_SYSROOT to support pps feature Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 14/16] Makefile: add STAGINGNOPKG_DIR variable Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 15/16] pkg-generic: ADD_TOOLCHAIN_DEPENDENCY is true only for target packages Fabio Porcedda
2015-06-28 19:42 ` [Buildroot] [RFC v4 16/16] infra: add per-package staging feature Fabio Porcedda
2015-07-11 22:56   ` Romain Naour
2015-07-13  9:42     ` Fabio Porcedda
2015-06-28 19:53 ` [Buildroot] [RFC v4 00/16] Add " Fabio Porcedda
2015-06-28 20:34 ` Thomas Petazzoni
2015-06-28 20:46 ` Yann E. MORIN
2015-06-28 20:49   ` Yann E. MORIN
2015-06-28 20:57     ` Thomas Petazzoni
2015-06-28 21:04       ` Yann E. MORIN
2015-06-28 21:00   ` Thomas Petazzoni
2015-06-28 21:25     ` Yann E. MORIN
2015-06-29  8:35       ` Fabio Porcedda
2015-06-29 17:27         ` Yann E. MORIN
2015-06-29  8:38     ` Fabio Porcedda
2015-07-05  8:51 ` Fabio Porcedda
2015-07-05  9:01   ` Thomas Petazzoni
2015-07-05  9:26     ` Fabio Porcedda
2015-10-04 17:21 ` Arnout Vandecappelle
2015-10-04 17:51   ` Bjørn Forsman
2015-10-05 21:13   ` Fabio Porcedda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435520570-20332-9-git-send-email-fabio.porcedda@gmail.com \
    --to=fabio.porcedda@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox