libgomp/test: Add flags to find libatomic in build-tree testing
authorMaciej W. Rozycki <macro@wdc.com>
Wed, 20 Nov 2019 15:49:23 +0000 (15:49 +0000)
committerMaciej W. Rozycki <macro@gcc.gnu.org>
Wed, 20 Nov 2019 15:49:23 +0000 (15:49 +0000)
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.

From-SVN: r278505

libgomp/ChangeLog
libgomp/testsuite/lib/libgomp.exp

index e1211c16be6551073305d96cd27ae4654c639030..a7e6870c3eafb63d789430f2769a96af1f882c92 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-20  Maciej W. Rozycki  <macro@wdc.com>
+
+       * testsuite/lib/libgomp.exp (libgomp_init): Add flags to find
+       libatomic in build-tree testing.
+
 2019-11-18  Maciej W. Rozycki  <macro@wdc.com>
 
        * testsuite/Makefile.in: Regenerate.
index 14d9b5f13054eed125887db3a46155ff53a470e1..74d032623c95231071a665979e5dcb93ca6b9144 100644 (file)
@@ -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 != "" } {