Skip to content

Commit 13faafd

Browse files
committed
Fix issue about mutiple source files
HIP now uses llvm_offload_entries as section name.
1 parent 501b77e commit 13faafd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/test/Driver/linker-wrapper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ __attribute__((visibility("protected"), used)) int x;
223223
// RELOCATABLE-LINK-HIP: clang-offload-bundler{{.*}} -type=o -bundle-align=4096 -targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa--gfx90a -input={{/dev/null|NUL}} -input={{.*}} -output={{.*}}
224224
// RELOCATABLE-LINK-HIP: /usr/bin/ld.lld{{.*}}-r
225225
// RELOCATABLE-LINK-HIP: llvm-objcopy{{.*}}a.out --remove-section .llvm.offloading
226+
// RELOCATABLE-LINK-HIP: --rename-section llvm_offload_entries
226227

227228
// RUN: clang-offload-packager -o %t.out \
228229
// RUN: --image=file=%t.elf.o,kind=cuda,triple=nvptx64-nvidia-cuda,arch=sm_89 \

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ Error relocateOffloadSection(const ArgList &Args, StringRef Output) {
310310
// Remove the old .llvm.offloading section to prevent further linking.
311311
ObjcopyArgs.emplace_back("--remove-section");
312312
ObjcopyArgs.emplace_back(".llvm.offloading");
313-
for (StringRef Prefix : {"omp", "cuda", "hip"}) {
314-
auto Section = (Prefix + "_offloading_entries").str();
313+
for (StringRef Prefix : {"omp", "cuda", "hip", "llvm"}) {
314+
auto Section = (Prefix + "_offload_entries").str();
315315
// Rename the offloading entires to make them private to this link unit.
316316
ObjcopyArgs.emplace_back("--rename-section");
317317
ObjcopyArgs.emplace_back(

0 commit comments

Comments
 (0)