[PATCH] D48615: [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 26 15:16:46 PDT 2018


tra created this revision.
tra added a reviewer: Hahnfeld.
Herald added subscribers: bixia, jlebar, sanjoy.

That's where CUDA SDK binaries appear to put them on Mac.


https://reviews.llvm.org/D48615

Files:
  clang/lib/CodeGen/CGCUDANV.cpp


Index: clang/lib/CodeGen/CGCUDANV.cpp
===================================================================
--- clang/lib/CodeGen/CGCUDANV.cpp
+++ clang/lib/CodeGen/CGCUDANV.cpp
@@ -389,17 +389,19 @@
     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";
     // NVIDIA's cuobjdump looks for fatbins in this section.
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48615.152979.patch
Type: text/x-patch
Size: 1208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180626/d2b96215/attachment.bin>


More information about the cfe-commits mailing list