summaryrefslogtreecommitdiff
path: root/gold/testsuite/copy_test_relro_1.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-12-27 20:50:47 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-27 20:50:56 -0800
commitb733bcb7f58c42e0e0d94a3f266a4193030e5f3a (patch)
tree3ad325d2805aecf4a3e943d47c33f88ca6a24bf6 /gold/testsuite/copy_test_relro_1.cc
parent7ff34266fd831f828286e556f9cd681c42c0412c (diff)
downloadbinutils-gdb-b733bcb7f58c42e0e0d94a3f266a4193030e5f3a.tar.gz
Place copy relocations in .dynbss when target is read-only.
gold/ PR ld/20995 * copy-relocs.cc (Copy_relocs::make_copy_reloc): Use .dynbss for read-only data when linking with -z relro. * copy-relocs.h (Copy_relocs::dynrelro_): New data member. * testsuite/Makefile.am (copy_test_relro): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/copy_test_relro.cc: New source file. * testsuite/copy_test_relro_1.cc: New source file.
Diffstat (limited to 'gold/testsuite/copy_test_relro_1.cc')
-rw-r--r--gold/testsuite/copy_test_relro_1.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/gold/testsuite/copy_test_relro_1.cc b/gold/testsuite/copy_test_relro_1.cc
new file mode 100644
index 00000000000..d15453464b8
--- /dev/null
+++ b/gold/testsuite/copy_test_relro_1.cc
@@ -0,0 +1,26 @@
+// copy_test_relro_1.cc -- test copy relocs variables for gold
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+// Written by Cary Coutant <ccoutant@gmail.com>.
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
+extern int a;
+extern int* const p = &a;
+
+extern const int b[] = { 100, 200, 300, 400 };