diff options
author | Tom de Vries <tdevries@suse.de> | 2019-10-10 11:51:34 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2019-10-10 11:51:34 +0200 |
commit | abcf2cc85a32a459c2da771c636cc3b6fc985675 (patch) | |
tree | f8e3d683ec78b335811c6d4b1db59510665ae825 | |
parent | 61f055683254bdccafc49d8e7ae045445d6a31d3 (diff) | |
download | gdb-abcf2cc85a32a459c2da771c636cc3b6fc985675.zip gdb-abcf2cc85a32a459c2da771c636cc3b6fc985675.tar.gz gdb-abcf2cc85a32a459c2da771c636cc3b6fc985675.tar.bz2 |
[gdb/testsuite] Fix ada tests with -fPIE/-pie
When running the gdb testsuite with target board unix/-fPIE/-pie, the
resulting ada executables are not PIE executables, because gnatmake doesn't
recognize -pie, and consequently doesn't pass it to gnatlink.
Fix this by replacing "-pie" with "-largs -pie -margs" in
target_compile_ada_from_dir, and doing the same for -no-pie.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-10 Tom de Vries <tdevries@suse.de>
PR testsuite/24888
* lib/ada.exp (target_compile_ada_from_dir): Route -pie/-no-pie to
gnatlink.
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/lib/ada.exp | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4191661..aa57a85 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-10-10 Tom de Vries <tdevries@suse.de> + + PR testsuite/24888 + * lib/ada.exp (target_compile_ada_from_dir): Route -pie/-no-pie to + gnatlink. + 2019-10-09 Tom de Vries <tdevries@suse.de> PR testsuite/25048 diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 95f0f52..45c4180 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -19,11 +19,36 @@ proc target_compile_ada_from_dir {builddir source dest type options} { set saved_cwd [pwd] + + global board + set board [target_info name] + set save_multilib_flag [board_info $board multilib_flags] + set multilib_flag "" + foreach op $save_multilib_flag { + if { $op == "-pie" || $op == "-no-pie" } { + # Pretend gnatmake supports -pie/-no-pie, route it to + # linker. + append multilib_flag " -largs $op -margs" + } else { + append multilib_flag " $op" + } + } + if { $multilib_flag != "" } { + unset_board_info "multilib_flags" + set_board_info multilib_flags "$multilib_flag" + } + catch { cd $builddir return [target_compile $source $dest $type $options] } result options cd $saved_cwd + + if { $save_multilib_flag != "" } { + unset_board_info "multilib_flags" + set_board_info multilib_flags $save_multilib_flag + } + return -options $options $result } |