loader_test, test_pe_loader_bounds and unimplemented_policy_test build relocation-less images fixed at
0x140000000..0x1a0000000. Under arm64 Wine (CrossOver on Apple Silicon) the process's own allocations sit at
0x100000000 and up and macOS maps its shared region at 0x180000000 (RT-22), so the loader rejected those images
with "preferred base is taken" before the checks ran: loader stopped after 31 checks with 3 failures,
pe_loader_bounds failed 13 checks and unimplemented_policy failed.
New test/free_image_base.h: on Windows it returns the constants unchanged. Under Wine (ntdll exports
wine_get_version) it moves the whole 0x140000000..0x200000000 span to a free window picked top-down, away from
the heap, so each constant keeps its offset and images loaded together still get different bases. The init
image reads its TLS callback addresses from its own ImageBase instead of a constant.
AI-assisted. No game files.
Data directories past NumberOfRvaAndSizes were read anyway (only the
exception directory checked the count), so stale bytes there were parsed
as import, delay-import, export or relocation tables. And resolve_forwarder
range-checked the ordinal before adding each digit, so '#65537' passed and
was cast to ordinal 1. The hand-built test images now declare their 16
directories.
Every image went to the fixed %TEMP%\leonida_pe_bounds_test, so two copies
running at once (two build trees, parallel CI jobs on one runner, several
ctest runs on one PC) overwrote each other's pe_bound_N.bin and deleted
the folder under each other at exit. The loser failed with "not an MZ
image", or case 4 loaded the other process's HIGHLOW image and saw a
delta that didn't fit. pe_loader_test and loader_tls_test already add the
process id; this does the same. LEONIDA_TEST_DIR still wins.
Loader::load threw "unsupported relocation type 3" on
IMAGE_REL_BASED_HIGHLOW, which the x64 Windows loader applies: 32-bit
absolute addresses, as /LARGEADDRESSAWARE:NO code has. They are now
moved by the delta like DIR64 ones. Where the moved address no longer
fits in 32 bits, Windows would truncate it; the loader refuses the image
with "a 32-bit (HIGHLOW) relocation does not fit at this base" instead.
Other 32-bit forms (HIGH, LOW, HIGHADJ) stay unsupported.
test_pe_loader_bounds.cpp was never built: it had no CMake target. It
now has one and runs under ctest as pe_loader_bounds (its existing 37
checks pass as they are). Five new checks build an image with a HIGHLOW
entry: the dword moves by exactly the delta, an address past 4 GiB is
refused, and HIGH is still rejected by name. Against the old loader,
three of them fail with "unsupported relocation type 3".