[clang] [HIP] Link the LLVM libc libraries in no-RDC mode (PR #151046)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 18:48:35 PDT 2025
jhuber6 wrote:
> Where did the decision to "get these libraries" come from? Linking "libc.bc" into hip is unnecessary and unwanted at this point, in my view.
The new driver, which hopefully be the default in HIP soonish, handles all the offloading languages more or less the same. We link these libraries by default since they're used by OpenMP and the other languages inherit that code since the implementation is totally generic. There was never a patch to turn it on in HIP specifically, it just kind of inherited it as part of the generic toolchain behavior. Static libraries only extract undefined symbols, so it should only show up if there's something that would otherwise be a linker error.
We could disable it for HIP, it's relatively trivial to pass `-Xoffload-linker -lc` to get the same behavior if desired manually. The RDC mode case is more difficult since you'd need to use the `-mlink` option and unfortunately you can't do `-Xarch_amdgcn -Xclang -mlink-builtin-bitcode` which is kind of what I was wondering if I could rectify here. But likely I'm the only one so far playing around with C / C++ standard library calls in HIP. I'm relatively close to supporting arbitrary C/C++ in HIP kernels as a part of this stuff, but if you don't think that's worthwhile I can just leave it as an OpenMP thing and give people opt-in behavior for HIP.
https://github.com/llvm/llvm-project/pull/151046
More information about the cfe-commits
mailing list