r335880 - [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 28 10:15:52 PDT 2018


Author: tra
Date: Thu Jun 28 10:15:52 2018
New Revision: 335880

URL: http://llvm.org/viewvc/llvm-project?rev=335880&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/CodeGen/CGCUDANV.cpp

Modified: cfe/trunk/lib/CodeGen/CGCUDANV.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCUDANV.cpp?rev=335880&r1=335879&r2=335880&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCUDANV.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCUDANV.cpp Thu Jun 28 10:15:52 2018
@@ -389,8 +389,9 @@ llvm::Function *CGNVCUDARuntime::makeMod
     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::makeMod
     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




More information about the cfe-commits mailing list