Issue |
159297
|
Summary |
[Offload] Tests implicitly require `LLVMgold` and fail without it
|
Labels |
new issue
|
Assignees |
|
Reporter |
AlexeySachkov
|
I've been trying to make some contributions into `offload` sub-project and tried running `check-offload` to verify my changes, but a lot of tests failed:
```
Failed Tests (145):
libomptarget :: x86_64-unknown-linux-gnu :: offloading/bug51781.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: api/assert.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: api/omp_device_alloc.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: api/omp_device_managed_memory.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: api/omp_device_managed_memory_alloc.c
...
... many more
...
libomptarget :: x86_64-unknown-linux-gnu-LTO :: ompt/veccopy_wrong_return.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/api.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/associate_ptr.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/close_enter_exit.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/close_manual.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/close_member.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/close_modifier.c
libomptarget :: x86_64-unknown-linux-gnu-LTO :: unified_shared_memory/shared_update.c
```
They all fail with the same error:
```
# .---command stderr------------
# | /usr/bin/ld: llvm/llvm-project/build/bin/../lib/LLVMgold.so: error loading plugin: llvm/llvm-project/build/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
# | clang: error: linker command failed with exit code 1 (use -v to see invocation)
# | /localdisk2/asachkov/github.com/llvm/llvm-project/build/bin/clang-linker-wrapper: error: 'clang' failed
# | clang++: error: linker command failed with exit code 1 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 1
```
>From what I understand, tests which involve LTO (that includes `bug51781.c`) need `LLVMgold.so`, but don't actually check if it is built.
`llvm/` subproject testing adds `LLVMgold` as a dependency for test targets if `LLVMgold` target is registered (so that `check-offload` works in a clean build).
https://github.com/llvm/llvm-project/blob/b29c7ded31d81ca47aed0157c543c8b6a0f5866c/llvm/test/CMakeLists.txt#L170-L173
And it has a logic of detecting the plugin presence at runtime to register a LIT feature:
https://github.com/llvm/llvm-project/blob/b29c7ded31d81ca47aed0157c543c8b6a0f5866c/llvm/test/lit.cfg.py#L615-L619
https://github.com/llvm/llvm-project/blob/b29c7ded31d81ca47aed0157c543c8b6a0f5866c/llvm/test/lit.cfg.py#L654-L655
With respect to `offload`, the proposed fix is:
- register `ld_plugin` feature if `LLVMgold` is detected - to address tests like `bug51781.c`
- entirely skip registering (i.e. setting value to `LIBOMPTARGET_SYSTEM_TARGETS` CMake variable) `-LTO` targets if `LLVMgold` target isn't registered
Does it sound like a right approach?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs