summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2012-05-14 17:35:42 +0000
committerCary Coutant <ccoutant@google.com>2012-05-14 17:35:42 +0000
commitc3a06b22c1872a58837153715756c2bb6940088d (patch)
tree50ac12e0307fe79394ca96898472d4baea4a4e45 /gold
parent187558dcdd3677320d30303f09f0205a97d68c12 (diff)
downloadbinutils-redhat-c3a06b22c1872a58837153715756c2bb6940088d.tar.gz
gold/
* layout.cc (Layout::make_output_section): Mark .tdata section as RELRO. * testsuite/relro_test.cc: Add a TLS variable.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/layout.cc4
-rw-r--r--gold/testsuite/relro_test.cc4
3 files changed, 13 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 7fffe40fd6..80ce49ed70 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-14 Cary Coutant <ccoutant@google.com>
+
+ * layout.cc (Layout::make_output_section): Mark .tdata section
+ as RELRO.
+ * testsuite/relro_test.cc: Add a TLS variable.
+
2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
PR gold/14091
diff --git a/gold/layout.cc b/gold/layout.cc
index b58f9d2e40..0ac0fbf917 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1430,7 +1430,9 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type,
{
if (type == elfcpp::SHT_PROGBITS)
{
- if (strcmp(name, ".data.rel.ro") == 0)
+ if ((flags & elfcpp::SHF_TLS) != 0)
+ is_relro = true;
+ else if (strcmp(name, ".data.rel.ro") == 0)
is_relro = true;
else if (strcmp(name, ".data.rel.ro.local") == 0)
{
diff --git a/gold/testsuite/relro_test.cc b/gold/testsuite/relro_test.cc
index d74102245a..795ad39109 100644
--- a/gold/testsuite/relro_test.cc
+++ b/gold/testsuite/relro_test.cc
@@ -45,6 +45,9 @@ int* const p1 __attribute__ ((aligned(64))) = &i1;
// P2 is a local relro variable.
int* const p2 __attribute__ ((aligned(64))) = &i2;
+// Add a TLS variable to make sure -z relro works correctly with TLS.
+__thread int i3 = 1;
+
// Test symbol addresses.
bool
@@ -76,6 +79,7 @@ t1()
assert(i1page != p2page);
assert(i2page != p1page);
assert(i2page != p2page);
+ assert(i3 == 1);
return true;
}