[v3] Fix various tests to use -no-pie linker flag when needed
Commit Message
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(-)
Comments
On 2018-10-17 11:12, Jan Vrany wrote:
> Various test use test code written in i385 / x86_64 assembly that
> cannot
typo, "i385"
> 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.
LGTM, thanks!
Simon
On 2018-10-17 11:43, Simon Marchi wrote:
> On 2018-10-17 11:12, Jan Vrany wrote:
>> Various test use test code written in i385 / x86_64 assembly that
>> cannot
>
> typo, "i385"
>
>> 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.
>
> LGTM, thanks!
Actually, see the message from Pedro. gcc 4.8 doesn't know about this
flag, and we probably want to support that for a while... so we'll have
to implement that gdb_compile flag.
Simon
On Wed, 2018-10-17 at 11:52 -0400, Simon Marchi wrote:
> On 2018-10-17 11:43, Simon Marchi wrote:
> > On 2018-10-17 11:12, Jan Vrany wrote:
> > > Various test use test code written in i385 / x86_64 assembly that
> > > cannot
> >
> > typo, "i385"
> >
> > > 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.
> >
> > LGTM, thanks!
>
> Actually, see the message from Pedro. gcc 4.8 doesn't know about this
> flag, and we probably want to support that for a while... so we'll have
> to implement that gdb_compile flag.
>
Yeah, I saw it. I'll update the patch later.
Jan
@@ -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
@@ -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
}
@@ -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"
@@ -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] } {
@@ -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
}
@@ -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
}
@@ -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
}