When running test-case gdb.dwarf2/dw2-restrict.exp on openSUSE Leap 15.2 with
gcc-PIE installed (switching compiler default to -fPIE/-pie), I get:
...
gdb compile failed, ld: outputs/gdb.dwarf2/dw2-restrict/dw2-restrict0.o: \
warning: relocation in read-only section `.text'
ld: warning: creating DT_TEXTREL in a PIE
UNTESTED: gdb.dwarf2/dw2-restrict.exp: failed to prepare
...
This is due to using a hardcoded .S file that was generated with -fno-PIE.
Fix this by adding the missing nopie.
Likewise in gdb.arch/amd64-tailcall-noret.exp.
Tested on x86_64-linux.
return
}
+lappend opts nopie
+
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
return -1
}
standard_testfile .S
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {nodebug nopie}]} {
return -1
}