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

Mike Frysinger
2010-11-15T12:38:28Z

On Monday, November 15, 2010 06:33:40 Mike Frysinger wrote:
> On Monday, November 15, 2010 05:54:07 Wolfgang Denk wrote:
> > Sebastien Carlier wrote:
> > > I just uploaded the revised patch here:
> > > http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0001-Switch-from-
arch
> > > iv e-libraries-to-partial-linking-v4.patch
> > >
> > > Version 4:
> > > Bring in Linux comment for cmd_link_o_target.
> > > Fix drivers/qe/Makefile to build libqe.o, not qe.o.
> > >
> > > I pulled the latest changes before making the patch and there was no
> > > conflict, but please let me know if you see anything wrong with it.
> >
> > Thanks a lot.
> >
> > I notice that the patch affects the size of the resulting U-Boot
> > images.
> >
> > For example:
> >
> > Configuring for MiniFAP - Board: TQM5200, Options: MINIFAP
> >
> > text data bss dec hex filename
> >
> > 358144 35208 303248 696600 aa118 ./u-boot before
> > 361340 35824 303332 700496 ab050 ./u-boot after
> >
> > -------------------------------
> >
> > Delta: +3896 Bytes
> >
> > For other boards it's only a few hundred bytes, but why do we see
> > such big increase here?
>
> some of this is probably because of missing build system support. there
> are some files which are always compiled when they shouldnt be but in the
> past, this wasnt a problem because they were stuck in an .a and the linker
> wouldnt pull them in since no one requested them.
>
> on my side, i see this with at least these files:
> cmd_pcmcia.c
> file.c
> ldiv.c
> memsize.c
> rpx_pcmcia.c
> tqm8xx_pcmcia.c
>
> although i'm still seeing a few hundred byte increase in my .text/.bss, but
> the symbol map is unchanged ...

some of this is simply due to change in linking order and the implicit padding
in between each symbol for alignment requirements

you can check how much this adds with the attached script:
$ ./align-padding u-boot .text | tail -n1
586
$ ./align-padding old/u-boot .text | tail -n1
490

replace the '$7 == "3"' check with whatever section number you want to check.
in my case, 3 is ".text". i see a 96 byte change in my .text due to this, but
i wouldnt blame this patch for it. and similar changes for
.data/.bss/.rodata.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: align-padding
Type: application/x-shellscript
Size: 389 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101115/9241574f/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101115/9241574f/attachment.pgp