avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Avoiding copy_data in config/avr/avr.c avr_file_start


From: Erik Christiansen
Subject: Re: [avr-gcc-list] Avoiding copy_data in config/avr/avr.c avr_file_start()?
Date: Thu, 28 Jul 2005 13:01:47 +1000
User-agent: Mutt/1.5.6+20040722i

On Wed, Jul 27, 2005 at 05:09:19PM -0700, Ben Jackson wrote:
> 
>    __need_copy_data = SIZEOF(.data) ? __do_copy_data : 0;
>    __need_clear_bss = SIZEOF(.bss) ? __do_clear_bss : 0;
> 
> (assuming those were in separate .o's in libgcc) however apparently ld
> will create those undefined symbols but it won't go find them in available
> libraries (I guess it's done with that phase by then...).

Ben

This seems to fall into the class of linker relaxations, but your aim of
achieving it without a modification to avr-ld is laudable and
intruiging.

IIUC, you're seeking to use SIZEOF(.data) to conditioanlly link in a
tiny section with just __do_copy_data in it. (ditto for .bss). 

At first glance, though, it seems difficult to make the above linker
syntax (conditionally) pull in the code. If __do_copy_data and
__do_clear_bss are in separate members of an archive that is named in a
GROUP (foobar) command in the linker script, then ld should "search
repeatedly" until it can satisfy your posted expressions. However, we
still only have a symbol definition: __need_clear_bss = __do_clear_bss.

If SECTIONS includes something like:

.do_bss : { *(.do_bss) } > .init4

does satisfying your posted expressions count as sufficient reference to
__do_clear_bss, in .do_bss, to pull in the latter? (Sorry for not being
intruiged quite enough to stop and try it myself immediately. :-)

Erik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]