Skip to content

gh-149800: Fix macOS universal2 build of perf trampoline#150365

Closed
eendebakpt wants to merge 2 commits into
python:mainfrom
eendebakpt:fix-universal2-trampoline
Closed

gh-149800: Fix macOS universal2 build of perf trampoline#150365
eendebakpt wants to merge 2 commits into
python:mainfrom
eendebakpt:fix-universal2-trampoline

Conversation

@eendebakpt
Copy link
Copy Markdown
Contributor

@eendebakpt eendebakpt commented May 24, 2026

Address failing JIT CI, see https://github.com/python/cpython/actions/runs/26343871355/job/77550446716?pr=150324

Claude analysis:

After splitting the perf trampoline into per-architecture .S files in #149894, PY_CORE_CFLAGS still carries -arch arm64 -arch x86_64 on universal2 builds, so each per-arch object becomes a fat Mach-O whose wrong-arch slice is empty (thanks to the #ifdef guards in the sources). lipo -create then refused to merge two fat inputs sharing both architectures:

fatal error: lipo: Python/asm_trampoline_aarch64.o and
Python/asm_trampoline_x86_64.o have the same architectures (x86_64)
and can't be in the same fat output file

Extract the matching slice from each per-arch object with lipo -thin before recombining into asm_trampoline_universal2.o.

The PR #149894 passed because it did not trigger jit builds.

Marking as DO-NOT-MERGE until someone can verify the above is correct.

After splitting the perf trampoline into per-architecture .S files,
PY_CORE_CFLAGS still carries `-arch arm64 -arch x86_64` on universal2
builds, so each per-arch object becomes a fat Mach-O whose wrong-arch
slice is empty (thanks to the `#ifdef` guards in the sources). `lipo
-create` then refused to merge two fat inputs sharing both
architectures:

    fatal error: lipo: Python/asm_trampoline_aarch64.o and
    Python/asm_trampoline_x86_64.o have the same architectures (x86_64)
    and can't be in the same fat output file

Extract the matching slice from each per-arch object with `lipo -thin`
before recombining into `asm_trampoline_universal2.o`.
@ned-deily
Copy link
Copy Markdown
Member

Looks like @pablogsal was a couple of minutes ahead of you: duplicate of #150364

@eendebakpt
Copy link
Copy Markdown
Contributor Author

Looks like @pablogsal was a couple of minutes ahead of you: duplicate of #150364

Yeah, he beat me by a minute. I'll close this one, his approach is similar to this one.

@eendebakpt eendebakpt closed this May 24, 2026
@ned-deily
Copy link
Copy Markdown
Member

Thanks for jumping on it!

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