Bug 18145

Summary: Do not emit __do_copy_data or __do_clear_bss if .data or .bss is empty.
Product: gcc Reporter: Eric Weddington <eric.weddington>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: enhancement CC: abnikant.singh, berndtrog, gcc-bugs, gjl, schlie
Priority: P2 Keywords: missed-optimization
Version: 3.4.2   
Target Milestone: 4.7.0   
Host: Target: avr-*-*
Build: Known to work: 4.7.0
Known to fail: Last reconfirmed: 2006-03-05 16:13:40
Attachments: attached patch solves this problem

Description Eric Weddington 2004-10-25 16:36:32 UTC
See FIXME in avr.c, function avr_file_start.
Comment 1 Andrew Pinski 2004-10-25 17:03:19 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-02-28 04:14:41 UTC
*** Bug 20243 has been marked as a duplicate of this bug. ***
Comment 3 abnikant 2010-09-14 08:17:05 UTC
Created attachment 21788 [details]
attached patch solves this problem
Comment 4 Georg-Johann Lay 2011-04-20 13:38:09 UTC
Author: gjl
Date: Wed Apr 20 13:38:05 2011
New Revision: 172769

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172769
Log:
	PR target/18145

	* config/avr/avr.h (TARGET_ASM_INIT_SECTIONS): Delete.
	(ASM_OUTPUT_COMMON, ASM_OUTPUT_LOCAL): Delete.
	(ASM_OUTPUT_ALIGNED_DECL_COMMON): Define.
	(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Define.
	(TARGET_ASM_NAMED_SECTION): Change to avr_asm_named_section.

	* config/avr/avr-protos.h (avr_asm_output_aligned_common):
	New prototype.

	* config/avr/avr.c (TARGET_ASM_INIT_SECTIONS): Define.
	(avr_asm_named_section,	avr_asm_output_aligned_common,
	avr_output_data_section_asm_op,	avr_output_bss_section_asm_op):
	New functions to update...
	(avr_need_clear_bss_p, avr_need_copy_data_p): ...these new variables.
	(avr_asm_init_sections): Overwrite section callbacks for
	data_section, bss_section.
	(avr_file_start): Move output of __do_copy_data, __do_clear_bss
	from here to...
	(avr_file_end): ...here.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr-protos.h
    trunk/gcc/config/avr/avr.c
    trunk/gcc/config/avr/avr.h
Comment 5 Georg-Johann Lay 2011-04-20 13:46:42 UTC
Closed resolved+fixed in 4.7.0
Comment 6 Georg-Johann Lay 2012-02-22 14:14:03 UTC
Author: gjl
Date: Wed Feb 22 14:13:48 2012
New Revision: 184481

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184481
Log:
	PR target/18145
	* config/avr/avr.c (avr_asm_output_aligned_decl_common): Skip
	setting avr_need_clear_bss_p for __gnu_lto* symbols.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.c