]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
varasm.c (default_function_rodata_section): Don't assume anything about where the...
authorDJ Delorie <dj@redhat.com>
Wed, 1 Apr 2009 05:26:39 +0000 (01:26 -0400)
committerDJ Delorie <dj@gcc.gnu.org>
Wed, 1 Apr 2009 05:26:39 +0000 (01:26 -0400)
* varasm.c (default_function_rodata_section): Don't assume
anything about where the first '.' in the section name is.

From-SVN: r145388

gcc/ChangeLog
gcc/varasm.c

index 4f71898978c7dd3e4002cb9929c747fae5dc930b..67439f6e7a3abf3538b661f4c62e72f8ded546d8 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-01  DJ Delorie  <dj@redhat.com>
+
+       * varasm.c (default_function_rodata_section): Don't assume
+       anything about where the first '.' in the section name is.
+
 2009-04-01  Alan Modra  <amodra@bigpond.net.au>
 
        * config/rs6000/rs6000.c (rs6000_emit_stack_reset): Delete redundant
index 9eefb02d8d9b013143bc4144daf630a49d33ed27..c706a8673a609f3c918d753718b057c160c67ab8 100644 (file)
@@ -869,11 +869,18 @@ default_function_rodata_section (tree decl)
 
       if (DECL_ONE_ONLY (decl) && HAVE_COMDAT_GROUP)
         {
-         size_t len = strlen (name) + 3;
-         char* rname = (char *) alloca (len);
+         char *dot;
+         size_t len;
+         char* rname;
+
+         dot = strchr (name + 1, '.');
+         if (!dot)
+           dot = name;
+         len = strlen (dot) + 8;
+         rname = (char *) alloca (len);
 
          strcpy (rname, ".rodata");
-         strcat (rname, name + 5);
+         strcat (rname, dot);
          return get_section (rname, SECTION_LINKONCE, decl);
        }
       /* For .gnu.linkonce.t.foo we want to use .gnu.linkonce.r.foo.  */