On Wed, Dec 28, 2011 at 12:34:25PM -0800, Richard Henderson wrote:
> On 12/28/2011 09:39 AM, Michael Meissner wrote:
> >       && in_section != text_section
> > -     && !unlikely_text_section_p (in_section)
> > +     && (in_section && (in_section->common.flags & SECTION_CODE)) == 0
> 
> You should be able to delete the text_section test as well,
> and in_section should *never* be null, when emitting data.
> 
> Otherwise this looks much better to me.

In talking to David, I convinced myself that initialized pointers should never
be in the text section (switch statements use relative pointers, not absolute
addresses currently), so I committed this patch on top of the previous one:

2011-12-29  Michael Meissner  <meiss...@linux.vnet.ibm.com>

        PR target/51623
        * config/rs6000/rs6000.c (rs6000_assemble_integer): Delete check
        for an initialized pointer being in a text section with
        -mrelocatable, since it should never happen.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 182730)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -15456,12 +15456,13 @@ rs6000_assemble_integer (rtx x, unsigned
     {
       static int recurse = 0;
 
-      /* For -mrelocatable, we mark all addresses that need to be fixed up
-        in the .fixup section.  */
+      /* For -mrelocatable, we mark all addresses that need to be fixed up in
+        the .fixup section.  Since the TOC section is already relocated, we
+        don't need to mark it here.  We used to skip the text section, but it
+        should never be valid for relocated addresses to be placed in the text
+        section.  */
       if (TARGET_RELOCATABLE
          && in_section != toc_section
-         && in_section != text_section
-         && (in_section && (in_section->common.flags & SECTION_CODE)) == 0
          && !recurse
          && GET_CODE (x) != CONST_INT
          && GET_CODE (x) != CONST_DOUBLE


-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com     fax +1 (978) 399-6899

Reply via email to