MaskRay added a comment.

> 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 essentially does --rtlib=compiler-rt. The 
default rtlib for Linux is libgcc. 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.



================
Comment at: clang/test/Driver/hip-runtime-libs-linux.hip:6
+// Get compiler-rt library full path.
+// RUN: %clang -target x86_64-linux-gnu -rtlib=compiler-rt \
+// RUN:   -print-libgcc-file-name >%t.1
----------------
Note: `-target ` is legacy spelling. `--target=` is the recommended name.


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

https://reviews.llvm.org/D127142

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to