Skip to content

PE: Read base relocations without pefile. - #887

Merged
ltfish merged 2 commits into
masterfrom
perf/pe-raw-base-relocs
Nov 12, 2026
Merged

ltfish merged 2 commits into
masterfrom
perf/pe-raw-base-relocs

Conversation

@ltfish

@ltfish ltfish commented Nov 12, 2026

Copy link
Copy Markdown
Member

No description provided.

pefile builds several objects per base relocation entry; on OUTLOOK.EXE (234k entries) the parse
took 1.1-1.5 s and registering the relocations another 0.8 s. Reading the blocks directly and
resolving the relocation class once per type takes both down to 0.15 s. The reader keeps pefile's
stopping rules, and the relocations are identical on all 129 PE binaries in the test corpus.
A HIGHADJ entry's following slot holds the low 16 bits of the 32-bit value, but the backend
passed the entry's own address as the low half. The value is also now computed like the Windows
loader does (signed low half, rounded to the nearest high half) and written as 16 bits instead
of 32, which clobbered the next two bytes.
@ltfish ltfish self-assigned this Nov 12, 2026
@angr-bot

Copy link
Copy Markdown
Member

Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_887

@ltfish
ltfish merged commit 26d5f2b into master Nov 12, 2026
17 of 20 checks passed
@ltfish
ltfish deleted the perf/pe-raw-base-relocs branch November 12, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants