r287287 - [CUDA] Use the right section and constant names for fatbins when compiling for macos.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 17 16:41:32 PST 2016
Author: jlebar
Date: Thu Nov 17 18:41:31 2016
New Revision: 287287
URL: http://llvm.org/viewvc/llvm-project?rev=287287&view=rev
Log:
[CUDA] Use the right section and constant names for fatbins when compiling for macos.
Reviewers: tra
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D26777
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=287287&r1=287286&r2=287287&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCUDANV.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCUDANV.cpp Thu Nov 17 18:41:31 2016
@@ -289,19 +289,24 @@ llvm::Function *CGNVCUDARuntime::makeMod
continue;
}
+ const char *FatbinConstantName =
+ CGM.getTriple().isMacOSX() ? "__NV_CUDA,__nv_fatbin" : ".nv_fatbin";
+ // NVIDIA's cuobjdump looks for fatbins in this section.
+ const char *FatbinSectionName =
+ CGM.getTriple().isMacOSX() ? "__NV_CUDA,__fatbin" : ".nvFatBinSegment";
+
// Create initialized wrapper structure that points to the loaded GPU binary
llvm::Constant *Values[] = {
llvm::ConstantInt::get(IntTy, 0x466243b1), // Fatbin wrapper magic.
llvm::ConstantInt::get(IntTy, 1), // Fatbin version.
makeConstantString(GpuBinaryOrErr.get()->getBuffer(), // Data.
- "", ".nv_fatbin", 8), //
+ "", FatbinConstantName, 8),
llvm::ConstantPointerNull::get(VoidPtrTy)}; // Unused in fatbin v1.
llvm::GlobalVariable *FatbinWrapper = new llvm::GlobalVariable(
TheModule, FatbinWrapperTy, true, llvm::GlobalValue::InternalLinkage,
llvm::ConstantStruct::get(FatbinWrapperTy, Values),
"__cuda_fatbin_wrapper");
- // NVIDIA's cuobjdump looks for fatbins in this section.
- FatbinWrapper->setSection(".nvFatBinSegment");
+ FatbinWrapper->setSection(FatbinSectionName);
// GpuBinaryHandle = __cudaRegisterFatBinary(&FatbinWrapper);
llvm::CallInst *RegisterFatbinCall = CtorBuilder.CreateCall(
More information about the cfe-commits
mailing list