[PATCH] D124466: [CUDA][HIP] Fix linkage of __clang_gpu_used_external
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 26 10:10:58 PDT 2022
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a subscriber: mattd.
Herald added a project: All.
yaxunl requested review of this revision.
Different TU's may have this globl var. appending linkage can
only be used with lld recognized special variables.
Change it to internal linkage.
https://reviews.llvm.org/D124466
Files:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenCUDA/host-used-extern.cu
Index: clang/test/CodeGenCUDA/host-used-extern.cu
===================================================================
--- clang/test/CodeGenCUDA/host-used-extern.cu
+++ clang/test/CodeGenCUDA/host-used-extern.cu
@@ -11,7 +11,7 @@
#include "Inputs/cuda.h"
-// CHECK-LABEL: @__clang_gpu_used_external = appending {{.*}}global
+// CHECK-LABEL: @__clang_gpu_used_external = internal {{.*}}global
// CHECK-DAG: @_Z7kernel1v
// CHECK-DAG: @_Z7kernel4v
// CHECK-DAG: @var1
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -599,7 +599,7 @@
llvm::ArrayType *ATy = llvm::ArrayType::get(Int8PtrTy, UsedArray.size());
auto *GV = new llvm::GlobalVariable(
- getModule(), ATy, false, llvm::GlobalValue::AppendingLinkage,
+ getModule(), ATy, false, llvm::GlobalValue::InternalLinkage,
llvm::ConstantArray::get(ATy, UsedArray), "__clang_gpu_used_external");
addCompilerUsedGlobal(GV);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124466.425255.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220426/e6626a99/attachment.bin>
More information about the cfe-commits
mailing list