From: Artem Belevich Date: Thu, 28 Jun 2018 17:15:52 +0000 (+0000) Subject: [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c9dd21ad722082526b649b2a230ef4ff97d1975;p=clang [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac. That's where CUDA binaries appear to put them. Differential Revision: https://reviews.llvm.org/D48615 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCUDANV.cpp b/lib/CodeGen/CGCUDANV.cpp index f8a7825f0a..b541b1046f 100644 --- a/lib/CodeGen/CGCUDANV.cpp +++ b/lib/CodeGen/CGCUDANV.cpp @@ -389,8 +389,9 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { FatMagic = HIPFatMagic; } else { if (RelocatableDeviceCode) - // TODO: Figure out how this is called on mac OS! - FatbinConstantName = "__nv_relfatbin"; + FatbinConstantName = CGM.getTriple().isMacOSX() + ? "__NV_CUDA,__nv_relfatbin" + : "__nv_relfatbin"; else FatbinConstantName = CGM.getTriple().isMacOSX() ? "__NV_CUDA,__nv_fatbin" : ".nv_fatbin"; @@ -398,8 +399,9 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { FatbinSectionName = CGM.getTriple().isMacOSX() ? "__NV_CUDA,__fatbin" : ".nvFatBinSegment"; - // TODO: Figure out how this is called on mac OS! - ModuleIDSectionName = "__nv_module_id"; + ModuleIDSectionName = CGM.getTriple().isMacOSX() + ? "__NV_CUDA,__nv_module_id" + : "__nv_module_id"; ModuleIDPrefix = "__nv_"; // For CUDA, create a string literal containing the fat binary loaded from