Skip to content

Page-align offset before calculating virtual addresses for ELF - #626

Merged
benfred merged 3 commits into
benfred:masterfrom
andrewjcg:page_align
Jul 31, 2025
Merged

Page-align offset before calculating virtual addresses for ELF#626
benfred merged 3 commits into
benfred:masterfrom
andrewjcg:page_align

Conversation

@andrewjcg

Copy link
Copy Markdown
Contributor

This mimics what ld.so does by aligning the virtual addresses to the current page size, and fixes:

  • Existing issues with DSOs produced by LLD which, unlike gold or BFD, doesn't align p_vaddr to p_align (the previous overflow prevention wasn't sufficient here).
  • Systems w/ configurable page sizes, where just using p_align isn't enough.

This fixes a bug where we were calculating incorrect address offsets.
Comment thread src/binary_parser.rs Outdated
@benfred benfred added the bug Something isn't working label Jul 31, 2025
@benfred
benfred merged commit a3858df into benfred:master Jul 31, 2025
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants