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

Andrew Burgess
2019-04-16T23:06:22Z

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(-)

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
--
2.14.5