diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-05 20:35:16 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-05 20:35:16 +0000 |
commit | 77e2262852254963e5590d5712ba02021c61c9ac (patch) | |
tree | 84631ddec5c254cfb91584af8ddd1582c2014cfd /gcc/varasm.c | |
parent | 57f34440cbcb8cd80cb0f26fcbed68934cbaea45 (diff) | |
download | gcc-77e2262852254963e5590d5712ba02021c61c9ac.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169855 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 3a9fbae5901..76675cdeb0d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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; |