Skip to content

MachO: allow DynamicLinks() on objects with no LC_LOAD_DYLIB commands - #69

Merged
staticfloat merged 1 commit into
masterfrom
sf/macho-no-dylibs
Nov 16, 2026
Merged

staticfloat merged 1 commit into
masterfrom
sf/macho-no-dylibs

Conversation

@staticfloat

Copy link
Copy Markdown
Collaborator

MachODynamicLinks(::MachOLoadCmds) passed findall()'s result straight to the inner constructor, which requires a Vector{MachOLoadCmdRef{H,MachOLoadDylibCmd{H}}}. When a Mach-O file has no LC_LOAD_DYLIB commands (object files, dSYM DWARF companions), findall() returns an untyped empty vector, and DynamicLinks(oh) throws a MethodError. This PR converts the result to the concrete element type.

It also adds a Mach-O object fixture, test/macobj/foo.o, built with clang by test/macobj/build.sh, plus tests for it. Without the fix, the new test fails with the MethodError. The full suite passes locally on Julia 1.12.7 and 1.6.7.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jnarj2GtE4M4S1QpHNC3Ei

`MachODynamicLinks(::MachOLoadCmds)` passed `findall()`'s result straight to
the inner constructor, which requires a `Vector{MachOLoadCmdRef{H,
MachOLoadDylibCmd{H}}}`.  When a file has no dylib load commands (object files,
dSYM DWARF companions), `findall()` returns an untyped empty vector, and the
call throws a `MethodError`.  Convert the result to the concrete element type.

Adds a Mach-O object fixture (with its build script) and tests for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnarizMR2SWPhSLsrSZ2WM
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.47%. Comparing base (e5de92b) to head (f2ca7a6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #69   +/-   ##
=======================================
  Coverage   73.47%   73.47%           
=======================================
  Files          48       48           
  Lines        1587     1587           
=======================================
  Hits         1166     1166           
  Misses        421      421           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@staticfloat
staticfloat merged commit 3cde0d8 into master Nov 16, 2026
17 checks passed
@staticfloat
staticfloat deleted the sf/macho-no-dylibs branch November 16, 2026 03:03
staticfloat referenced this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant