public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: dj@redhat.com
Cc: gcc-patches@gcc.gnu.org
Subject: RFA: RL78: Place zero-initialised data into the .bss section
Date: Wed, 13 May 2015 14:16:00 -0000	[thread overview]
Message-ID: <87r3qkin2v.fsf@redhat.com> (raw)

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

             reply	other threads:[~2015-05-13 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 14:16 Nick Clifton [this message]
2015-05-13 18:04 ` DJ Delorie
2015-05-14  8:44   ` Nicholas Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3qkin2v.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).