← Back to Pull requests

Restore dyld image functions and Mach-O headers on iOS #5606

Closed
artile closed this pull request without merging on Oct 16, 2026 21:39 UTC
View on GitHub
artile artile commented on Oct 05, 2026 02:13 UTC
Author

Fixes rust-lang/libc#5601. The Xcode26.5 iPhoneSimulator SDK mach-o/dyld.h60-63 marks these4 functions __API_AVAILABLE(macos(10.1),ios(2.0)); mach-o/loader.h defines both header layouts. Restore only these public APIs/types on iOS, preserving macOS support and leaving unsupported mach_vm APIs restricted. Adds compile/signature/layout regression for iOS+macOS. Observed backtrace0.3.76 failed E0425 for all4 functions with libc0.2.190 when building actual iOS app. This branch is based on0.2.190 to permit downstream git pin; no unrelated bindings changes.

Diff: 37 lines (+31 / -6) across 4 files Reviewer: valentynkit Review duration: 17006m
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.29) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.29 · 37 lines diff across 4 files
0.29
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.74 · 5 substantive comment(s)
0.74
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
80%
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.218
Real PR Conversation Timeline
12 items
rustbot rustbot commented on Oct 05, 2026 02:13 UTC
Contributor

Some changes occurred in an Android module

cc @maurer

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

Some changes occurred in an OpenBSD module

cc @semarie

artile artile commented on Oct 05, 2026 02:14 UTC
Author

Focused Rust1.95.0 checks passed for aarch64-apple-ios-sim and aarch64-apple-ios; macOS apple_dyld integration test passed1/1. Added iOS semver symbol coverage per CONTRIBUTING. @rustbot label stable-nominated

artile artile commented on Oct 05, 2026 02:14 UTC
Author

Retargeted this regression restoration to libc-0.2: it is based on the released0.2.190 API used by consumers. Targeting main(v1.0) produced an unrelated release-branch diff, so this PR intentionally targets the stable branch for a minimal platform restoration. If maintainer policy requires main first, this needs a separately mapped API patch there rather than any0.2->1.0 reversion.

rustbot rustbot commented on Oct 05, 2026 02:14 UTC
Contributor

:warning: Warning :warning:

  • Pull requests are usually filed against the main branch for this repo, but this one is against libc-0.2. Please double check that you specified the right target!
  • trypsynth trypsynth commented on Oct 05, 2026 13:36 UTC
    Contributor

    Just chiming in to say this fixes a very real bug in the wild 🙂 Renovate's routine lock file update moved Paperback (an ebook reader) to libc 0.2.190, and our iOS build promptly fell over with E0425 on all four _dyld_* functions, by way of backtrace 0.3.76. We're holding libc back for now, so thanks for jumping on this, and here's hoping it makes it into 0.2.191!

    valentynkit valentynkit commented on code on Oct 05, 2026 18:20 UTC
    Code Review
    src/unix/bsd/apple/mod.rs:1
    @@ -748,7 +748,7 @@ s2! {
         }
     
         #[exhaustive] // FIXME(exhaustive): review for 1.0
    -    #[cfg(target_os = "macos")]
    +    #[cfg(any(target_os = "macos", target_os = "ios"))]

    Is there any specific reason to keep it gated to macos/ios, instead of making it available on all Apple targets by getting rid of this cfg?

    View changes since the review

    valentynkit valentynkit commented on code on Oct 05, 2026 18:26 UTC
    Code Review
    src/unix/bsd/apple/mod.rs:1
    @@ -748,7 +748,7 @@ s2! {
         }
     
         #[exhaustive] // FIXME(exhaustive): review for 1.0
    -    #[cfg(target_os = "macos")]
    +    #[cfg(any(target_os = "macos", target_os = "ios"))]

    dyld.h doesn't mark these functions unavailable on tvOS/watchOS, the tvOS, watchOS and visionOS SDKs declare them. It specify __API_AVAILABLE but it looks like it sets the minimum version for the macos, ios, not restricting to these platforms, in case of restrictions __API_UNAVAILABLE is used:
    https://github.com/apple-oss-distributions/dyld/blob/dyld-1378/include/mach-o/dyld.h#L166

    madsmtm madsmtm commented on code on Oct 06, 2026 10:16 UTC
    Code Review
    src/unix/bsd/apple/mod.rs:1
    @@ -748,7 +748,7 @@ s2! {
         }
     
         #[exhaustive] // FIXME(exhaustive): review for 1.0
    -    #[cfg(target_os = "macos")]
    +    #[cfg(any(target_os = "macos", target_os = "ios"))]

    Yes, this should not be gated, it's available on tvOS, watchOS and visionOS too.

    madsmtm madsmtm requested changes on Oct 06, 2026 10:18 UTC
    Changes Requested Reviewer

    See also a bit of background in https://github.com/rust-lang/libc/pull/5612#pullrequestreview-5426901503.

    I think this is correct, modulo the cfg-gating, these symbols are available on the other Apple platforms too.

    View changes since this review

    rustbot rustbot commented on Oct 06, 2026 10:18 UTC
    Contributor

    Reminder, once the PR becomes ready for a review, use @rustbot ready.

    tgross35 tgross35 commented on Oct 16, 2026 21:39 UTC
    Contributor

    This PR hasn't been updated with the request, but is unusually formed anyway - the test is redundant and we don't do changelog entries like that. Closing in favor of https://github.com/rust-lang/libc/pull/5636.

    Reviewers
    Assignees
    artile artile
    Labels
    risk: low confidence: 80.7% 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: 29.1% (LOW) · Higher = larger blast radius
    29.1%
    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: 80.7% · Lower = rushed or shallow review
    80.7%
    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: 5.6% · Safe to merge
    5.6%
    Repository