[Patch,AVR]: PR18145: do_copy_data & do_clear_bss only if needed

Georg-Johann Lay avr@gjlay.de
Mon Apr 18 17:52:00 GMT 2011


Georg-Johann Lay schrieb:
> This is a port of an old patch of mine that got integrated in some
> avr-gcc distributions.
> 
> Linking against __do_copy_data resp. __do_clear_bss is only needed if
> there is actually stuff in .[ro]data resp. .bss. This saves some space
> on tiny targets.
> 
> Regression-tested for C
> 
> Johann
> 
> 2011-04-18  Georg-Johann Lay  <avr@gjlay.de>
> 
> 	PR target/18145
> 
> 	* config/avr/avr.h (TARGET_ASM_INIT_SECTIONS): Move to
> 	config/avr/avr.c
> 	(TARGET_ASM_NAMED_SECTION): Change to avr_asm_named_section.
> 	(ASM_OUTPUT_COMMON): Forward to avr_asm_output_common.
> 	(ASM_OUTPUT_LOCAL): Forward to avr_asm_output_local.
> 
> 	* config/avr/avr-protos.h (avr_asm_output_common,
> 	avr_asm_output_local): New prototypes.
> 
> 	* config/avr/avr.c .
> 	(avr_asm_named_section, avr_asm_output_local,
> 	avr_asm_output_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): ...thise new variables.
> 	(TARGET_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.

Fixed ChangeLog


	PR target/18145

	* config/avr/avr.h (TARGET_ASM_INIT_SECTIONS): Delete.
	(TARGET_ASM_NAMED_SECTION): Change to avr_asm_named_section.
	(ASM_OUTPUT_COMMON): Forward to avr_asm_output_common.
	(ASM_OUTPUT_LOCAL): Forward to avr_asm_output_local.

	* config/avr/avr-protos.h (avr_asm_output_common,
	avr_asm_output_local): New prototypes.

	* config/avr/avr.c (avr_asm_named_section, avr_asm_output_local,
	avr_asm_output_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): ...thise new variables.
	(TARGET_ASM_INIT_SECTIONS): Define.
	(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.



More information about the Gcc-patches mailing list