================
@@ -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",
+ "--no-undefined", "-shared"};
+ // Native object references are invisible when LTO compiles bitcode libraries
+ // in a non-LTO link, so library definitions must remain external.
+ if (LTOMode != LTOK_None)
+ LldArgs.push_back("-plugin-opt=-amdgpu-internalize-symbols");
----------------
jhuber6 wrote:
This is the part that confuses me. I *really* dislike the internalization pass
here, and LTO is supposed to make it unnecessary if you set up your visibility
correctly. I.e. -fvisibility=hidden. I don't fully remember what this pass
does, but I can imagine it breaking things I will rely on, like the RPC client
symbol that is marked `[[gnu::visibility("protected})]]` being internalized and
no longer readable from HSA.
https://github.com/llvm/llvm-project/pull/225859
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits