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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 11:07:07 PDT 2022

MaskRay added a comment.

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

> In D127142#3600809 <https://reviews.llvm.org/D127142#3600809>, @MaskRay wrote:
>> Magically deciding a default value for --unwindlib or --rtlib is not nice. You may emit a warning if the selected default happens to be incompatible with HIP.
> We build clang not just for compiling HIP programs. For C/C++ programs, we want to use the default runtime and unwind library.

One choice is that ensure the user specify `-DCMAKE_DEFAULT_RTLIB=compiler-rt`.
(Since compiler-rt can be used with libgcc_s, -DCMAKE_DEFAULT_UNWINDLIB=libunwind is not strictly necessary.)

> We only want to change the default runtime and unwind library for HIP.

The correct place is `clang/lib/Driver/ToolChain.cpp ToolChain::GetUnwindLibType` (see `"platform"`).
HIP should have its derived `ToolChain` to override the member function.



More information about the cfe-commits mailing list