The compiler-rt library path can be either {resource_dir}/lib/{triple}
or {resource_dir}/lib/{OS}/{arch} depending on whether
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default is ON or OFF.
Currently, the rpath added by -rtlib-add-rpath only adds
the latter. This patch checks both and adds the one that exists.
Details
Details
- Reviewers
MaskRay tra jdoerfert - Commits
- rG5f91c747763c: [Driver] Fix rpath for compiler-rt
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This change is correct for Linux. llvm/CMakeLists.txt says:
if(CMAKE_SYSTEM_NAME MATCHES "BSD|Linux|OS390") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
Some rpath using OSes (notably macOS) use LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default=OFF. Is the rpath setting ever usable on macOS?
If not, the change is correct.
Comment Actions
How about I try to add both? there is check whether the dir exist then adding it, so only the existing one will be added. then it should work in either case.
Comment Actions
The new test can be placed in arch-specific-libdir-rpath.c. One or two additional RUN lines seem sufficient, no need to duplicate too many.
Also, use --target= for new tests and avoid ^//$.
clang/lib/Driver/ToolChains/OHOS.cpp | ||
---|---|---|
142–144 | delete braces |
clang/lib/Driver/ToolChain.cpp | ||
---|---|---|
638 | unneeded blank line |
clang/lib/Driver/ToolChain.cpp | ||
---|---|---|
638 | will remove when committing |
unneeded blank line