public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Vrany <jan.vrany@fit.cvut.cz>
To: gdb-patches@sourceware.org
Cc: Jan Vrany <jan.vrany@fit.cvut.cz>
Subject: [PATCH v3] Fix various tests to use -no-pie linker flag when needed
Date: Wed, 17 Oct 2018 15:12:00 -0000	[thread overview]
Message-ID: <20181017151210.3278-1-jan.vrany@fit.cvut.cz> (raw)
In-Reply-To: <20181017145537.3010-1-jan.vrany@fit.cvut.cz>

Various test use test code written in i385 / x86_64 assembly that cannot
be used to create PIE executables. Therefore compilation of test programs
failed on systems where the compiler default is to create PIE executable.

To fix this, force -no-pie linker flag.

gdb/testsuite/ChangeLog:
2018-08-28  Jan Vrany  <jan.vrany@fit.cvut.cz>

	* gdb.arch/amd64-disp-step.exp: Use -no-pie linker flag
	to enforce non-PIE executable.
	* gdb.arch/amd64-entry-value.exp: Likewise.
	* gdb.arch/amd64-invalid-stack-middle.exp: Likewise.
	* gdb.arch/i386-float.exp: Likewise.
	* gdb.arch/i386-signal.exp: Likewise.
	* gdb.mi/mi-reg-undefined.exp: Likewise.
---
 gdb/testsuite/ChangeLog                               | 10 ++++++++++
 gdb/testsuite/gdb.arch/amd64-disp-step.exp            |  3 ++-
 gdb/testsuite/gdb.arch/amd64-entry-value.exp          |  2 +-
 gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp |  3 ++-
 gdb/testsuite/gdb.arch/i386-float.exp                 |  2 +-
 gdb/testsuite/gdb.arch/i386-signal.exp                |  2 +-
 gdb/testsuite/gdb.mi/mi-reg-undefined.exp             |  2 +-
 7 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 90ce8af3ae..4cd0b03f39 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2018-08-28  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* gdb.arch/amd64-disp-step.exp: Use -no-pie linker flag
+	to enforce non-PIE executable.
+	* gdb.arch/amd64-entry-value.exp: Likewise.
+	* gdb.arch/amd64-invalid-stack-middle.exp: Likewise.
+	* gdb.arch/i386-float.exp: Likewise.
+	* gdb.arch/i386-signal.exp: Likewise.
+	* gdb.mi/mi-reg-undefined.exp: Likewise.
+
 2018-10-16  Tom de Vries  <tdevries@suse.de>
 
 	PR gdb/23730
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
index 782b75896c..83ca38830d 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
@@ -25,9 +25,10 @@ if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
 
 set newline "\[\r\n\]*"
 
+set opts {debug ldflags=-no-pie}
 standard_testfile .S
 
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index 72700d55c2..eeb22c8066 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile .s
-set opts {}
+set opts {ldflags=-no-pie}
 
 if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1"
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
index 2bb0344052..1694b955c5 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
@@ -27,7 +27,8 @@
 # run twice, and we restart gdb before testing each different command to
 # ensure that nothing is being cached.
 
-set opts {}
+set opts {ldflags=-no-pie}
+
 standard_testfile .S
 
 if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp b/gdb/testsuite/gdb.arch/i386-float.exp
index 87c90c372e..3fccf5e81b 100644
--- a/gdb/testsuite/gdb.arch/i386-float.exp
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -28,7 +28,7 @@ standard_testfile .S
 # some targets have leading underscores on assembly symbols.
 set additional_flags [gdb_target_symbol_prefix_flags_asm]
 
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile [list debug $additional_flags]] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile [list debug ldflags=-no-pie $additional_flags]] } {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index 38046a13cb..a046c06c9d 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -23,7 +23,7 @@ if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
 standard_testfile
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-	  executable { debug }] != "" } {
+	  executable { debug ldflags=-no-pie }] != "" } {
     untested "failed to compile"
     return -1
 }
diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
index 83abab1a0e..bc560ad9e5 100644
--- a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
+++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp
@@ -33,7 +33,7 @@ if [mi_gdb_start] {
 
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug ldflags=-no-pie}] != "" } {
      untested "failed to compile"
      return -1
 }
-- 
2.19.1

  reply	other threads:[~2018-10-17 15:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 19:37 [PATCH] " Jan Vrany
2018-09-07 20:43 ` Tom Tromey
2018-09-07 22:18   ` Simon Marchi
2018-10-14  9:59     ` Jan Vrany
2018-10-16 22:18       ` Simon Marchi
2018-10-17 13:55         ` Tom Tromey
2018-10-17 14:56           ` [PATCH v2] " Jan Vrany
2018-10-17 15:12             ` Jan Vrany [this message]
2018-10-17 15:44               ` [PATCH v3] " Simon Marchi
2018-10-17 15:53                 ` Simon Marchi
2018-10-17 19:33                   ` Jan Vrany
2018-12-13 15:21                   ` [PATCH] " Jan Vrany
2018-12-13 17:13                     ` Simon Marchi
2018-12-21 20:56                       ` Simon Marchi
2018-10-17 15:47         ` Pedro Alves
2018-10-17 15:51           ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181017151210.3278-1-jan.vrany@fit.cvut.cz \
    --to=jan.vrany@fit.cvut.cz \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).