[U-Boot] [PATCH v3] Switch from archive libraries to partial linking
Mike Frysinger
vapier at gentoo.org
Sat Nov 20 10:19:13 CET 2010
On Saturday, November 20, 2010 03:38:44 Wolfgang Denk wrote:
> Mike Frysinger wrote:
> > 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
>
> It doesn't work as we cannot fine-adjust the size of the combined
> objects as it's needed for at least coarse adjustment to the available
> flash sector sizes.
>
> > sizes can be a bit large. if everyone was using
> > -ffunction-sections/-fdata- sections
>
> ? Could you please complete that sentence?
if everyone used these options, then the linker script would get fine grained
control as people could still specify the combined object, but only pull in
specific sections. so the linker script could do in the leading space:
lib/libgeneric.o (.text.crc32 .text.gunzip .text........)
and then in the normal space after the env, do:
lib/libgeneric.o (.text*)
since the linker has already placed the specific sections earlier, the glob
wont pull them in again.
while these options normally imply the end goal of --gc-sections, using that
flag isnt a requirement. as long as the linker scripts specify things like
".text*" instead of just ".text", then they should work fine. and people dont
have to worry about the linker discarding unreferenced sections (such as reset
vectors or whatever). at least not today ... this really should get fixed
across the board.
> > 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.
> >
> > 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
>
> Is this not too much? We have embedded environment only in the case
> of NOR flash, so the extra handling should only be done for
> CONFIG_ENV_IS_EMBEDDED ?
dont really know what you're referring to ... this patch works on my Blackfin
boards. however, it doesnt really matter, as another option would be to
simply stick the env into its own sections. two ways to accomplish this:
(1) if we use -ffunction-sections/-fdata-sections for everyone and we punt the
__PPCENV__ and __PPCTEXT__ hacks, in the linker script, you could do:
common/libcommon.o (.data.environment .data.redundand_environment
.data.env_size)
(2) or tweak/extend the __PPCENV__ and __PPCTEXT__ hacks to manually place the
vars into more specific sections rather than just ".text". then the linker
script would do something like:
common/libcommon.o (.text.environment .text.redundand_environment
.text.env_size)
obviously i'd prefer (1) since the gcc attribute usage in env_embedded.c makes
me want to barf.
-mike
-------------- 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/20101120/9dc2234d/attachment.pgp
More information about the U-Boot
mailing list