public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: RL78: Place zero-initialised data into the .bss section
@ 2015-05-13 14:16 Nick Clifton
  2015-05-13 18:04 ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2015-05-13 14:16 UTC (permalink / raw)
  To: dj; +Cc: gcc-patches

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  <nickc@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: RL78: Place zero-initialised data into the .bss section
  2015-05-13 14:16 RFA: RL78: Place zero-initialised data into the .bss section Nick Clifton
@ 2015-05-13 18:04 ` DJ Delorie
  2015-05-14  8:44   ` Nicholas Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2015-05-13 18:04 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gcc-patches


>   OK to apply ?

Ok but..

> +    case SECCAT_TBSS:
> +      return default_select_section (decl, reloc, align);
> +
> +    default:
> +      gcc_unreachable ();

Would it be better to just "default:" everything to
default_select_section, instead of enumerating everything we know
about today?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFA: RL78: Place zero-initialised data into the .bss section
  2015-05-13 18:04 ` DJ Delorie
@ 2015-05-14  8:44   ` Nicholas Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nicholas Clifton @ 2015-05-14  8:44 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc-patches

Hi DJ,

> Ok but..
>
>> +    case SECCAT_TBSS:
>> +      return default_select_section (decl, reloc, align);
>> +
>> +    default:
>> +      gcc_unreachable ();
>
> Would it be better to just "default:" everything to
> default_select_section, instead of enumerating everything we know
> about today?

Yes it would. :-}  I have committed the patch with that change applied.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-14  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13 14:16 RFA: RL78: Place zero-initialised data into the .bss section Nick Clifton
2015-05-13 18:04 ` DJ Delorie
2015-05-14  8:44   ` Nicholas Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).