Skip to content

Commit c2dad87

Browse files
committed
add null when assembly gets embedded into the binary
1 parent 616df37 commit c2dad87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@ LogicalResult SelectObjectAttrImpl::embedBinary(
116116
llvm::Module *module = moduleTranslation.getLLVMModule();
117117

118118
// Embed the object as a global string.
119+
// Add null for assembly output for JIT paths that expect null-terminated
120+
// strings.
121+
bool addNull = (object.getFormat() == gpu::CompilationTarget::Assembly);
119122
llvm::Constant *binary = llvm::ConstantDataArray::getString(
120-
builder.getContext(), object.getObject().getValue(), false);
123+
builder.getContext(), object.getObject().getValue(), addNull);
121124
llvm::GlobalVariable *serializedObj =
122125
new llvm::GlobalVariable(*module, binary->getType(), true,
123126
llvm::GlobalValue::LinkageTypes::InternalLinkage,

0 commit comments

Comments
 (0)