Skip to content

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Oct 10, 2025

Since approximately MacOS 15, the dynamic loader changes the format of the TLV thunk, breaking our resolution code.

Here we use the new format when we detect the new loader.

This is not a regression of the new TLS resolution code. This targets 8.5, but this needs to be backported to 8.3.

Some background: https://github.com/apple-oss-distributions/dyld/blob/9307719dd8dc9b385daa412b03cfceb897b2b398/libdyld/ThreadLocalVariables.h#L46. Since MacOS 15, the dynamic loader patches the data emitted by the compiler, so that its format changes from

struct Thunk {
    void *func;
    size_t module;
    size_t offset;
}

to

struct Thunk_v2 {
     void *func;
     uint32_t module;
     uint32_t offset;
     // other fields
}

which has the same size, but not the same layout.

Possible alternative fixes:

cc @shivammathur

@arnaud-lb arnaud-lb marked this pull request as ready for review October 10, 2025 13:12
@arnaud-lb arnaud-lb requested a review from dstogov as a code owner October 10, 2025 13:12
@shivammathur
Copy link
Member

@arnaud-lb
CI on macOS 15 x86_64 with this patch looks good.
https://github.com/shivammathur/php-src/actions/runs/18404705136/job/52441925613

We run 8.1 and above in the nightly CI run, so this would have to be backported to 8.1 I think.

@arnaud-lb
Copy link
Member Author

I'm not sure we can fix this in 8.1 and 8.2 since these are security-fixes only. But I'm not sure what other options we have, other than skipping JIT tests (or not building JIT) on macos 15 for these versions in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants