public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix ada tests with -fPIE/-pie
@ 2019-08-07 11:07 Tom de Vries
  2019-08-07 14:18 ` Tom Tromey
  0 siblings, 1 reply; 10+ messages in thread
From: Tom de Vries @ 2019-08-07 11:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey, Joel Brobecker

Hi,

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" for ada test-cases in
gdb_default_target_compile, and doing the same for -no-pie.

Tested on x86_64-linux.

OK for trunk?

Thanks,
- Tom

[gdb/testsuite] Fix ada tests with -fPIE/-pie

gdb/testsuite/ChangeLog:

2019-08-07  Tom de Vries  <tdevries@suse.de>

	PR testsuite/24888
	* lib/future.exp (gdb_default_target_compile): Route -pie/-no-pie to
	gnatlink for ada.

---
 gdb/testsuite/lib/future.exp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 122e652858..e26e49af91 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -530,7 +530,19 @@ proc gdb_default_target_compile {source destfile type options} {
     }
 
     if {[board_info $dest exists multilib_flags]} {
-	append add_flags " [board_info $dest multilib_flags]"
+	if { $compiler_type == "ada" } {
+	    foreach op [board_info $dest multilib_flags] {
+		if { $op == "-pie" || $op == "-no-pie" } {
+		    # Pretend gnatmake supports -pie/-no-pie, route it to
+		    # linker.
+		    append add_flags " -largs $op -margs"
+		} else {
+		    append add_flags " $op"
+		}
+	    }
+	} else {
+	    append add_flags " [board_info $dest multilib_flags]"
+	}
     }
 
     verbose "doing compile"

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-10 14:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 11:07 [PATCH][gdb/testsuite] Fix ada tests with -fPIE/-pie Tom de Vries
2019-08-07 14:18 ` Tom Tromey
2019-08-07 15:27   ` Tom de Vries
2019-08-08 10:15     ` Tom de Vries
2019-08-21  7:15       ` [PING][PATCH][gdb/testsuite] " Tom de Vries
2019-08-28  7:18         ` [PING^2][PATCH][gdb/testsuite] " Tom de Vries
2019-09-04  8:17           ` [PING^3][PATCH][gdb/testsuite] " Tom de Vries
2019-09-13 19:47             ` [PING^4][PATCH][gdb/testsuite] " Tom de Vries
2019-10-09 14:49         ` [PING][PATCH][gdb/testsuite] " Tom Tromey
2019-10-10 14:03           ` [gdb/testsuite] Compile ada with -lgnarl_pic and -lgnat_pic if required Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).