Hi DJ, Currently the RL78 port does not place zero-initialised data in the .bss section. This is because of the rl78_select_section() function which does not handle bss data. The patch below updates the function to handle that and other types of data so that they end up in the expected sections.
Tested with no regressions on an rl8-elf toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2015-05-13 Nick Clifton <ni...@redhat.com> * config/rl78/rl78.c (rl78_select_section): Select the correct default section based upon the category of the decl. Index: gcc/config/rl78/rl78.c =================================================================== --- gcc/config/rl78/rl78.c (revision 223119) +++ gcc/config/rl78/rl78.c (working copy) @@ -4383,8 +4383,8 @@ static section * rl78_select_section (tree decl, - int reloc ATTRIBUTE_UNUSED, - unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) + int reloc, + unsigned HOST_WIDE_INT align) { int readonly = 1; @@ -4428,7 +4428,30 @@ if (readonly) return readonly_data_section; - return data_section; + switch (categorize_decl_for_section (decl, reloc)) + { + case SECCAT_TEXT: return text_section; + case SECCAT_DATA: return data_section; + case SECCAT_BSS: return bss_section; + case SECCAT_RODATA: return readonly_data_section; + + case SECCAT_RODATA_MERGE_STR: + case SECCAT_RODATA_MERGE_STR_INIT: + case SECCAT_RODATA_MERGE_CONST: + case SECCAT_SRODATA: + case SECCAT_DATA_REL: + case SECCAT_DATA_REL_LOCAL: + case SECCAT_DATA_REL_RO: + case SECCAT_DATA_REL_RO_LOCAL: + case SECCAT_SDATA: + case SECCAT_SBSS: + case SECCAT_TDATA: + case SECCAT_TBSS: + return default_select_section (decl, reloc, align); + + default: + gcc_unreachable (); + } } void