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

Sebastien Carlier
2010-11-15T12:13:03Z

On 2010-11-15 11:54:07, Wolfgang Denk wrote:
>
> 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?

In this case, these libraries contribute 3260 bytes in unused
definitions:

- fs/fat/libfat.a: (1712 bytes)
file.o:
00000000 00000004 d current_filesystem
00000004 00000200 D file_cwd
00000000 00000018 d filesystems
00000250 00000244 T file_cd
000001d0 00000080 T file_detectfs
00000000 00000048 T file_getfsname
0000011c 000000b4 T file_ls
00000048 000000d4 T file_read

- lib/libfdt/libfdt.a (1440 bytes)
fdt_sw.o:
00000000 0000006c T fdt_add_reservemap_entry
0000028c 000000dc T fdt_begin_node
00000504 0000009c T fdt_create
000000b4 00000078 T fdt_end_node
0000012c 00000160 T fdt_finish
0000006c 00000048 T fdt_finish_reservemap
00000368 0000019c T fdt_property

- drivers/pci/libpci.a: (108 bytes)
pci_indirect.o:
000001dc 0000006c T pci_setup_indirect

In each case, a whole object file contains exactly the unused
definitions, and could be excluded in the respective Makefile.

Re. my previous comment -- in other places objects get large when header
files define a lot of static inline functions, but these ('t' type)
definitions get squashed together during linking and do not add up. If
however a large static inline function is defined but never used, it
will increase final binary size.

--
Sebastien