public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgomp/test: Add flags to find libatomic in build-tree testing
@ 2019-11-09  1:15 Maciej W. Rozycki
  2019-11-18 13:08 ` [PING][PATCH] " Maciej W. Rozycki
  2019-11-18 15:46 ` [PATCH] " Jakub Jelinek
  0 siblings, 2 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2019-11-09  1:15 UTC (permalink / raw)
  To: gcc-patches

Add flags to find libatomic in build-tree testing, fixing a catastrophic 
libgomp testsuite failure with targets such as `riscv-linux-gnu' that 
imply `-latomic' with the `-pthread' GCC option, implied in turn by the 
offload options, removing failures like:

.../bin/riscv64-linux-gnu-ld: cannot find -latomic
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libgomp.c/../libgomp.c-c++-common/atomic-18.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find -latomic

UNRESOLVED: libgomp.c/../libgomp.c-c++-common/atomic-18.c compilation failed to produce executable

and bringing overall test results for the said target (here with the 
`x86_64-linux-gnu' host and RISC-V QEMU in the Linux user emulation mode 
as the target board) from:

		=== libgomp Summary ===

# of expected passes		90
# of unexpected failures	3267
# of expected failures		2
# of unresolved testcases	3247
# of unsupported tests		548

to:

		=== libgomp Summary ===

# of expected passes		6834
# of unexpected failures	4
# of expected failures		4
# of unsupported tests		518

	libgomp/
	* testsuite/lib/libgomp.exp (libgomp_init): Add flags to find 
	libatomic in build-tree testing.
---
 libgomp/testsuite/lib/libgomp.exp |   10 ++++++++++
 1 file changed, 10 insertions(+)

gcc-test-libgomp-atomic-lib-path.diff
Index: gcc/libgomp/testsuite/lib/libgomp.exp
===================================================================
--- gcc.orig/libgomp/testsuite/lib/libgomp.exp
+++ gcc/libgomp/testsuite/lib/libgomp.exp
@@ -174,6 +174,16 @@ proc libgomp_init { args } {
     # For build-tree testing, also consider the library paths used for builing.
     # For installed testing, we assume all that to be provided in the sysroot.
     if { $blddir != "" } {
+	# Offload options imply `-pthread', and that implies `-latomic'
+	# on some targets, so wire in libatomic build directories.
+	set shlib_ext [get_shlib_extension]
+	set atomic_library_path "${blddir}/../libatomic/.libs"
+	if { [file exists "${atomic_library_path}/libatomic.a"]
+	     || [file exists \
+		 "${atomic_library_path}/libatomic.${shlib_ext}"] } {
+	    lappend ALWAYS_CFLAGS "additional_flags=-L${atomic_library_path}"
+	    append always_ld_library_path ":${atomic_library_path}"
+	}
 	global cuda_driver_include
 	global cuda_driver_lib
 	if { $cuda_driver_include != "" } {

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

* [PING][PATCH] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-09  1:15 [PATCH] libgomp/test: Add flags to find libatomic in build-tree testing Maciej W. Rozycki
@ 2019-11-18 13:08 ` Maciej W. Rozycki
  2019-11-18 15:46 ` [PATCH] " Jakub Jelinek
  1 sibling, 0 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2019-11-18 13:08 UTC (permalink / raw)
  To: gcc-patches

On Sat, 9 Nov 2019, Maciej W. Rozycki wrote:

> Add flags to find libatomic in build-tree testing, fixing a catastrophic 
> libgomp testsuite failure with targets such as `riscv-linux-gnu' that 
> imply `-latomic' with the `-pthread' GCC option, implied in turn by the 
> offload options, removing failures like:

 Ping for:

<https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00662.html>

  Maciej

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

* Re: [PATCH] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-09  1:15 [PATCH] libgomp/test: Add flags to find libatomic in build-tree testing Maciej W. Rozycki
  2019-11-18 13:08 ` [PING][PATCH] " Maciej W. Rozycki
@ 2019-11-18 15:46 ` Jakub Jelinek
  2019-11-19 23:18   ` [PATCH v2] " Maciej W. Rozycki
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2019-11-18 15:46 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gcc-patches

On Sat, Nov 09, 2019 at 01:07:24AM +0000, Maciej W. Rozycki wrote:
> --- gcc.orig/libgomp/testsuite/lib/libgomp.exp
> +++ gcc/libgomp/testsuite/lib/libgomp.exp
> @@ -174,6 +174,16 @@ proc libgomp_init { args } {
>      # For build-tree testing, also consider the library paths used for builing.
>      # For installed testing, we assume all that to be provided in the sysroot.
>      if { $blddir != "" } {
> +	# Offload options imply `-pthread', and that implies `-latomic'
> +	# on some targets, so wire in libatomic build directories.

-fopenmp is not an option I'd like to call Offload option, OpenMP is much
more than just offloading, and this isn't on some targets, but only one, riscv*.
So, I think it should be done only for
that target and talk about -fopenmp/-fopenacc options instead of Offload
options.

> +	set shlib_ext [get_shlib_extension]
> +	set atomic_library_path "${blddir}/../libatomic/.libs"
> +	if { [file exists "${atomic_library_path}/libatomic.a"]
> +	     || [file exists \
> +		 "${atomic_library_path}/libatomic.${shlib_ext}"] } {
> +	    lappend ALWAYS_CFLAGS "additional_flags=-L${atomic_library_path}"
> +	    append always_ld_library_path ":${atomic_library_path}"
> +	}
>  	global cuda_driver_include
>  	global cuda_driver_lib
>  	if { $cuda_driver_include != "" } {

	Jakub

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

* [PATCH v2] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-18 15:46 ` [PATCH] " Jakub Jelinek
@ 2019-11-19 23:18   ` Maciej W. Rozycki
  2019-11-19 23:29     ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2019-11-19 23:18 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Add flags to find libatomic in build-tree testing, fixing a catastrophic 
libgomp testsuite failure with targets such as `riscv-linux-gnu' that 
imply `-latomic' with the `-pthread' GCC option, implied in turn by the 
`-fopenacc' and `-fopenmp' options, removing failures like:

.../bin/riscv64-linux-gnu-ld: cannot find -latomic
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libgomp.c/../libgomp.c-c++-common/atomic-18.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find -latomic

UNRESOLVED: libgomp.c/../libgomp.c-c++-common/atomic-18.c compilation failed to produce executable

and bringing overall test results for the said target (here with the 
`x86_64-linux-gnu' host and RISC-V QEMU in the Linux user emulation mode 
as the target board) from:

		=== libgomp Summary ===

# of expected passes		90
# of unexpected failures	3267
# of expected failures		2
# of unresolved testcases	3247
# of unsupported tests		548

to:

		=== libgomp Summary ===

# of expected passes		6834
# of unexpected failures	4
# of expected failures		4
# of unsupported tests		518

	libgomp/
	* testsuite/lib/libgomp.exp (libgomp_init): Add flags to find 
	libatomic in build-tree testing.
---
Hi Jakub,

 Thank you for your review.

On Mon, 18 Nov 2019, Jakub Jelinek wrote:

> > --- gcc.orig/libgomp/testsuite/lib/libgomp.exp
> > +++ gcc/libgomp/testsuite/lib/libgomp.exp
> > @@ -174,6 +174,16 @@ proc libgomp_init { args } {
> >      # For build-tree testing, also consider the library paths used for builing.
> >      # For installed testing, we assume all that to be provided in the sysroot.
> >      if { $blddir != "" } {
> > +	# Offload options imply `-pthread', and that implies `-latomic'
> > +	# on some targets, so wire in libatomic build directories.
> 
> -fopenmp is not an option I'd like to call Offload option, OpenMP is 
> much more than just offloading, and this isn't on some targets, but only 
> one, riscv*.
> So, I think it should be done only for that target and talk about 
> -fopenmp/-fopenacc options instead of Offload options.

 Thanks for straightening me out on OpenMP; I have adjusted the comment 
and the change description accordingly.

 I think it makes no sense to require people to update this test harness 
if a future target also requires access to libatomic; the `-L' option and 
the dynamic loader path are harmless if not required, as libatomic won't 
actually be pulled unless otherwise requested and there is no other 
library in libatomic's build directory that could be used unintentionally.  
Whereas in the absence of these settings a random version of libatomic 
already present somewhere on the system may accidentally be used and 
affect test results somehow.

 Why do you think it is important that it is only the relevant (i.e. 
`riscv*') targets that the directory providing newly-built libatomic is 
pointed at ?

  Maciej

Changes from v1:

- Replaced references to "offload options" with "`-fopenacc' and 
  `-fopenmp' options".
---
 libgomp/testsuite/lib/libgomp.exp |   11 +++++++++++
 1 file changed, 11 insertions(+)

gcc-test-libgomp-atomic-lib-path.diff
Index: gcc/libgomp/testsuite/lib/libgomp.exp
===================================================================
--- gcc.orig/libgomp/testsuite/lib/libgomp.exp
+++ gcc/libgomp/testsuite/lib/libgomp.exp
@@ -174,6 +174,17 @@ proc libgomp_init { args } {
     # For build-tree testing, also consider the library paths used for builing.
     # For installed testing, we assume all that to be provided in the sysroot.
     if { $blddir != "" } {
+	# The `-fopenacc' and `-fopenmp' options imply `-pthread', and
+	# that implies `-latomic' on some targets, so wire in libatomic
+	# build directories.
+	set shlib_ext [get_shlib_extension]
+	set atomic_library_path "${blddir}/../libatomic/.libs"
+	if { [file exists "${atomic_library_path}/libatomic.a"]
+	     || [file exists \
+		 "${atomic_library_path}/libatomic.${shlib_ext}"] } {
+	    lappend ALWAYS_CFLAGS "additional_flags=-L${atomic_library_path}"
+	    append always_ld_library_path ":${atomic_library_path}"
+	}
 	global cuda_driver_include
 	global cuda_driver_lib
 	if { $cuda_driver_include != "" } {

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

* Re: [PATCH v2] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-19 23:18   ` [PATCH v2] " Maciej W. Rozycki
@ 2019-11-19 23:29     ` Jakub Jelinek
  2019-11-20  2:27       ` [PATCH v3] " Maciej W. Rozycki
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2019-11-19 23:29 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gcc-patches

On Tue, Nov 19, 2019 at 11:11:39PM +0000, Maciej W. Rozycki wrote:
>  Why do you think it is important that it is only the relevant (i.e. 
> `riscv*') targets that the directory providing newly-built libatomic is 
> pointed at ?

Such changes don't happen every day, no other port added it similarly to
riscv during the 2.5 years since riscv had it, and no port needed it ever
before.  With unneeded -L options the log file is larger, one needs to
cut'n'paste more when trying to reproduce stuff etc.

	Jakub

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

* [PATCH v3] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-19 23:29     ` Jakub Jelinek
@ 2019-11-20  2:27       ` Maciej W. Rozycki
  2019-11-20  8:25         ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2019-11-20  2:27 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

Add flags to find libatomic in build-tree testing, fixing a catastrophic 
libgomp testsuite failure with `riscv*-*-linux*' targets, which imply 
`-latomic' with the `-pthread' GCC option, implied in turn by the 
`-fopenacc' and `-fopenmp' options, removing failures like:

.../bin/riscv64-linux-gnu-ld: cannot find -latomic
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libgomp.c/../libgomp.c-c++-common/atomic-18.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find -latomic

UNRESOLVED: libgomp.c/../libgomp.c-c++-common/atomic-18.c compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target 
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user 
emulation mode as the target board) from:

		=== libgomp Summary ===

# of expected passes		90
# of unexpected failures	3267
# of expected failures		2
# of unresolved testcases	3247
# of unsupported tests		548

to:

		=== libgomp Summary ===

# of expected passes		6834
# of unexpected failures	4
# of expected failures		4
# of unsupported tests		518

	libgomp/
	* testsuite/lib/libgomp.exp (libgomp_init): Add flags to find 
	libatomic in build-tree testing.
---
On Wed, 20 Nov 2019, Jakub Jelinek wrote:

> >  Why do you think it is important that it is only the relevant (i.e. 
> > `riscv*') targets that the directory providing newly-built libatomic is 
> > pointed at ?
> 
> Such changes don't happen every day, no other port added it similarly to
> riscv during the 2.5 years since riscv had it, and no port needed it ever
> before.  With unneeded -L options the log file is larger, one needs to
> cut'n'paste more when trying to reproduce stuff etc.

 Fair enough.  OK to apply?

 NB I've decided to use `ishost' rather than `istarget', and updated the 
existing comment accordingly, even though the triplets are always the same 
here, because GCC's target is libgomp's host, e.g.:

Test run by macro on Wed Nov 20 00:39:23 2019
Target is riscv64-unknown-linux-gnu
Host   is riscv64-unknown-linux-gnu
Build  is x86_64-pc-linux-gnu

                === libgomp tests ===

Schedule of variations:
    qemu-user-lp64d

Running target qemu-user-lp64d
[...]

-- and libgomp itself does not have a notion of a target (unlike e.g. 
libbfd).  Consequently I suspect that:

    # Many hosts now default to a non-ASCII C locale, however, so
    # they can set a charset encoding here if they need.
    if { [ishost "*-*-cygwin*"] } {
      setenv LC_ALL C.ASCII
      setenv LANG C.ASCII
    }

is incorrect for `dg-output' matching as it will execute for libgomp built 
for `*-*-cygwin*' rather than being necessarily verified on one, and 
therefore `isbuild' ought to be used here.

  Maciej

Changes from v2:

- Limit the change to `riscv*-*-linux*' targets.

- Refer to the host rather than target within libgomp.exp as GCC's target 
  is libgomp's host.

Changes from v1:

- Replaced references to "offload options" with "`-fopenacc' and 
  `-fopenmp' options".
---
 libgomp/testsuite/lib/libgomp.exp |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

gcc-test-libgomp-atomic-lib-path.diff
Index: gcc/libgomp/testsuite/lib/libgomp.exp
===================================================================
--- gcc.orig/libgomp/testsuite/lib/libgomp.exp
+++ gcc/libgomp/testsuite/lib/libgomp.exp
@@ -174,6 +174,20 @@ proc libgomp_init { args } {
     # For build-tree testing, also consider the library paths used for builing.
     # For installed testing, we assume all that to be provided in the sysroot.
     if { $blddir != "" } {
+	# The `-fopenacc' and `-fopenmp' options imply `-pthread', and
+	# that implies `-latomic' on some hosts, so wire in libatomic
+	# build directories.
+	if [ishost "riscv*-*-linux*"] {
+	    set shlib_ext [get_shlib_extension]
+	    set atomic_library_path "${blddir}/../libatomic/.libs"
+	    if { [file exists "${atomic_library_path}/libatomic.a"]
+		 || [file exists \
+		     "${atomic_library_path}/libatomic.${shlib_ext}"] } {
+		lappend ALWAYS_CFLAGS \
+		    "additional_flags=-L${atomic_library_path}"
+		append always_ld_library_path ":${atomic_library_path}"
+	    }
+	}
 	global cuda_driver_include
 	global cuda_driver_lib
 	if { $cuda_driver_include != "" } {

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

* Re: [PATCH v3] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-20  2:27       ` [PATCH v3] " Maciej W. Rozycki
@ 2019-11-20  8:25         ` Jakub Jelinek
  2019-11-20 15:59           ` Maciej W. Rozycki
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2019-11-20  8:25 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gcc-patches

On Wed, Nov 20, 2019 at 02:13:52AM +0000, Maciej W. Rozycki wrote:

Ok with appropriate ChangeLog entry.

> --- gcc.orig/libgomp/testsuite/lib/libgomp.exp
> +++ gcc/libgomp/testsuite/lib/libgomp.exp
> @@ -174,6 +174,20 @@ proc libgomp_init { args } {
>      # For build-tree testing, also consider the library paths used for builing.
>      # For installed testing, we assume all that to be provided in the sysroot.
>      if { $blddir != "" } {
> +	# The `-fopenacc' and `-fopenmp' options imply `-pthread', and
> +	# that implies `-latomic' on some hosts, so wire in libatomic
> +	# build directories.
> +	if [ishost "riscv*-*-linux*"] {
> +	    set shlib_ext [get_shlib_extension]
> +	    set atomic_library_path "${blddir}/../libatomic/.libs"
> +	    if { [file exists "${atomic_library_path}/libatomic.a"]
> +		 || [file exists \
> +		     "${atomic_library_path}/libatomic.${shlib_ext}"] } {
> +		lappend ALWAYS_CFLAGS \
> +		    "additional_flags=-L${atomic_library_path}"
> +		append always_ld_library_path ":${atomic_library_path}"
> +	    }
> +	}
>  	global cuda_driver_include
>  	global cuda_driver_lib
>  	if { $cuda_driver_include != "" } {

	Jakub

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

* Re: [PATCH v3] libgomp/test: Add flags to find libatomic in build-tree testing
  2019-11-20  8:25         ` Jakub Jelinek
@ 2019-11-20 15:59           ` Maciej W. Rozycki
  0 siblings, 0 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2019-11-20 15:59 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 20 Nov 2019, Jakub Jelinek wrote:

> Ok with appropriate ChangeLog entry.

 I've used one included with the submission.  Change applied now, thanks 
for your review.

  Maciej

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

end of thread, other threads:[~2019-11-20 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09  1:15 [PATCH] libgomp/test: Add flags to find libatomic in build-tree testing Maciej W. Rozycki
2019-11-18 13:08 ` [PING][PATCH] " Maciej W. Rozycki
2019-11-18 15:46 ` [PATCH] " Jakub Jelinek
2019-11-19 23:18   ` [PATCH v2] " Maciej W. Rozycki
2019-11-19 23:29     ` Jakub Jelinek
2019-11-20  2:27       ` [PATCH v3] " Maciej W. Rozycki
2019-11-20  8:25         ` Jakub Jelinek
2019-11-20 15:59           ` Maciej W. Rozycki

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