diff options
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/README | 5 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 15 |
3 files changed, 21 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4f7bdbf..9bc6995 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-03-03 Markus Metzger <markus.t.metzger@intel.com> + + * README (Note): Add nopie_ldflag. + * lib/gdb.exp (gdb_compile): Extend nopie handling. + 2021-03-02 Tom Tromey <tromey@adacore.com> * gdb.ada/fixed_points.exp: Remove most special cases for minimal diff --git a/gdb/testsuite/README b/gdb/testsuite/README index f3c2642..0036753 100644 --- a/gdb/testsuite/README +++ b/gdb/testsuite/README @@ -528,6 +528,11 @@ gdb,nopie_flag The flag required to force the compiler to produce non-position-independent executables. +gdb,nopie_ldflag + + The flag required to force the linker to produce non-position-independent + executables. + gdb,debug When set gdb debug is sent to the file gdb.debug in the test output diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7480bd5..0496ca2 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4210,16 +4210,23 @@ proc gdb_compile {source dest type options} { lappend options "$flag" } - # Replace the "nopie" option with the appropriate linker flag to disable - # PIE executables. There are no compiler flags for this option. + # Replace the "nopie" option with the appropriate compiler and linker + # 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]" + set flag "additional_flags=[target_info gdb,nopie_flag]" } else { - set flag "ldflags=-no-pie" + set flag "additional_flags=-fno-pie" } set options [lreplace $options $nopie $nopie $flag] + + if [target_info exists gdb,nopie_ldflag] { + set flag "ldflags=[target_info gdb,nopie_ldflag]" + } else { + set flag "ldflags=-no-pie" + } + lappend options "$flag" } if { $type == "executable" } { |