[U-Boot] [PATCH v3] Switch from archive libraries to partial linking

Sebastien Carlier sebastien.carlier at gmail.com
Wed Nov 10 09:07:08 CET 2010


Dear Mike,

On 2010-11-10 01:57:30, Mike Frysinger wrote:
> 
> On Monday, November 08, 2010 17:04:32 Sebastien Carlier wrote:
> > This commit changes all Makefiles to use partial linking (ld -r) instead of
> > creating library archives, which forces all symbols to participate in
> > linking, allowing non-weak symbols to override weak symbols as intended. 
> > This approach is also used by Linux, from which the gmake function
> > cmd_link_o_target (added at the end of config.mk and used in all
> > Makefiles) is inspired.
> 
> wish we could integrate this into one place already.  all these Makefile's 
> duplicating targets sucks a lot.  but guess that could be a future change.

It would be nice to have a single rule for all libraries, but I see no
reason to do it all at once (and at the same time as fixing an separate
issue).  Some Makefile's do things a little differently from others and
each would best be handled by their respective maintainer.

> the config.mk looks weird:
> +cmd_link_o_target = $(if $(strip $1),\
> +                      $(LD) -r -o $@ $1 ,\
> +                      rm -f $@; $(AR) rcs $@ )
> 
> why do you need the rm/ar ?

The ar part is needed when there are no objets to link, as ld cannot
create an empty object out of nothing.  The rm part is to make sure that
the target is not a leftover object from a previous build (ar would
complain).

> these look like useless whitespace changes.  a lot of the LIB= changes have 
> similar useless changes.  looks like your sed needs a little more smarts to 
> retain whitespace:
> 	-e '/^LIB/s:[.]a$:.o:'

Good suggestion, done in v3:

	http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0001-Switch-from-archive-libraries-to-partial-linking-v3.patch

Regards,

-- 
Sébastien


More information about the U-Boot mailing list