[PATCH] Fix a .data.rel.ro{,.local} section conflict issue (PR middle-end/47610)
Jakub Jelinek
jakub@redhat.com
Sat Feb 5 17:04:00 GMT 2011
Hi!
My recent PR31490 patch caused a regression on ppc and pa at least,
where gcc started complaining about section type conflicts on
.data.rel.ro{,.local} sections.
The problem is if get_section is called both from
default_elf_select_rtx_section where it is called with
.data.rel.ro{,.local} section but NULL decl, and with a decl
that belongs into the same section. default_section_type_flags
would set SECTION_RELRO only if decl was non-NULL.
Fixed by oring in SECTION_RELRO for those two explicit sections too.
Bootstrapped/regtested on x86_64-linux and i686-linux, tested with a cross
on the pa testcase.
Ok for trunk?
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.
--- gcc/varasm.c.jj 2011-02-03 20:09:38.000000000 +0100
+++ gcc/varasm.c 2011-02-05 00:01:59.911796344 +0100
@@ -6060,7 +6060,12 @@ default_section_type_flags (tree decl, c
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;
Jakub
More information about the Gcc-patches
mailing list