← Back to Pull requests

staticdata: load the statically linked sysimage without dlsym #62884

Closed
unknown closed this pull request without merging on Sep 26, 2026 14:58 UTC
View on GitHub
unknown unknown commented on Aug 26, 2026 18:56 UTC
Author

Follow-up to #62868. When libjulia-internal is built as a static library (JL_LIBRARY_STATIC, see #62868) the system image is linked into the same binary, so its symbols can be resolved by the static linker instead of being looked up through the dynamic linker.

Previously the static build still dlopened the sysimage path given on the command line (or the default ../lib/julia/sys.so) before consulting the linked image, so a static executable could not start without a sys.so on disk, and jl_options.image_file kept naming that file.

Changes:

  • The image symbols (jl_image_pointers, jl_system_image_checksum, jl_system_image_data, jl_system_image_size) are referenced through a JL_IMAGE_SYM macro. The static build resolves them directly against the linked-in sysimage, ignoring the handle entirely; the shared build resolves them through jl_dlsym exactly as before.

  • jl_preload_sysimg / jl_set_sysimg_so short-circuit to the linked image in the static build and record the binary containing it as jl_options.image_file (so Base.julia_cmd() sees a real file). Any -J on the command line is ignored. Package images cannot be loaded into a statically linked libjulia-internal, so the static build asserts !is_pkgimage in get_image_buf; the shared build's pkgimage path, including the libjulia-internal consistency check, is unchanged.

  • The image.base computation is factored into jl_image_base, which takes the address of the image's jl_image_pointers (the static path has no handle). It still uses dli_fbase (and the module handle on Windows) as before. Note that for a non-PIE main executable dli_fbase differs from the link-map l_addr that debuginfo.cpp keys on; the JIT is not expected to work with a static libjulia-internal, so this is left alone.

  • null_sysimage.c is removed: the shared build no longer references jl_image_unpack, and its declaration in processor.h is now guarded by JL_LIBRARY_STATIC.
  • Tested: full build + stdlib precompile (exercises the pkgimage dlsym path), the precompile test suite, and make -C src usr/lib/libjulia-internal.a (nothing under JL_LIBRARY_STATIC is built by the default targets or CI). nm shows staticdata.static.o with U references to the five image symbols and no jl_image_unpack definition in the archive or in libjulia-internal.so.

    Split images (--output-o + --output-ji) are only produced for package images, which are always dlopened, so linking one into a static binary is not supported; the static archive's direct references to jl_system_image_data/jl_system_image_size make that fail at link time.

    This pull request was written with the assistance of generative AI (Claude Code).

    Diff: 340 lines (+255 / -85) across 4 files Reviewer: xal-0 Review duration: 44402m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 340 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #62884"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.3% (MEDIUM) · Higher = larger blast radius
    42.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%