Hello

While running the libgomp testsuite with an AMD GCN card configured as as the offload accelerator, I often see these errors with the Fortran testcases:

ld: error: undefined symbol: gomp_ialias_omp_get_num_procs
referenced by fortran.c:330
(/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/libgompg/fortran.c:330)
fortran.o:(omp_get_num_procs_) in archive
/scratch/ci-cs/amdtest/upstream-offload/obj/test-mainline-0-x86_64-none-linux-gnu/host-x86_64-linux-gnu/fsf-mainline/bin/../lib/gcc/x86_64-none-linux-gnu/10.0.0/accel/amdgcn-unknown-amdhsa/../../../../../../amdgcn-unknown-amdhsa/lib/gfx906/libgomp.a

omp_get_num_procs_ in fortran.c calls omp_get_num_procs, but the declaration of omp_get_num_procs is processed using the ialias_redirect macro so that it is aliased to a function named gomp_ialias_omp_get_num_procs. The definition of omp_get_num_procs is in libgomp/config/accel/proc.c, but it is not aliased to gomp_ialias_omp_get_num_procs, so the linker fails to satisfy the reference.

This patch applies the corresponding ialias macro to the definition of gomp_omp_get_num_procs in libgomp/config/accel/proc.c. This is already done with the alternative definitions in the mingw32, bsd, linux, posix and rtems subdirectories of libgomp/config/.

Tested on an x86_64 host with both NVPTX and GCN offloading. Okay to commit to trunk?

Kwok


2019-12-06  Kwok Cheung Yeung  <k...@codesourcery.com>

        libgomp/
        * config/accel/proc.c (omp_get_num_procs): Apply ialias macro.
---
 libgomp/config/accel/proc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libgomp/config/accel/proc.c b/libgomp/config/accel/proc.c
index 8ca0b0a..be4cb30 100644
--- a/libgomp/config/accel/proc.c
+++ b/libgomp/config/accel/proc.c
@@ -39,3 +39,5 @@ omp_get_num_procs (void)
 {
   return gomp_icv (false)->nthreads_var;
 }
+
+ialias (omp_get_num_procs)
--
2.8.1

Reply via email to