Fix WriteCompressedInt32 endianness on big-endian hosts #985

Open
medhatiwari wants to merge 1 commit from medhatiwari/fix-compressed-int32-be-jbevain into master
medhatiwari commented 2026-09-01 01:30:26 -05:00 (Migrated from github.com)

Same fix as https://github.com/dotnet/cecil/pull/517.

Cecil's WriteUInt16/WriteUInt32 are always little-endian. WriteCompressedInt32 copied SRM's IsLittleEndian check, so on big-endian hosts compressed ints in portable PDBs are byte-swapped. That breaks ILLink on native s390x.

Always ReverseEndianness before those writes. New test asserts spec bytes (-100 → BF39, -9076 → DFFFB919).

Made with Cursor

Same fix as https://github.com/dotnet/cecil/pull/517. Cecil's WriteUInt16/WriteUInt32 are always little-endian. WriteCompressedInt32 copied SRM's IsLittleEndian check, so on big-endian hosts compressed ints in portable PDBs are byte-swapped. That breaks ILLink on native s390x. Always ReverseEndianness before those writes. New test asserts spec bytes (-100 → BF39, -9076 → DFFFB919). Made with [Cursor](https://cursor.com)
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'medhatiwari/fix-compressed-int32-be-jbevain:medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'medhatiwari/fix-compressed-int32-be-jbevain'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'medhatiwari/fix-compressed-int32-be-jbevain'
git rebase 'master'
git switch 'master'
git merge --ff-only 'medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'medhatiwari/fix-compressed-int32-be-jbevain'
git rebase 'master'
git switch 'master'
git merge --no-ff 'medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'master'
git merge --squash 'medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'master'
git merge --ff-only 'medhatiwari/fix-compressed-int32-be-jbevain'
git switch 'master'
git merge 'medhatiwari/fix-compressed-int32-be-jbevain'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-jbevain/cecil!985
No description provided.