Repository navigation
feat(elf): inspect exports without section headers - #9083
Conversation
Use the dynamic segment and hash tables to enumerate exports when an ELF image has no dynamic symbol section. Preserve symbol coverage, version qualifications, and typed failures through the existing native export path.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no new actionable issues remain. SummaryAdds ELF export inspection through
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Admitted ELF directory"] --> B{"SHT_DYNSYM present?"}
B -->|Yes| C["Read section-backed tables"]
B -->|No| D["Read PT_DYNAMIC declarations"]
D --> E["Map tables through PT_LOAD and read hash count"]
E --> F{"Count established?"}
F -->|No| G["Unsupported coverage"]
F -->|Yes| H["Shared symbol and name reader"]
C --> H
H --> I["Exports with complete or partial coverage"]
Reviews (11) · Last reviewed commit: "fix(native): integrate sectionless expor..." · Reviewed by Greptile |
Integrate the upstream version-index correction in morluto#9100. The old dynamic-table test excluded a defined global symbol solely because its GNU version index was zero. Check both global and weak symbols as unversioned exports, and keep a local-binding control that must stay excluded.
|
TL;DR: I ran the PR's 2 changed test files on Node 22.23.4, 24.22.1 and 26.12.1. All 24 tests passed on each version. The head is 44 commits behind main, and I did not merge with main. Edit (20 Nov): I ran the new head, 313c00a, in a VM, and the results are here.
The two files are The PR changes 8 files against the merge base f912a68. Two are test files and 6 are others. CI on head 80f92c4, read live with
The head is 48 commits behind main c78c8ae. Not runTest setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/native/exports/ElfDynamicExportTables.test.ts tests/boundary/filesystem/nativeExportsSectionless.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
Integrate main a8527d4 while keeping the sectionless export fallback. Unify table selection as a tagged result so compressed section tables retain their unsupported inventory and table_unavailable issue before projection. Validation: all 96 selected native export parser and filesystem tests pass on Node 24.22.1 with repository-locked dependencies and the repository Vitest configuration. The automatic merge reproduced four compressed-table regressions before this fix. Full repository CI remains pending.
|
Merged The merge also exposed a regression in the compressed ELF section-table path: the relocated table-selection helper tried to return a complete inventory and referenced an out-of-scope Validation on the published tree: all 96 tests across |
Move dynamic table parsing with the native domain parsers, retain duplicate-section and reserved-symbol policies, and update the filesystem identity regression.
|
Updated the branch in The dynamic helper and tests move with the native parsers into All 110 tests in the four parser/dynamic-table/filesystem suites passed, including three new reserved-name cases. Scoped TypeScript 7.0.2 checking, changed-file lint/format, test discovery and diff checks also passed (lint warnings remain). Local checks used a small dependency installation with Node 24.22.1, Vitest 5.0.3 and Zod 4.6.6; complete locked-install/build/check/docs coverage remains with CI on this head, currently queued. The PR description now distinguishes this validation from the earlier revisions. Compatibility with #9063 at |
Use the supported compact profile in the Windows environment-spelling regression. Keep the exact environment assertion so a duplicate uppercase key still fails, and retain separate coverage rejecting the removed full profile.
|
The inherited Windows Kimi fixture blocker is fixed in The update only changes the fixture to the supported Ready for final maintainer review and merge if the change looks good. |
|
Integrated main Exact-head validation passed with Node 24.22.1 / npm 11.16.0 and locked The published head is mergeable again; upstream required checks are pending. The PR body records current and historical validation separately. |
Preserve sectionless export enumeration while forwarding the current ELF name budget and retaining checked section-table ranges and shared symbol widths. Signed-off-by: Afloat <[email protected]>
Preserve the dynamic export fallback while adopting the admitted ELF directory and shared image projection from current main. Keep synchronous, cooperative, and Android JNI consumers on the same directory facts.
|
TL;DR: I ran the 2 changed test files from PR #9083 on head 313c00a. All 27 tests passed on Node 22.23.4, 24.22.1 and 26.12.1. The head is 32 commits behind main 3e3faf2, and I did not test a merge. Findings
The 2 files are On head 313c00a, GitHub reports mergeable
Not runTest setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/native/elfDynamicExportTables.test.ts tests/boundary/filesystem/nativeExportsSectionless.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
3377efd to
313c00a
Compare
gensokyo-dev
left a comment
There was a problem hiding this comment.
Verified on current main: 101 focused tests pass, and the sectionless boundary regression fails without the change. PT_DYNAMIC symbols are counted only from DT_HASH/DT_GNU_HASH through admitted PT_LOAD mappings, conflicting counts are refused, and unresolved versions stay partial. Fresh CI is green. Thanks.
Summary
Inspect ELF exports when no usable
SHT_DYNSYMsection exists but program headers describe a readable dynamic table. ReadPT_DYNAMIC, translate addresses through admitted file-backedPT_LOADmappings, and derive the symbol count fromDT_HASHorDT_GNU_HASH. Reuse existing symbol selection, decoding, inventory limits and output schemas; section-backed ELF and PE retain their existing paths.An indeterminate count remains unsupported; conflicting counts or malformed declarations produce typed failures. Version indices and hidden flags are retained, but unresolved version definition/requirement names are marked partial. The tool description and binary diagnostics guide document these limits.
Current integration and validation
Head:
313c00ad693f0cbd70b0e0b7257befa808216925(2026-11-20).Integrated main
c0ee832a30, including #12416's shared cooperative ELF directory.parseElfExportsFromDirectoryStepsnow consumes the already-admitted directory; the shared ELF image helper andNativeExportsProviderare identical to main. The fallback qualification and resource limits are retained.With Node 24.22.1 / npm 11.16.0 and ordinary locked
npm ci:npm run check:fast(typecheck, lint, architecture guards),npm run docs:check(all 8 README consistency tests), formatting of all 7 changed files andgit diff --checkpassed.ee1d2e4d2637e1b55a27fd258a3e7e623d2965cfexactly matches the validated candidate.Regression and earlier evidence
readelf --use-dynamic --symbols --wide. Names, values, sizes, types, bindings and visibility agreed. The first three returned two complete exports; the versioned fixture returned three, preserved index 2 and marked the unresolved name partial. No target was executed.SHT_DYNSYM; a sectionless-only implementation returned zero exports. Regression evidence.fullto supportedcompact, preserving lowercase-only environment assertions. Before/after validation reproduced the failure and passed 75 tests; four focused Windows controls also caught an injected duplicate uppercase key.Validation limits
Local runs did not exercise provider runtime integrations or the optional full
check:prgate. The expanded, separate Windows Kimi suite had one unchanged POSIX-slash expectation fail (28/29 passed); that file is outside the curated Windows lane. Real-library comparisons establish static inventory behavior, not execution or general ELF coverage.Author readiness
Human owner: @Afloat16