Skip to content

[Clang][AMDGPU] Enable avail-extern-to-local for ThinLTO in HIP #134476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/HIPAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
// ToDo: Remove this option after AMDGPU backend supports ISA-level linking.
// Since AMDGPU backend currently does not support ISA-level linking, all
// called functions need to be imported.
if (IsThinLTO)
if (IsThinLTO) {
LldArgs.push_back(Args.MakeArgString("-plugin-opt=-force-import-all"));
LldArgs.push_back(Args.MakeArgString("-plugin-opt=-avail-extern-to-local"));
}

for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
LldArgs.push_back(
Expand Down
8 changes: 8 additions & 0 deletions clang/test/Driver/hip-thinlto.hip
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %clang -foffload-lto=thin -nogpulib -nogpuinc %s -### 2>&1 | FileCheck %s

// CHECK: -plugin-opt=thinlto
// CHECK-SAME: -plugin-opt=-force-import-all
// CHECK-SAME: -plugin-opt=-avail-extern-to-local
int main(int, char *[]) {
return 0;
}