flang-compiler/flang

[OMP_OFFLOAD_LLVM] Undefined references to .omp_offloading symbols

dmikushin opened this issue · 3 comments

By testing

flang -O2 -fopenmp -fopenmp-targets=x86_64 /openmp-offload-example/src/example.f90 -o /openmp-offload-example/build/example

I get a linking error:

/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x0): undefined reference to `.omp_offloading.img_start.nvptx64-nvidia-cuda'
/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x8): undefined reference to `.omp_offloading.img_end.nvptx64-nvidia-cuda'
/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x10): undefined reference to `.omp_offloading.entries_begin'
/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x18): undefined reference to `.omp_offloading.entries_end'
/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x30): undefined reference to `.omp_offloading.entries_begin'
/usr/bin/ld: /tmp/example-49d1c7.o:(.rodata+0x38): undefined reference to `.omp_offloading.entries_end'

Instead of following my -fopenmp-targets=x86_64 command, Flang gives me offloading to NVIDIA. "I no longer have a motorcycle, but the habit remains" (c)

Today I grepped the whole LLVM repository history for img_start entries with

git rev-list --all | parallel --bar -P 16 git show | grep "img_start"

And found zero occurrences. If it existed, it should pop up at least in the tests. Perhaps, it means the OpenMP linking in Flang was done against PGI's internal fork of LLVM, which is not a part of this project anymore.

Does anyone have a clue? If not, I will match my Fortran example with C example side by side to find the proper naming of OpenMP symbols.