re PR middle-end/47610 (cp-demangle.c:1970:1: error: cplus_demangle_builtin_types causes a section type conflict)

PR middle-end/47610
	* varasm.c (default_section_type_flags): If decl is NULL,
	and name is .data.rel.ro or .data.rel.ro.local, set SECTION_RELRO
	bit.

	* gcc.dg/pr47610.c: New test.

From-SVN: r169855
This commit is contained in:
Jakub Jelinek 2011-02-05 21:35:16 +01:00 committed by Jakub Jelinek
parent 4a9b1f8edc
commit c42c09fc41
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2011-02-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/47610
* varasm.c (default_section_type_flags): If decl is NULL,
and name is .data.rel.ro or .data.rel.ro.local, set SECTION_RELRO
bit.
2011-02-05 Jie Zhang <jie@codesourcery.com>
PR debug/42631

View File

@ -1,3 +1,8 @@
2011-02-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/47610
* gcc.dg/pr47610.c: New test.
2011-02-05 Jie Zhang <jie@codesourcery.com>
PR debug/42631

View File

@ -0,0 +1,8 @@
/* PR middle-end/47610 */
/* { dg-do compile } */
/* { dg-options "-O2 -fpic" { target fpic } } */
struct S { const char *s; };
const struct S s[] = { "s" };
extern void foo (void (*) (void));
static void bar (void) {}
void baz () { foo (bar); }

View File

@ -6060,7 +6060,12 @@ default_section_type_flags (tree decl, const char *name, int reloc)
flags = SECTION_WRITE;
}
else
flags = SECTION_WRITE;
{
flags = SECTION_WRITE;
if (strcmp (name, ".data.rel.ro") == 0
|| strcmp (name, ".data.rel.ro.local") == 0)
flags |= SECTION_RELRO;
}
if (decl && DECL_ONE_ONLY (decl))
flags |= SECTION_LINKONCE;