+2018-12-21 Jan Vrany <jan.vrany@fit.cvut.cz>
+
+ * lib/gdb.exp (gdb_compile): Add new nopie flag enforce
+ non-PIE executables.
+ * README: Mention the gdb,nopie_flag board setting.
+ * gdb.arch/amd64-disp-step.exp: Use nopie 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-12-21 Paul Marechal <paul.marechal@ericsson.com>
PR gdb/23974
The target doesn't support thread names.
+gdb,nopie_flag
+
+ The flag required to force the compiler to produce non-position-independent
+ executables.
+
Testsuite Organization
**********************
set newline "\[\r\n\]*"
+set opts {debug nopie}
standard_testfile .S
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } {
return -1
}
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile .s
-set opts {}
+set opts {nopie}
if [info exists COMPILE] {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1"
# run twice, and we restart gdb before testing each different command to
# ensure that nothing is being cached.
-set opts {}
standard_testfile .S
if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
return
}
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] } {
return -1
}
# 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 nopie $additional_flags]] } {
return -1
}
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
- executable { debug }] != "" } {
+ executable { debug nopie }] != "" } {
untested "failed to compile"
return -1
}
standard_testfile .S
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nopie}] != "" } {
untested "failed to compile"
return -1
}
# dynamically load libraries at runtime. For example, on Linux, this adds
# -ldl so that the test can use dlopen.
# - nowarnings: Inhibit all compiler warnings.
+# - nopie: Prevent creation of PIE executables.
#
# And here are some of the not too obscure options understood by DejaGnu that
# influence the compilation:
set options [lreplace $options $nowarnings $nowarnings $flag]
}
+ # Replace the "nopie" option with the appropriate additional_flags
+ # to disable PIE executables.
+ set nopie [lsearch -exact $options nopie]
+ if {$nopie != -1} {
+ if [target_info exists gdb,nopie_flag] {
+ set flag "ldflags=[target_info gdb,nopie_flag]"
+ } else {
+ set flag "ldflags=-no-pie"
+ }
+ set options [lreplace $options $nopie $nopie $flag]
+ }
+
if { $type == "executable" } {
if { ([istarget "*-*-mingw*"]
|| [istarget "*-*-*djgpp"]