diff options
author | Justin Lebar <jlebar@google.com> | 2016-11-18 00:41:31 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-11-18 00:41:31 +0000 |
commit | d14fe8830e16c5d17bbd9e277e69e8044097b00e (patch) | |
tree | 38173606abe6b788001559d809d960ec8146442a | |
parent | f91086b0a88e672ff5a796855057fc313fd10f7d (diff) | |
download | bcm5719-llvm-d14fe8830e16c5d17bbd9e277e69e8044097b00e.tar.gz bcm5719-llvm-d14fe8830e16c5d17bbd9e277e69e8044097b00e.zip |
[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
llvm-svn: 287287
-rw-r--r-- | clang/lib/CodeGen/CGCUDANV.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp index dacc53b16e1..b598330abe4 100644 --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -289,19 +289,24 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() { 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( |