Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oso_prefix paths #347

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Fix oso_prefix paths #347

merged 1 commit into from
Sep 30, 2024

Commits on Sep 30, 2024

  1. Fix oso_prefix paths

    When bazel executions actions in the sandbox, pwd is a path like this:
    
    ```
    /private/var/tmp/_bazel_ksmiley/92410d0e3373f265902564b48493ac12/sandbox/darwin-sandbox/8/execroot/_main
    ```
    
    Inside this directory are the inputs, which are symlinks to outside of
    this pwd:
    
    ```
    /private/var/tmp/_bazel_ksmiley/92410d0e3373f265902564b48493ac12/sandbox/darwin-sandbox/1/execroot/_main/bazel-out/darwin_arm64-dbg/bin/_objs/main/main.o -> /private/var/tmp/_bazel_ksmiley/92410d0e3373f265902564b48493ac12/execroot/_main/bazel-out/darwin_arm64-dbg/bin/_objs/main/main.o
    ```
    
    ld64 resolves the absolute path to this object file, including resolving
    symlinks, _before_ it strips the -oso_prefix argument. Because of this
    the previous `__BAZEL_EXECUTION_ROOT__` replacement, which was the
    sandbox pwd, isn't actually a prefix of the canonicalized object file
    path, leading to -oso_prefix being a no-op, and absolute paths ending up
    in the binary.
    
    I think many folks didn't see this locally because it's common for Apple
    projects to disable sandboxing for local development for perf reasons,
    and that's when you're likely to have this debug info in the binary in
    the first place.
    
    With this change we add a new substitution that calculates the
    sandbox-independent prefix and passes that along instead.
    keith committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    dbf738b View commit details
    Browse the repository at this point in the history