mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #634] [MERGED] OLD-8847: restore old upstream PR 8847 - pe_loader: move an image with no relocation directory; refuse only on IMAGE_FILE_RELOCS_STRIPPED #675
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#675
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/634
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:loader-rebase-without-reloc-dir📝 Commits (3)
0ddf806pe_loader: move an image with no relocation directory, refuse only on IMAGE_FILE_RELOCS_STRIPPEDca56a0dpe_loader: a relocation table is applied whatever RELOCS_STRIPPED says (Windows 11 measurement)bb256ebpe_loader: the relocation-move notes stop citing the old pull request number📊 Changes
4 files changed (+113 additions, -10 deletions)
View changed files
📝
runtime/README.md(+7 -1)📝
runtime/src/base_reservation.h(+4 -1)📝
runtime/src/pe_loader.cpp(+14 -8)📝
runtime/test/loader_test.cpp(+88 -0)📄 Description
Claimed in the coordination issue as: OLD-8847 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128926292
Restoration of my original pull request, old upstream PR 8847 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Its two commits are cherry-picked ontomainat21625bca8without conflicts. One extra commit replaces the links to the old PR number, which no longer resolve, with plain text.What and why
Loader::map_imagerefuses any image whose preferred base is taken when the image has no relocation directory (runtime/src/pe_loader.cpp:1428-1431and:1456-1459onmain). Windows only refuses that move whenIMAGE_FILE_RELOCS_STRIPPEDis set. With the flag clear, it moves the image without fix-ups.This PR follows Windows:
mainRELOCS_STRIPPEDsays (the Windows 11 measurement from the original PR's review)main.Tested
main(21625bca8) with only this PR's tests: 99 checks, 2 failed. The two are "an image without relocations, flag clear, moves when its base is taken" and "an image with IMAGE_FILE_RELOCS_STRIPPED is refused when its base is taken".git diff --checkandpython -I scripts/check_no_game_data.pyon the changed files are clean.GPUs tested: n/a (CPU-only loader tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.