Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Lapounov <antonl@microsoft.com>2021-06-24 22:09:36 +0300
committerGitHub <noreply@github.com>2021-06-24 22:09:36 +0300
commit7cb47629a859e24e04431010dcd95d68fa49a035 (patch)
tree35b5e7206aed67692370eeeca910b593c2d0bfec /src/coreclr/tools
parentd4fc723b4982a49deb4a43b5d145cbd667e6077d (diff)
Ensure relocation blocks are 4-byte aligned (#54668)
Diffstat (limited to 'src/coreclr/tools')
-rw-r--r--src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs
index 608ba52d59b..1e02a7868d4 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SectionBuilder.cs
@@ -703,6 +703,13 @@ namespace ILCompiler.PEWriter
/// <param name="offsetsAndTypes">16-bit entries encoding offset relative to the base RVA (low 12 bits) and relocation type (top 4 bite)</param>
private static void FlushRelocationBlock(BlobBuilder builder, int baseRVA, List<ushort> offsetsAndTypes)
{
+ // Ensure blocks are 4-byte aligned. This is required by kernel memory manager
+ // on Windows 8.1 and earlier.
+ if ((offsetsAndTypes.Count & 1) == 1)
+ {
+ offsetsAndTypes.Add(0);
+ }
+
// First, emit the block header: 4 bytes starting RVA,
builder.WriteInt32(baseRVA);
// followed by the total block size comprising this header