diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2014-01-09 10:18:19 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2014-01-09 10:19:19 -0800 |
commit | d345186d053575850e7cb541ae2d5eecf4242607 (patch) | |
tree | 15d3c67b7325a14104956de4cf44d07f56e149ae /ld/testsuite | |
parent | 1464e221467fdb2e3812868d201f465559724349 (diff) | |
download | gdb-d345186d053575850e7cb541ae2d5eecf4242607.zip gdb-d345186d053575850e7cb541ae2d5eecf4242607.tar.gz gdb-d345186d053575850e7cb541ae2d5eecf4242607.tar.bz2 |
Check if GNU_RELRO segment is is generated
Fail if GNU_RELRO segment isn't generated, but should.
* ld-elf/binutils.exp (binutils_test): Check if GNU_RELRO segment
is generated.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/binutils.exp | 26 |
2 files changed, 30 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index df2e1b8..da8ce89 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-09 H.J. Lu <hongjiu.lu@intel.com> + + * ld-elf/binutils.exp (binutils_test): Check if GNU_RELRO segment + is generated. + 2014-01-09 Vidya Praveen <vidyapraveen@arm.com> * lib/ld-lib.exp (check_lto_shared_available): New check. diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp index 0101512..b170791 100644 --- a/ld/testsuite/ld-elf/binutils.exp +++ b/ld/testsuite/ld-elf/binutils.exp @@ -1,5 +1,5 @@ # Expect script for binutils tests -# Copyright 2006, 2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc. +# Copyright 2006-2013 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -79,6 +79,30 @@ proc binutils_test { prog_name ld_options test {test_name ""}} { return } + if [string match "*-z relro*" $ld_options] { + # 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] + || [string match "*.got*" $got] + || [string match "*.eh_frame*" $got] + || [string match "*.gcc_except_table*" $got] + || [string match "*.exception_ranges*" $got] + || [string match "*.ctors*" $got] + || [string match "*.dtors*" $got] + || [string match "*.tdata*" $got] + || [string match "*.preinit_array*" $got] + || [string match "*.init_array*" $got] + || [string match "*.fini_array*" $got] } then { + # Fail if GNU_RELRO segment isn't generated, but should. + fail "$test_name" + return + } + } + } + send_log "$prog tmpdir/$test\n" set got [remote_exec host "$prog tmpdir/$test"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { |