[review,v2] Add gdb_compile_openmp to lib/gdb.exp

Message ID 20191109205904.4AACC2816F@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 9, 2019, 8:59 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/503
......................................................................

Add gdb_compile_openmp to lib/gdb.exp

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile_openmp): New proc.
	(build_executable_from_specs): Add an "openmp" option.

Change-Id: I94048b8b0940c707ce0529a6bcfa6e4eace49101
---
M gdb/testsuite/lib/gdb.exp
1 file changed, 13 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d395ef..1731a3e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3941,6 +3941,9 @@ 
 # against several different thread libraries, to see which one this
 # system has.
 proc gdb_compile_pthreads {source dest type options} {
+    if {$type != "executable"} {
+	return [gdb_compile $source $dest $type $options]
+    }
     set built_binfile 0
     set why_msg "unrecognized error"
     foreach lib {-lpthreads -lpthread -lthread ""} {
@@ -4146,6 +4149,14 @@ 
     }
 }
 
+# Build an OpenMP program from SOURCE.  See prefatory comment for
+# gdb_compile, above, for discussion of the parameters to this proc.
+
+proc gdb_compile_openmp {source dest type options} {
+    lappend options "additional_flags=-fopenmp"
+    return [gdb_compile $source $dest $type $options]
+}
+
 # Send a command to GDB.
 # For options for TYPE see gdb_stdin_log_write
 
@@ -5891,7 +5902,7 @@ 
     }
 
     set func gdb_compile
-    set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}]
+    set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads|openmp)$}]
     if {$func_index != -1} {
 	set func "${func}_[lindex $options $func_index]"
     }
@@ -5926,7 +5937,7 @@ 
 	    if { ! [regexp "^/" "$s"] } then {
 		set s "$srcdir/$subdir/$s"
 	    }
-	    if  { [gdb_compile "${s}" "${binfile}${i}.o" object $local_options] != "" } {
+	    if  { [$func "${s}" "${binfile}${i}.o" object $local_options] != "" } {
 		untested $testname
 		return -1
 	    }