public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran
@ 2021-06-02  9:22 Andrew Burgess
  2021-06-02  9:45 ` Willgerodt, Felix
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2021-06-02  9:22 UTC (permalink / raw)
  To: gdb-patches

We currently make use of the -J option to gfortran in order that
compiled modules should be placed in the correct output directory.
Obviously different compilers, e.g. flang, will have different options
to achieve the same result.

This commit makes it so we only add the -J flag when using a gcc
based (i.e. gfortran) compiler.

I had a look through the flang help page and tried a few likely
looking options, but couldn't find anything that seemed to do the same
thing, so, for now, I'm only adding an extra option when compiling
with gfortran.

This does mean that any compiler other than gfortran might run into
problems if running the testsuite in parallel due to modules of the
same name all being written to the same directory, and so possibly
overwriting each other.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Only add the -J option when using a
	gcc based Fortran compiler, for example, flang does not support
	this option.
---
 gdb/testsuite/ChangeLog   | 6 ++++++
 gdb/testsuite/lib/gdb.exp | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 36a5fd4feb7..f6686e19162 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4098,7 +4098,9 @@ proc gdb_compile {source dest type options} {
 	    || [lsearch -exact $options f90] != -1 } {
 	# Fortran compile.
 	set mod_path [standard_output_file ""]
-	lappend new_options "additional_flags=-J${mod_path}"
+	if [test_compiler_info "gcc-*"] {
+	    lappend new_options "additional_flags=-J${mod_path}"
+	}
     }
 
     set shlib_found 0
-- 
2.25.4


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

* RE: [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran
  2021-06-02  9:22 [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran Andrew Burgess
@ 2021-06-02  9:45 ` Willgerodt, Felix
  2021-06-02 17:12   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Willgerodt, Felix @ 2021-06-02  9:45 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

Hi Andrew,

This is more an fyi. We saw the same problem with the Intel compiler, which uses -module:

	-module path
	           specify path where mod files should be placed and first location to
	           look for mod files
	-I<dir>   add directory to include file search path

I have no proper fix really, as test_compiler_info relies on a c program to figure out which compiler is in use :/ This is rather annoying, as using F90_FOR_TARGET in RUNTESTFLAGS won't be enough.

I have no experience with flang, but according to github (https://github.com/flang-compiler/flang), they also have a -module option:

	-module               path to module file (-I also works)

I don't know if -I is really the same as -module for flang. I would expect that they have it split like gfortran and Intel.

Regards,
Felix


-----Original Message-----
From: Gdb-patches <gdb-patches-bounces+felix.willgerodt=intel.com@sourceware.org> On Behalf Of Andrew Burgess
Sent: Mittwoch, 2. Juni 2021 11:23
To: gdb-patches@sourceware.org
Subject: [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran

We currently make use of the -J option to gfortran in order that compiled modules should be placed in the correct output directory.
Obviously different compilers, e.g. flang, will have different options to achieve the same result.

This commit makes it so we only add the -J flag when using a gcc based (i.e. gfortran) compiler.

I had a look through the flang help page and tried a few likely looking options, but couldn't find anything that seemed to do the same thing, so, for now, I'm only adding an extra option when compiling with gfortran.

This does mean that any compiler other than gfortran might run into problems if running the testsuite in parallel due to modules of the same name all being written to the same directory, and so possibly overwriting each other.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Only add the -J option when using a
	gcc based Fortran compiler, for example, flang does not support
	this option.
---
 gdb/testsuite/ChangeLog   | 6 ++++++
 gdb/testsuite/lib/gdb.exp | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 36a5fd4feb7..f6686e19162 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4098,7 +4098,9 @@ proc gdb_compile {source dest type options} {
 	    || [lsearch -exact $options f90] != -1 } {
 	# Fortran compile.
 	set mod_path [standard_output_file ""]
-	lappend new_options "additional_flags=-J${mod_path}"
+	if [test_compiler_info "gcc-*"] {
+	    lappend new_options "additional_flags=-J${mod_path}"
+	}
     }
 
     set shlib_found 0
--
2.25.4

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran
  2021-06-02  9:45 ` Willgerodt, Felix
@ 2021-06-02 17:12   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2021-06-02 17:12 UTC (permalink / raw)
  To: Willgerodt, Felix via Gdb-patches

>> I have no proper fix really, as test_compiler_info relies on a c
>> program to figure out which compiler is in use :/ This is rather
>> annoying, as using F90_FOR_TARGET in RUNTESTFLAGS won't be enough.

It's fine to add a proc to test the properties of the relevant compiler.
See, e.g., rust_llvm_version in gdb/testsuite/lib/rust-support.exp.

Tom

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

end of thread, other threads:[~2021-06-02 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  9:22 [PUSHED] gdb/testsuite: only add -J option when compiling with gfortran Andrew Burgess
2021-06-02  9:45 ` Willgerodt, Felix
2021-06-02 17:12   ` Tom Tromey

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