From aa66f9e2e678b90f96f7d242a5c3ea00bc43730c Mon Sep 17 00:00:00 2001 From: Alexander Penev Date: Sun, 17 Sep 2023 20:49:58 +0000 Subject: [PATCH] Add clang 16/17 CUDA CodeGen fix patch --- patches/llvm/clang16-4-CUDA-CodeGenFix.patch | 13 +++++++++++++ patches/llvm/clang17-1-CUDA-CodeGenFix.patch | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 patches/llvm/clang16-4-CUDA-CodeGenFix.patch create mode 100644 patches/llvm/clang17-1-CUDA-CodeGenFix.patch diff --git a/patches/llvm/clang16-4-CUDA-CodeGenFix.patch b/patches/llvm/clang16-4-CUDA-CodeGenFix.patch new file mode 100644 index 00000000..da35264f --- /dev/null +++ b/patches/llvm/clang16-4-CUDA-CodeGenFix.patch @@ -0,0 +1,13 @@ +diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b//clang/lib/CodeGen/CodeGenModule.cpp +index f09d1129b128..82289cba3c12 100644 +--- a/clang/lib/CodeGen/CodeGenModule.cpp ++++ b/clang/lib/CodeGen/CodeGenModule.cpp +@@ -786,7 +786,7 @@ void CodeGenModule::Release() { + AddGlobalCtor(ObjCInitFunction); + if (Context.getLangOpts().CUDA && CUDARuntime) { + if (llvm::Function *CudaCtorFunction = CUDARuntime->finalizeModule()) +- AddGlobalCtor(CudaCtorFunction); ++ AddGlobalCtor(CudaCtorFunction, 0); + } + if (OpenMPRuntime) { + if (llvm::Function *OpenMPRequiresDirectiveRegFun = diff --git a/patches/llvm/clang17-1-CUDA-CodeGenFix.patch b/patches/llvm/clang17-1-CUDA-CodeGenFix.patch new file mode 100644 index 00000000..da35264f --- /dev/null +++ b/patches/llvm/clang17-1-CUDA-CodeGenFix.patch @@ -0,0 +1,13 @@ +diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b//clang/lib/CodeGen/CodeGenModule.cpp +index f09d1129b128..82289cba3c12 100644 +--- a/clang/lib/CodeGen/CodeGenModule.cpp ++++ b/clang/lib/CodeGen/CodeGenModule.cpp +@@ -786,7 +786,7 @@ void CodeGenModule::Release() { + AddGlobalCtor(ObjCInitFunction); + if (Context.getLangOpts().CUDA && CUDARuntime) { + if (llvm::Function *CudaCtorFunction = CUDARuntime->finalizeModule()) +- AddGlobalCtor(CudaCtorFunction); ++ AddGlobalCtor(CudaCtorFunction, 0); + } + if (OpenMPRuntime) { + if (llvm::Function *OpenMPRequiresDirectiveRegFun =