Skip to content

Commit

Permalink
Don't align code segment
Browse files Browse the repository at this point in the history
This wasn't aligned to begin with. Attempting to align it causes problems
due to the way CodeWriter gets the code RVA - it computes the RVA
from the CLI Header length, which doesn't take into account the code's
alignment requirements.
  • Loading branch information
sbomer committed Jan 6, 2023
1 parent 51e9386 commit 9410f1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Mono.Cecil.PE/ImageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ void BuildTextMap ()
{
var map = text_map;

map.AddMap (TextSegment.Code, metadata.code.length, !pe64 ? 4 : 16);
map.AddMap (TextSegment.Code, metadata.code.length);
map.AddMap (TextSegment.Resources, metadata.resources.length, 8);
map.AddMap (TextSegment.Data, metadata.data.length, metadata.data.BufferAlign);
if (metadata.data.length > 0)
Expand Down

0 comments on commit 9410f1e

Please sign in to comment.