[PATCH] D127142: [HIP] Link with clang_rt.builtins

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 9 13:07:18 PDT 2022


MaskRay added a comment.

In D127142#3570290 <https://reviews.llvm.org/D127142#3570290>, @yaxunl wrote:

> In D127142#3568905 <https://reviews.llvm.org/D127142#3568905>, @MaskRay wrote:
>
>>> These functions are not available in libgcc but in libclang_rt.builtins. Therefore --hip-link needs to link with libclang_rt.builtins by default.
>>
>> I think this is problematic.
>>
>> The current link sequence is `... "-lamdhip64" "/tmp/Debug/lib/clang/15.0.0/lib/linux/libclang_rt.builtins-x86_64.a" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o" "/lib/x86_64-linux-gnu/crtn.o"`
>>
>> Linking in libclang_rt.builtins is incompatible with libgcc. There may be subtle symbol resolving issues. I don't think silently changing the behavior is desired.
>> Perhaps `--rocm-path` should require `--rtlib=compiler-rt`. See the `--rtlib=libgcc requires --unwindlib=libgcc` diagnostic.
>>
>> Your user will need to do a bit more work if `CLANG_DEFAULT_RTLIB` is not `compiler-rt`.
>
> If I use --rtlib=compiler-rt, does that also requires --unwindlib=unwindlib ?

No. --unwindlib=libunwind requires --rtlib=compiler-rt. --rtlib=compiler-rt is compatible both --unwindlib=libgcc and --unwindlib=libunwind.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127142/new/

https://reviews.llvm.org/D127142



More information about the cfe-commits mailing list