[patch] scripts/Makefile.lib

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Oct 29 13:50:15 UTC 2008


> -----Original Message-----
> From: busybox-bounces at busybox.net [mailto:busybox-bounces at busybox.net]
> On Behalf Of Bernhard Reutner-Fischer
> Sent: den 29 oktober 2008 13:13
> To: Peter Kjellerstedt
> Cc: busybox at busybox.net
> Subject: Re: [patch] scripts/Makefile.lib
>
> On Wed, Oct 29, 2008 at 11:36:10AM +0100, Peter Kjellerstedt wrote:
> >> -----Original Message-----
> >> From: busybox-bounces at busybox.net [mailto:busybox-
> bounces at busybox.net]
> >> On Behalf Of Denys Vlasenko
> >> Sent: den 29 oktober 2008 02:03
> >> To: busybox at busybox.net
> >> Subject: Re: [patch] scripts/Makefile.lib
> >>
> >> On Tuesday 28 October 2008 20:58, Cristian Ionescu-Idbohrn wrote:
> >> > Would this patch be acceptable?
> >> >
> >> > Convert from '-Wl,-<option>' (used to give specific gcc link
> options)
> >> > to direct link '-<option>'.
> >> >
> >> > Index: scripts/Makefile.lib
> >> >
> ===================================================================
> >> > --- scripts/Makefile.lib      (revision 22830)
> >> > +++ scripts/Makefile.lib      (working copy)
> >> > @@ -118,7 +118,7 @@
> >> >  cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS)
> $(__cpp_flags)
> >> >
> >> >  # TODO: seems to be a wrong thing to do! LDFLAGS contains gcc's
> flags!
> >> > -ld_flags       = $(LDFLAGS) $(EXTRA_LDFLAGS)
> >> > +ld_flags       = $(filter-out -Wl$(comma)%,$(LDFLAGS)
> $(EXTRA_LDFLAGS))
> >> >
> >> >  # Finds the multi-part object the current object will be linked
> into
> >> >  modname-multi = $(sort $(foreach m,$(multi-used),\
> >>
> >>
> >> What case does it fix?
> >> --
> >> vda
> >
> >It fixes the fact that $(LD_FLAGS) may contain linker directives
> >specified
>
> This would be a misconfiguration which you should fix instead of
> papering over it imo.
>
> >as -Wl,<ld option>, which are intended to be passed through gcc.
> >However, $(ld_flags) is used with ld and it wants its options
> >without the -Wl, prefix. The TODO comment above should at the
> >same time be replaced with something like:
> >
> ># Remove the -Wl, prefix from linker options normally passed through gcc
> >
> >//Peter

Misconfiguration in what way? The trylink script adds linker
options to $(LD_FLAGS) prefixed with -Wl, (which is correct
since $(LD_FLAGS) is intended for gcc). These options are
also needed if you want to call ld directly, and thus the
"convertion" from $(LD_FLAGS) to $(ld_flags) above.

The alternative I guess would be to use gcc instead of ld, but
I do not know if that is feasible as I have not looked into what
ld is currently used for.

//Peter




More information about the busybox mailing list