aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-02-07 05:28:06 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-02-07 05:28:06 -0800
commit1952c5cd7d3d24b9647b396731bc4808a2d63d9c (patch)
treec9c5da57723dffe43b0808aa2a0f297015904f4e /ld/testsuite/ld-i386
parent11228d29d5146828325a7f14596b9d87f7a2edf7 (diff)
downloadgdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.zip
gdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.tar.gz
gdb-1952c5cd7d3d24b9647b396731bc4808a2d63d9c.tar.bz2
Issue relocation in RO section warning for -z text
This patch changes linker to issue a warning for relocation in readonly section for -z text. bfd/ PR ld/17935 * elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a warning for relocation in readonly section for -z text. (elf_i386_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. ld/testsuite/ PR ld/17935 * ld-i386/i386.exp: Run pr17935-1 and pr17935-2. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr17935-1.d: New file. * ld-i386/pr17935-1.s: Likewise. * ld-i386/pr17935-2.d: Likewise. * ld-i386/pr17935-2.s: Likewise. * ld-x86-64/pr17935-1.d: Likewise. * ld-x86-64/pr17935-1.s: Likewise. * ld-x86-64/pr17935-2.d: Likewise. * ld-x86-64/pr17935-2.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp2
-rw-r--r--ld/testsuite/ld-i386/pr17935-1.d3
-rw-r--r--ld/testsuite/ld-i386/pr17935-1.s7
-rw-r--r--ld/testsuite/ld-i386/pr17935-2.d3
-rw-r--r--ld/testsuite/ld-i386/pr17935-2.s6
5 files changed, 21 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6f98b4f..f5922b4 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -263,6 +263,8 @@ run_dump_test "pr12627"
run_dump_test "pr13302"
run_dump_test "pr14215"
run_dump_test "pr17057"
+run_dump_test "pr17935-1"
+run_dump_test "pr17935-2"
# Must be Linux native with the C compiler
if { [isnative]
diff --git a/ld/testsuite/ld-i386/pr17935-1.d b/ld/testsuite/ld-i386/pr17935-1.d
new file mode 100644
index 0000000..5303ea2
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17935-1.d
@@ -0,0 +1,3 @@
+# as: --32
+# ld: -m elf_i386 -shared -z text
+# error: warning: relocation against `foo' in readonly section `.text'
diff --git a/ld/testsuite/ld-i386/pr17935-1.s b/ld/testsuite/ld-i386/pr17935-1.s
new file mode 100644
index 0000000..38eef2e
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17935-1.s
@@ -0,0 +1,7 @@
+ .text
+ .globl foo
+foo:
+ .byte 0
+ .globl bar
+bar:
+ .dc.a foo
diff --git a/ld/testsuite/ld-i386/pr17935-2.d b/ld/testsuite/ld-i386/pr17935-2.d
new file mode 100644
index 0000000..c1080f4
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17935-2.d
@@ -0,0 +1,3 @@
+# as: --32
+# ld: -m elf_i386 -shared -z text
+# error: warning: relocation in readonly section `.text'
diff --git a/ld/testsuite/ld-i386/pr17935-2.s b/ld/testsuite/ld-i386/pr17935-2.s
new file mode 100644
index 0000000..3ae5369
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17935-2.s
@@ -0,0 +1,6 @@
+ .text
+foo:
+ .byte 0
+ .globl bar
+bar:
+ .dc.a foo