From e893f6f38e3842a0d4e74be5835b4506ba6bb3de Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 1 Apr 2009 01:26:39 -0400 Subject: [PATCH] varasm.c (default_function_rodata_section): Don't assume anything about where the first '.' in the section name is. * varasm.c (default_function_rodata_section): Don't assume anything about where the first '.' in the section name is. From-SVN: r145388 --- gcc/ChangeLog | 5 +++++ gcc/varasm.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f71898..67439f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-01 DJ Delorie + + * varasm.c (default_function_rodata_section): Don't assume + anything about where the first '.' in the section name is. + 2009-04-01 Alan Modra * config/rs6000/rs6000.c (rs6000_emit_stack_reset): Delete redundant diff --git a/gcc/varasm.c b/gcc/varasm.c index 9eefb02..c706a86 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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. */ -- 2.7.4