[PATCHv2,2/5] gdb/testsuite: Don't add gcc flags when compiling rust tests

Message ID ebb84b63ff5c613c6177bead989c0d5b00bae5b4.1555455013.git.andrew.burgess@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess April 16, 2019, 11:06 p.m. UTC
  We currently add the -fno-stack-protector option to the compiler flags
when compiling rust tests, as this is not a valid rustcc flag, this
means non of the test tests will compile.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Don't add -fno-stack-protector option
	if we're using rustcc.
---
 gdb/testsuite/ChangeLog   | 5 +++++
 gdb/testsuite/lib/gdb.exp | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey April 19, 2019, 2:31 p.m. UTC | #1
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> We currently add the -fno-stack-protector option to the compiler flags
Andrew> when compiling rust tests, as this is not a valid rustcc flag, this
Andrew> means non of the test tests will compile.

Andrew> gdb/testsuite/ChangeLog:

Andrew> 	* lib/gdb.exp (gdb_compile): Don't add -fno-stack-protector option
Andrew> 	if we're using rustcc.

Thanks for doing this.  This is ok.

Tom
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1176fdded14..6c0f243eef8 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3566,7 +3566,11 @@  proc gdb_compile {source dest type options} {
 	 && !([test_compiler_info {gcc-[0-3]-*}]
 	      || [test_compiler_info {gcc-4-0-*}]) } {
         # Put it at the front to not override any user-provided value.
-        lappend new_options "early_flags=-fno-stack-protector"
+	if {[lsearch -exact $options rust] != -1} {
+	    # -fno-stack-protector is not a rustcc option.
+	} else {
+	    lappend new_options "early_flags=-fno-stack-protector"
+	}
     }
 
     # Because we link with libraries using their basename, we may need