summaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2012-03-15 16:32:21 +0000
committerIan Lance Taylor <ian@airs.com>2012-03-15 16:32:21 +0000
commit374f7e2729cd76d6f503f7f40ec585f5a7ae13be (patch)
treed2e0c0a69874f87ace6eb0263af3aebd7316bebf /gold/layout.cc
parent9facf3e9b8df0e016ef70d66617378788141f898 (diff)
downloadbinutils-redhat-374f7e2729cd76d6f503f7f40ec585f5a7ae13be.tar.gz
PR gold/13850
* layout.cc (Layout::make_output_section): Correctly mark SHT_INIT_ARRAY, et. al., as relro.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index a4ef31ac5c..c12037671f 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1379,25 +1379,27 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type,
bool is_relro_local = false;
if (!this->script_options_->saw_sections_clause()
&& parameters->options().relro()
- && type == elfcpp::SHT_PROGBITS
&& (flags & elfcpp::SHF_ALLOC) != 0
&& (flags & elfcpp::SHF_WRITE) != 0)
{
- if (strcmp(name, ".data.rel.ro") == 0)
- is_relro = true;
- else if (strcmp(name, ".data.rel.ro.local") == 0)
+ if (type == elfcpp::SHT_PROGBITS)
{
- is_relro = true;
- is_relro_local = true;
+ if (strcmp(name, ".data.rel.ro") == 0)
+ is_relro = true;
+ else if (strcmp(name, ".data.rel.ro.local") == 0)
+ {
+ is_relro = true;
+ is_relro_local = true;
+ }
+ else if (strcmp(name, ".ctors") == 0
+ || strcmp(name, ".dtors") == 0
+ || strcmp(name, ".jcr") == 0)
+ is_relro = true;
}
else if (type == elfcpp::SHT_INIT_ARRAY
|| type == elfcpp::SHT_FINI_ARRAY
|| type == elfcpp::SHT_PREINIT_ARRAY)
is_relro = true;
- else if (strcmp(name, ".ctors") == 0
- || strcmp(name, ".dtors") == 0
- || strcmp(name, ".jcr") == 0)
- is_relro = true;
}
if (is_relro)