From 2654f77d1424f6172d3026c524e96e14b5752ba1 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 28 Sep 2023 09:47:36 +0200 Subject: [PATCH] [gdb/testsuite] Add nopie to gdb.base/unwind-on-each-insn-amd64-2.exp When running test-case gdb.base/unwind-on-each-insn-amd64-2.exp with target board unix/-fPIE/-pie, I run into: ... gdb compile failed, ld: unwind-on-each-insn-amd64-21.o: relocation \ R_X86_64_32S against `.text' can not be used when making a PIE object; \ recompile with -fPIE ld: failed to set dynamic section sizes: bad value ... Fix this by hardcoding nopie in the test-case, and for good measure in the other test-cases that source unwind-on-each-insn.exp.tcl and use a .s file. Tested on x86_64-linux. Approved-by: Kevin Buettner --- .../gdb.base/unwind-on-each-insn-amd64-2.exp | 11 +++++++++-- gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp | 8 ++++++-- gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp | 8 ++++++-- gdb/testsuite/gdb.base/unwind-on-each-insn.exp | 1 + gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp index c8a94ccef4f..8675ba2fa48 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp @@ -17,8 +17,15 @@ require is_x86_64_m64_target -set srcfile_flags {debug} -set srcfile2_flags {nodebug} +set srcfile_flags {} +lappend srcfile_flags debug +lappend srcfile_flags nopie + +set srcfile2_flags {} +lappend srcfile2_flags nodebug +lappend srcfile_flags nopie + +set ldflags $srcfile_flags if [info exists COMPILE] { # Make sure that we use .eh_frame info, by generating it diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp index cec4a2de236..e7c22d47cd7 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp @@ -17,8 +17,12 @@ require is_x86_64_m64_target -set srcfile_flags {debug} -set srcfile2_flags {debug} +set srcfile_flags {} +lappend srcfile_flags debug +lappend srcfile_flags nopie + +set srcfile2_flags $srcfile_flags +set ldflags $srcfile_flags if [info exists COMPILE] { standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp index 5e9f60902e7..255ed09f1ba 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp @@ -17,8 +17,12 @@ require is_x86_like_target -set srcfile_flags {debug} -set srcfile2_flags {debug} +set srcfile_flags {} +lappend srcfile_flags debug +lappend srcfile_flags nopie + +set srcfile2_flags $srcfile_flags +set ldflags $srcfile_flags if [info exists COMPILE] { standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp index 2fc6d30b0f3..b5fc257b69e 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp @@ -17,6 +17,7 @@ standard_testfile .c -foo.c set srcfile_flags {debug} set srcfile2_flags {nodebug} +set ldflags {debug} # Make sure that we don't use .eh_frame info, by not generating it, # using -fno-asynchronous-unwind-tables, if supported. diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl index 1b6840e3102..82404d191e0 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp.tcl @@ -24,7 +24,7 @@ # value, can be calculated correctly. if {[prepare_for_testing_full "failed to prepare" \ - [list ${testfile} {debug} \ + [list ${testfile} $ldflags \ $srcfile $srcfile_flags $srcfile2 $srcfile2_flags]]} { return -1 } -- 2.30.2