[PATCH] D127142: [HIP] Link with clang_rt.builtins
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 17 08:25:01 PDT 2022
yaxunl added a comment.
In D127142#3590874 <https://reviews.llvm.org/D127142#3590874>, @yaxunl wrote:
> In D127142#3571260 <https://reviews.llvm.org/D127142#3571260>, @MaskRay wrote:
>
>> In D127142#3570290 <https://reviews.llvm.org/D127142#3570290>, @yaxunl wrote:
>>
>>> If I use --rtlib=compiler-rt, does that also requires --unwindlib=unwindlib ?
>>
>> No. --unwindlib=libunwind requires --rtlib=compiler-rt. --rtlib=compiler-rt is compatible with both --unwindlib=libgcc and --unwindlib=libunwind.
>
> If only use -rtlib=compiler-rt without changing unwind lib, I will get missing symbol:
>
> [2022-06-16T20:05:28.644Z] ld.lld: error: undefined symbol: _Unwind_Resume
>
> [2022-06-16T20:05:28.644Z] >>> referenced by main.cpp
>
> [2022-06-16T20:05:28.644Z] >>> CMakeFiles/MIOpenDriver.dir/main.cpp.o:(generate_skipahead_file())
>
> [2022-06-16T20:05:28.644Z] >>> referenced by main.cpp
>
> [2022-06-16T20:05:28.644Z] >>> CMakeFiles/MIOpenDriver.dir/main.cpp.o:(main)
>
> [2022-06-16T20:05:28.644Z] >>> referenced by main.cpp
>
> [2022-06-16T20:05:28.644Z] >>> CMakeFiles/MIOpenDriver.dir/main.cpp.o:(std::function<void (float&, float, bool&)> reduce::ReduceOpFn2<float>(miopenReduceTensorOp_t))
>
> [2022-06-16T20:05:28.644Z] >>> referenced 1246 more times
>
> [2022-06-16T20:05:28.644Z]
>
> [2022-06-16T20:05:28.644Z] ld.lld: error: ../lib/libMIOpen.so.1.0.50300: undefined reference to _Unwind_Resume [--no-allow-shlib-undefined]
>
> [2022-06-16T20:05:28.644Z] ld.lld: error: ../lib/libMIOpen.so.1.0.50300: undefined reference to _Unwind_Backtrace [--no-allow-shlib-undefined]
>
> [2022-06-16T20:05:28.644Z] ld.lld: error: ../lib/libMIOpen.so.1.0.50300: undefined reference to _Unwind_GetIP [--no-allow-shlib-undefined]
>
> [2022-06-16T20:05:28.644Z] clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
If I use --rtlib=compiler-rt, do I have to explicitly add --unwindlib=libgcc or --unwindlib=libunwind? I suspect the linker is not linking the unwind library when -rtlib=compiler-rt is specified.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127142/new/
https://reviews.llvm.org/D127142
More information about the cfe-commits
mailing list