[clang] [Clang][HIP] Skip internalization for non-LTO device links (PR #225859)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 04:08:47 PDT 2026


================
@@ -53,19 +53,19 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
                                          const llvm::opt::ArgList &Args) const {
   // Construct lld command.
   // The output from ld.lld is an HSA code object file.
-  ArgStringList LldArgs{"-flavor",
-                        "gnu",
-                        "-m",
-                        "elf64_amdgpu",
-                        "--no-undefined",
-                        "-shared",
-                        "-plugin-opt=-amdgpu-internalize-symbols"};
+  const ToolChain &TC = getToolChain();
+  LTOKind LTOMode = TC.getLTOMode(Args, Action::OFK_HIP);
+  ArgStringList LldArgs{"-flavor",        "gnu",    "-m", "elf64_amdgpu",
----------------
yxsamliu wrote:

I agree that the two linker implementations could be merged, but that is separate from this issue. A merged linker would still need to enable internalization for normal LTO to avoid performance regressions and disable it for this mixed non-LTO link. I explained the reason in the internalization thread below.

https://github.com/llvm/llvm-project/pull/225859


More information about the cfe-commits mailing list