Skip to content

Commit 07f10e7

Browse files
Fix emitting DehydratedDataCommand.ZeroFill when alignment is high (#82155)
The alignment might not fit into a single byte.
1 parent 45c314f commit 07f10e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DehydratedDataNode.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
123123
int oldPosition = dehydratedSegmentPosition;
124124
dehydratedSegmentPosition = dehydratedSegmentPosition.AlignUp(o.Alignment);
125125
if (dehydratedSegmentPosition > oldPosition)
126-
builder.EmitByte(DehydratedDataCommand.EncodeShort(DehydratedDataCommand.ZeroFill, dehydratedSegmentPosition - oldPosition));
126+
{
127+
int written = DehydratedDataCommand.Encode(DehydratedDataCommand.ZeroFill, dehydratedSegmentPosition - oldPosition, buff);
128+
builder.EmitBytes(buff, 0, written);
129+
}
127130
}
128131

129132
int currentReloc = 0;

0 commit comments

Comments
 (0)