Index: clang/lib/CodeGen/CodeGenModule.cpp =================================================================== --- clang/lib/CodeGen/CodeGenModule.cpp +++ clang/lib/CodeGen/CodeGenModule.cpp @@ -3706,6 +3706,11 @@ if (!CGM.supportsCOMDAT()) return false; + // Do not set COMDAT attribute for CUDA/HIP stub functions to prevent + // them being "merged" by the COMDAT Folding linker optimization. + if (D.hasAttr()) + return false; + if (D.hasAttr()) return true;