Skip to content

ELF: allow DynamicLinks() and RPath() on objects with no .dynamic section - #70

Merged
staticfloat merged 1 commit into
masterfrom
sf/elf-relocatable-dynamic
Nov 16, 2026
Merged

staticfloat merged 1 commit into
masterfrom
sf/elf-relocatable-dynamic

Conversation

@staticfloat

Copy link
Copy Markdown
Collaborator

Relocatable objects (.o, ET_REL) have no .dynamic section, so DynamicLinks(oh) threw MethodError: no method matching ELFDynamicLinks(::Nothing, ...), and RPath(oh), ELFDynEntries(oh) and find_libraries(oh) threw seekstart(::Nothing).

  • ELFDynEntries returns no entries when .dynamic is missing.
  • ELFDynamicLinks and ELFRPath allow section_ref === nothing and store the handle themselves, so handle() (and therefore canonical_rpaths()) still works. The two-argument constructors are kept.
  • StrTab(::ELFDynamicLinks) raises an explicit error when there is no .dynamic section.

The other ELF accessors already handle relocatable objects: Sections, Segments, Symbols, StrTab, ELFVersionData, ELFVersionNeededData, isdynamic and Platform.

Adds test/elfobj/foo.o, a real x86_64 relocatable object generated by test/elfobj/build.sh. The new testset fails on master. With this change the full suite passes on Julia 1.12.7 and 1.6.7.

This is the ELF counterpart of #69.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JnariwhJ27gVWNZnYbst65

…tion

Relocatable objects (`.o`, `ET_REL`) have no `.dynamic` section, so
`DynamicLinks(oh)` threw `MethodError: no method matching
ELFDynamicLinks(::Nothing, ...)` and `RPath(oh)` (and `ELFDynEntries(oh)`,
`find_libraries(oh)`) threw `seekstart(::Nothing)`.

`ELFDynEntries` now returns no entries when `.dynamic` is missing.
`ELFDynamicLinks` and `ELFRPath` allow `section_ref === nothing` and store
the handle themselves, so `handle()` (and therefore `canonical_rpaths()`)
still works. The two-argument constructors are kept.
`StrTab(::ELFDynamicLinks)` raises an explicit error when there is no
`.dynamic` section.

The other ELF accessors already handle relocatable objects: Sections,
Segments (empty), Symbols (.symtab), StrTab, ELFVersionData,
ELFVersionNeededData, isdynamic and Platform.

Adds `test/elfobj/foo.o`, a real x86_64 relocatable object generated by
`test/elfobj/build.sh`.

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

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.41%. Comparing base (3cde0d8) to head (1bbb358).

Files with missing lines Patch % Lines
src/ELF/ELFDynamicLink.jl 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
- Coverage   73.47%   73.41%   -0.06%     
==========================================
  Files          48       48              
  Lines        1587     1591       +4     
==========================================
+ Hits         1166     1168       +2     
- Misses        421      423       +2     

☔ 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 3b3fd92 into master Nov 16, 2026
17 checks passed
@staticfloat
staticfloat deleted the sf/elf-relocatable-dynamic branch November 16, 2026 04:37
@staticfloat staticfloat mentioned this pull request Nov 16, 2026
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