From 84e518eed634e936a13c6fe1293ee0b858d548c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tom=C3=A1=C5=A1=20Rylek?= Date: Fri, 21 Dec 2018 05:40:38 +0100 Subject: [PATCH] Fix "harmless" bug in ZapImport - use AppendByte to emit fixup type (dotnet/coreclr#21621) During my work on the CPAOT compiler I found out that in the past I had believed we should use the compressed uint signature encoding for emitting fixup types. This place may have contributed to my mistake. I have audited all places in CoreCLR where signatures are decoded and in all cases the fixup type is assumed to be a byte, not a signature-compressed uint. As I said, the bug is harmless (after all, Crossgen works) because the enum code of READYTORUN_FIXUP_Helper is less than 128 and for values 0-127 the compressed uint encoding is identical with the byte value; I however believe it's useful to make this change nonetheless for the sake of code clarity and to help avoid future confusions similar to mine. Commit migrated from https://github.com/dotnet/coreclr/commit/b1e2c668693b7905709db90ff829584826134ce0 --- src/coreclr/src/zap/zapimport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/src/zap/zapimport.cpp b/src/coreclr/src/zap/zapimport.cpp index 5e1a42c..d3010af 100644 --- a/src/coreclr/src/zap/zapimport.cpp +++ b/src/coreclr/src/zap/zapimport.cpp @@ -2289,7 +2289,7 @@ ZapImport * ZapImportTable::GetHelperImport(ReadyToRunHelper helperNum) { SigBuilder sigBuilder; - sigBuilder.AppendData(ENCODE_READYTORUN_HELPER); + sigBuilder.AppendByte(ENCODE_READYTORUN_HELPER); sigBuilder.AppendData(helperNum); pImport->SetBlob(GetBlob(&sigBuilder)); -- 2.7.4