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

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

[avr-gcc-list] Avoiding copy_data in config/avr/avr.c avr_file_start()?


From: Ben Jackson
Subject: [avr-gcc-list] Avoiding copy_data in config/avr/avr.c avr_file_start()?
Date: Wed, 27 Jul 2005 17:09:19 -0700
User-agent: Mutt/1.5.6i

I got the impression from libgcc.S that copy_data wouldn't exist if
it wasn't needed, but I finally found in avr_file_start:

  /* FIXME: output these only if there is anything in the .data / .bss
     sections - some code size could be saved by not linking in the
     initialization code from libgcc if one or both sections are empty.  */
  fputs ("\t.global __do_copy_data\n", asm_out_file);
  fputs ("\t.global __do_clear_bss\n", asm_out_file);

I don't know gcc internals, so is this just not visible from
avr_file_start, or just not yet done?  If someone gives me a hint I'll
look into it.

It seems intuitive that only the linker would know if these were needed.
The linker script can see SIZEOF(.data) but I never figured out how to
do any useful conditionals in linker scripts.  It seems like this might
work:

   __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 Jackson
<address@hidden>
http://www.ben.com/




reply via email to

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