* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
@ 2011-06-23 9:21 Baruch Siach
2011-07-25 6:34 ` Peter Korsgaard
0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-06-23 9:21 UTC (permalink / raw)
To: buildroot
Allow the user to specify additional options for the target LDFLAGS.
I use this to pass the -te500v2 option to the linker, when using the
CodeSourcery toolchain for PowerPC. This chooses the correct CRT for e500 hard
float. Otherwise I get errors like
undefined reference to `_save32gpr_31'
undefined reference to `_rest32gpr_31_x'
at final link time.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
package/Makefile.in | 2 +-
toolchain/toolchain-common.in | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index 2ca8c31..a6cee06 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -81,7 +81,7 @@ ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
endif
-TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
+TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib $(BR2_TARGET_LDFLAGS)
TARGET_CXXFLAGS=$(TARGET_CFLAGS)
TARGET_SYSROOT_OPT=--sysroot=$(STAGING_DIR)
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index f67c30a..8a87493 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -173,3 +173,8 @@ config BR2_TARGET_OPTIMIZATION
help
Optimizations to use when building for the target host.
NOTE: gcc optimization level is defined in build options.
+
+config BR2_TARGET_LDFLAGS
+ string "Target linker options"
+ help
+ Options to pass to the linker when buiding for the target host.
--
1.7.5.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-06-23 9:21 [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options Baruch Siach
@ 2011-07-25 6:34 ` Peter Korsgaard
2011-07-25 7:10 ` Baruch Siach
0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2011-07-25 6:34 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
Hi,
Baruch> Allow the user to specify additional options for the target
Baruch> LDFLAGS. I use this to pass the -te500v2 option to the linker,
Baruch> when using the CodeSourcery toolchain for PowerPC. This chooses
Baruch> the correct CRT for e500 hard float. Otherwise I get errors
Baruch> like
Committed, thanks.
What tree did you create this patch against? package/Makefile.in hasn't
looked like that since April, so I had to apply the patch manually.
Baruch> ---
Baruch> package/Makefile.in | 2 +-
Baruch> toolchain/toolchain-common.in | 5 +++++
Baruch> 2 files changed, 6 insertions(+), 1 deletions(-)
Baruch> diff --git a/package/Makefile.in b/package/Makefile.in
Baruch> index 2ca8c31..a6cee06 100644
Baruch> --- a/package/Makefile.in
Baruch> +++ b/package/Makefile.in
Baruch> @@ -81,7 +81,7 @@ ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
Baruch> TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
Baruch> endif
Baruch> -TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
Baruch> +TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib $(BR2_TARGET_LDFLAGS)
You need to use qstrip as otherwise all the flags will be handled as a
single argument.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 6:34 ` Peter Korsgaard
@ 2011-07-25 7:10 ` Baruch Siach
2011-07-25 7:16 ` Peter Korsgaard
0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-07-25 7:10 UTC (permalink / raw)
To: buildroot
Hi Peter,
On Mon, Jul 25, 2011 at 08:34:53AM +0200, Peter Korsgaard wrote:
> >>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
> Baruch> Allow the user to specify additional options for the target
> Baruch> LDFLAGS. I use this to pass the -te500v2 option to the linker,
> Baruch> when using the CodeSourcery toolchain for PowerPC. This chooses
> Baruch> the correct CRT for e500 hard float. Otherwise I get errors
> Baruch> like
>
> Committed, thanks.
>
> What tree did you create this patch against? package/Makefile.in hasn't
> looked like that since April, so I had to apply the patch manually.
I mistakenly based this patch on version 2010.11.
Actually, since I use an external toolchain, the patch of Matias Garcia
(http://lists.busybox.net/pipermail/buildroot/2011-July/043944.html, not
merged yet) solves the -te500v2 problem for me without this patch, so I've
dropped it locally.
> Baruch> ---
> Baruch> package/Makefile.in | 2 +-
> Baruch> toolchain/toolchain-common.in | 5 +++++
> Baruch> 2 files changed, 6 insertions(+), 1 deletions(-)
>
> Baruch> diff --git a/package/Makefile.in b/package/Makefile.in
> Baruch> index 2ca8c31..a6cee06 100644
> Baruch> --- a/package/Makefile.in
> Baruch> +++ b/package/Makefile.in
> Baruch> @@ -81,7 +81,7 @@ ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
> Baruch> TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
> Baruch> endif
>
> Baruch> -TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
> Baruch> +TARGET_LDFLAGS+=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib $(BR2_TARGET_LDFLAGS)
>
> You need to use qstrip as otherwise all the flags will be handled as a
> single argument.
Ah, something new learnt. Thanks for noticing and fixing, and thanks again for
your great work.
(Back to my cross Poco C++ build attempts)
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 7:10 ` Baruch Siach
@ 2011-07-25 7:16 ` Peter Korsgaard
2011-07-25 7:24 ` Baruch Siach
2011-07-25 21:19 ` Matias Garcia
0 siblings, 2 replies; 9+ messages in thread
From: Peter Korsgaard @ 2011-07-25 7:16 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
>> What tree did you create this patch against? package/Makefile.in hasn't
>> looked like that since April, so I had to apply the patch manually.
Baruch> I mistakenly based this patch on version 2010.11.
Baruch> Actually, since I use an external toolchain, the patch of
Baruch> Matias Garcia
Baruch> (http://lists.busybox.net/pipermail/buildroot/2011-July/043944.html,
Baruch> not merged yet) solves the -te500v2 problem for me without this
Baruch> patch, so I've dropped it locally.
Ok. That patch still needs some work (E.G. it only works with a single
argument).
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 7:16 ` Peter Korsgaard
@ 2011-07-25 7:24 ` Baruch Siach
2011-07-25 7:28 ` Peter Korsgaard
2011-07-25 21:19 ` Matias Garcia
1 sibling, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-07-25 7:24 UTC (permalink / raw)
To: buildroot
Hi Peter,
On Mon, Jul 25, 2011 at 09:16:19AM +0200, Peter Korsgaard wrote:
> >>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
>
> >> What tree did you create this patch against? package/Makefile.in hasn't
> >> looked like that since April, so I had to apply the patch manually.
>
> Baruch> I mistakenly based this patch on version 2010.11.
>
> Baruch> Actually, since I use an external toolchain, the patch of
> Baruch> Matias Garcia
> Baruch> (http://lists.busybox.net/pipermail/buildroot/2011-July/043944.html,
> Baruch> not merged yet) solves the -te500v2 problem for me without this
> Baruch> patch, so I've dropped it locally.
>
> Ok. That patch still needs some work (E.G. it only works with a single
> argument).
I see. Any other issue with that patch?
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 7:24 ` Baruch Siach
@ 2011-07-25 7:28 ` Peter Korsgaard
0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2011-07-25 7:28 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
Hi,
>> Ok. That patch still needs some work (E.G. it only works with a single
>> argument).
Baruch> I see. Any other issue with that patch?
Not really. I think we should cleanup a bit all these options for
setting compiler/linker flags, but that's more of a long term goal.
The plan is to put out 2011.08-rc1 at the end of the week, so I would
like to keep big changes for the next cycle.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 7:16 ` Peter Korsgaard
2011-07-25 7:24 ` Baruch Siach
@ 2011-07-25 21:19 ` Matias Garcia
2011-07-26 13:10 ` Baruch Siach
1 sibling, 1 reply; 9+ messages in thread
From: Matias Garcia @ 2011-07-25 21:19 UTC (permalink / raw)
To: buildroot
On Mon, 2011-07-25 at 09:16 +0200, Peter Korsgaard wrote:
> >>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
>
> >> What tree did you create this patch against? package/Makefile.in hasn't
> >> looked like that since April, so I had to apply the patch manually.
>
> Baruch> I mistakenly based this patch on version 2010.11.
>
> Baruch> Actually, since I use an external toolchain, the patch of
> Baruch> Matias Garcia
> Baruch> (http://lists.busybox.net/pipermail/buildroot/2011-July/043944.html,
> Baruch> not merged yet) solves the -te500v2 problem for me without this
> Baruch> patch, so I've dropped it locally.
>
> Ok. That patch still needs some work (E.G. it only works with a single
> argument).
Ah, that's something I hadn't considered. Thanks for the feedback. I was
assuming one could pass something like "-fee -fi -fo -fum" in the text
block, and this would be passed on to the wrapper.
I won't have time in the next while to work on it. Can you suggest a way
to do it if/when I do? I'm not a make expert by any means.
Cheers,
Matias
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-25 21:19 ` Matias Garcia
@ 2011-07-26 13:10 ` Baruch Siach
2011-07-26 15:00 ` Peter Korsgaard
0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2011-07-26 13:10 UTC (permalink / raw)
To: buildroot
Hi Matias,
On Mon, Jul 25, 2011 at 05:19:00PM -0400, Matias Garcia wrote:
> On Mon, 2011-07-25 at 09:16 +0200, Peter Korsgaard wrote:
> > >>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
> >
> > >> What tree did you create this patch against? package/Makefile.in hasn't
> > >> looked like that since April, so I had to apply the patch manually.
> >
> > Baruch> I mistakenly based this patch on version 2010.11.
> >
> > Baruch> Actually, since I use an external toolchain, the patch of
> > Baruch> Matias Garcia
> > Baruch> (http://lists.busybox.net/pipermail/buildroot/2011-July/043944.html,
> > Baruch> not merged yet) solves the -te500v2 problem for me without this
> > Baruch> patch, so I've dropped it locally.
> >
> > Ok. That patch still needs some work (E.G. it only works with a single
> > argument).
>
> Ah, that's something I hadn't considered. Thanks for the feedback. I was
> assuming one could pass something like "-fee -fi -fo -fum" in the text
> block, and this would be passed on to the wrapper.
Well, this string will be passed to the wrapper, but the whole string will get
stored in the same args[] entry. This means that the compiler sees it as one
long argument, not one argument per word as should be.
A possible solution might be to split this string with strtok() at run-time,
but it looks inefficient, since we have all the information we need at compile
time.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options
2011-07-26 13:10 ` Baruch Siach
@ 2011-07-26 15:00 ` Peter Korsgaard
0 siblings, 0 replies; 9+ messages in thread
From: Peter Korsgaard @ 2011-07-26 15:00 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
>> Ah, that's something I hadn't considered. Thanks for the feedback. I was
>> assuming one could pass something like "-fee -fi -fo -fum" in the text
>> block, and this would be passed on to the wrapper.
Baruch> Well, this string will be passed to the wrapper, but the whole
Baruch> string will get stored in the same args[] entry. This means
Baruch> that the compiler sees it as one long argument, not one
Baruch> argument per word as should be.
Baruch> A possible solution might be to split this string with strtok()
Baruch> at run-time, but it looks inefficient, since we have all the
Baruch> information we need at compile time.
I think it would be simpler to generate an include file containing
"arg1", "arg2", ... "argn"
instead and then simply #include that from ext-toolchain-wrapper.c
instead of passing all these options on the compiler cmdline.
This list could be created with something like:
$(patsubst %,\"%\"$(comma),$(CFLAGS))
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-07-26 15:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 9:21 [Buildroot] [PATCH] toolchain: add user defined target LDFLAGS options Baruch Siach
2011-07-25 6:34 ` Peter Korsgaard
2011-07-25 7:10 ` Baruch Siach
2011-07-25 7:16 ` Peter Korsgaard
2011-07-25 7:24 ` Baruch Siach
2011-07-25 7:28 ` Peter Korsgaard
2011-07-25 21:19 ` Matias Garcia
2011-07-26 13:10 ` Baruch Siach
2011-07-26 15:00 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox