This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELRO
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 18 Jul 2017 16:24:30 -0000
- Subject: [binutils-gdb] LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELRO
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9a0f1d5099fa375299115afaa1ef3acbddc47f51
commit 9a0f1d5099fa375299115afaa1ef3acbddc47f51
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Tue Jul 18 17:20:30 2017 +0100
LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELRO
Complement commit d345186d0535 ("Check if GNU_RELRO segment is is
generated") and exclude the presence of a `.dynamic' section from
implying the creation of a GNU_RELRO segment for targets which place the
section in the (read-only) text segment, and therefore cannot have the
section assigned to GNU_RELRO and neither it would make sense.
Currently the list of such targets consists of 64-bit HPPA and
non-VxWorks MIPS targets, as determined by looking for TEXT_DYNAMIC
being set across ld/emulparams/* and then verified by examining default
linker scripts produced in a `--enable-targets=all' build.
ld/
* testsuite/ld-elf/binutils.exp (binutils_test): Make the
expectation for `.dynamic' in GNU_RELRO segment target-specific.
Diff:
---
ld/ChangeLog | 5 +++++
ld/testsuite/ld-elf/binutils.exp | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 23babe3..7af1ddc 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-18 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-elf/binutils.exp (binutils_test): Make the
+ expectation for `.dynamic' in GNU_RELRO segment target-specific.
+
2017-07-18 Nick Clifton <nickc@redhat.com>
PR 21775
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 61e6031..687749d 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -81,12 +81,17 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
}
if [string match "*-z relro*" $ld_options] {
+ # These targets set TEXT_DYNAMIC and therefore have `.dynamic'
+ # in the (read-only) text segment rather than data segment.
+ set relro_dynamic [expr !([istarget "hppa64*-*-*"] \
+ || ([istarget "mips*-*-*"] \
+ && ![istarget "*-*-vxworks*"]))]
# Check if GNU_RELRO segment is generated.
set got [remote_exec host "grep GNU_RELRO tmpdir/$test.exp"]
if { ![string match "*GNU_RELRO*" $got] } then {
set got [remote_exec host "cat tmpdir/$test.exp"]
if { [string match "*.data.rel.ro*" $got]
- || [string match "*.dynamic*" $got]
+ || ($relro_dynamic && [string match "*.dynamic*" $got])
|| [string match "*.got*" $got]
|| [string match "*.eh_frame*" $got]
|| [string match "*.gcc_except_table*" $got]