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

Mike Frysinger vapier at gentoo.org
Sat Nov 20 01:07:58 CET 2010


On Friday, November 19, 2010 03:03:54 Wolfgang Denk wrote:
> Albert ARIBAUD wrote:
> > Most probably 2); mentioning a file in the linker script either with or
> > without mentioning it on the command line has certainly been done for
> > some time, so I doubt the feature is new; and certainly the doc is about
> > files, not symbols in different files.
> 
> There seems to be a (here significant) difference between object files
> on the command line and libraries (which appear to be handled like
> a mere collection of object files).

the difference is that the linker wont bother looking at the duplicated 
objects in the archives.  from the linker's perspective though, we now have to 
completely independent objects.  the combined one specified on the command 
line and the split up ones in the linker script.

one possible way to fix boards is to stop specifying sub-objects in the linker 
script and only specify the combined ones.  so in board/tqc/tqm8xx/u-boot.lds, 
drop the split objects like lib/zlib.o in favor of the combined one like 
lib/libgeneric.o.  this might not work for everyone since the combined object 
sizes can be a bit large.  if everyone was using -ffunction-sections/-fdata-
sections 

this however wont work for common/env_embedded.o since it is merged 
common/libcommon.o.  so to fix that, we'll need to not merge env_embedded.o 
into libcommon.o.  like in the patch below.
-mike

diff --git a/common/Makefile b/common/Makefile
index e0db382..d38aa7b 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -52,10 +52,10 @@ COBJS-y += cmd_version.o
 COBJS-y += env_common.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
+XOBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
+XOBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
+XOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
+XOBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
@@ -174,7 +174,7 @@ OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS))
 
 CPPFLAGS += -I..
 
-all:	$(LIB) $(AOBJS)
+all:	$(LIB) $(AOBJS) $(XOBJS-y)
 
 $(LIB): $(obj).depend $(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
-------------- 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/20101119/95fb579c/attachment.pgp 


More information about the U-Boot mailing list