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); }
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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits