Fix Mach-O section metadata and function discovery - #810
Merged
Conversation
Represent zero-fill sections with no file-backed bytes while preserving their virtual size, and publish LC_FUNCTION_STARTS entries through CLE's function-hint interface. Add regression coverage for file-offset containment, ordinary sections, hint ordering, metadata, and rebasing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67ccc324-20c3-4b04-8e9f-0bd97acc31f5
blankwall
force-pushed
the
fix/macho-loader-metadata
branch
from
September 3, 2026 18:12
907a7df to
77e13e2
Compare
Remove the superfluous condition parentheses and narrow the rebased Mach-O test object and optional function-start list for type checking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 67ccc324-20c3-4b04-8e9f-0bd97acc31f5
Member
|
Thanks! |
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filesize == 0while preserving their virtual sizeLC_FUNCTION_STARTSentries through CLE's standardfunction_hintsinterfaceRationale
Mach-O section
sizeis a virtual size.S_ZEROFILL,S_GB_ZEROFILL, andS_THREAD_LOCAL_ZEROFILLoccupy memory but have no file-backed bytes. Passingtheir virtual size as CLE's file size makes them claim unrelated file offsets,
often including offset zero.
CLE already decodes
LC_FUNCTION_STARTS, but previously retained thoseaddresses only in the Mach-O-specific
lc_function_startslist. Publishingthem as source-labeled
FunctionHintentries lets existing CFG consumers usethe linker-provided starts without Mach-O-specific integration.
Validation
pytest -q tests/test_macho.py -k 'not relocatable_object'(14 passed, 1 deselected)image_base_deltaThe deselected test was added to CLE master by #787, but its
relocatable_object.machofixtures are not yet present in the currentangr/binariesmaster.