Closed Bug 2072073 Opened 2 months ago Closed 5 days ago

Update to macOS SDK 27.2

Categories

(Firefox Build System :: Toolchains, task)

task

Tracking

(firefox162 fixed)

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: RyanVM, Assigned: RyanVM)

References

(Regressed 1 open bug)

Details

Attachments

(6 external files, 2 obsolete files)

Summary: Upload macOS SDK 27.0 to tooltool → Update to macOS SDK 27.0

This is potentially problematic:

The following items have been deprecated or removed:

  • The minimum supported deployment target on macOS for the C++ standard library has been increased to 11.0.
Depends on: 2075643
Assignee: nobody → ryanvm

"Green" Try push (by our standards):
https://treeherder.mozilla.org/jobs?repo=try&revision=c514db16fadddb8cba877f12742b10838e7849b9

I've also pretty exhaustively tested all the downstream toolchain builds on this also. The only thing I haven't been able to verify are the custom-car jobs which appear to be permafailing for other reasons at the moment.

The macOS 27.0 SDK's linker stubs declare an arm64e.x1 target that ld64.lld rejects as an unknown
architecture, failing every link against the SDK. clang-trunk already has the upstream fix.

The macOS 27.0 SDK applies attribute((stack_protector_ignore)) unconditionally in its os_log macros, which
clang 22 rejects with -Wunknown-attributes. clang 23 and trunk already have it.

The macOS 27 SDK's .tbd stubs list arm64e.x1 targets, which libtapi rejects as an unknown architecture, so
ld64 cannot link against the SDK. PGO/LTO macOS builds still link with ld64. This ports the TextAPI part of
LLVM b8007a8e4020: the architecture table gets a separate name column so the slice can be named arm64e.x1.
libtapi's fallback for arm64 links keeps picking the arm64e slice.

The macOS 27.0 SDK declares pipe2 and dup3, so configure picks them up, but the libSystem of older macOS
releases does not export them; with pipe2 the freshly built python dies in dyld during make libinstall.

libc++ in the macOS 27.0 SDK emits a #warning that deployment targets below 11.0 are no longer supported. We
still target 10.15 on Intel, and #warning is not suppressed in system headers, so this is the only way to keep
-Werror builds and the clang-plugin -verify tests compiling. -Wcpp is clang's alias for -W#warnings; the # in
the canonical spelling gets shell-quoted on its way through cargo build scripts and clang then treats it as a
file name. bindgen does not see the warning flags, so BINDGEN_SYSTEM_FLAGS carries it too. The toolchain
builds get the same flag through macos-setup.sh, build-clang.py and build-llvm-common.sh so their logs stay
readable.

Summary: Update to macOS SDK 27.0 → Update to macOS SDK 27..1
Summary: Update to macOS SDK 27..1 → Update to macOS SDK 27.1
Summary: Update to macOS SDK 27.1 → Update to macOS SDK 27.2
Attachment #9656052 - Attachment description: Bug 2072073 - Backport arm64e.x1 support to clang 22 and 23. r?#firefox-build-system-reviewers → Bug 2072073 - Backport arm64e.x1 support to clang 22. r?#firefox-build-system-reviewers
Attachment #9656055 - Attachment description: Bug 2072073 - Update macOS SDK to 27.0. r?#firefox-build-system-reviewers,#mac-reviewers → Bug 2072073 - Update macOS SDK to 27.2. r?#firefox-build-system-reviewers,#mac-reviewers
Pushed by rvandermeulen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e0cabf73464c https://hg.mozilla.org/integration/autoland/rev/de6392e544f0 Backport arm64e.x1 support to clang 22. r=firefox-build-system-reviewers,sylvestre https://github.com/mozilla-firefox/firefox/commit/ee0de25f8bf7 https://hg.mozilla.org/integration/autoland/rev/8a1c8d80ea1a Backport the stack_protector_ignore attribute to clang 22. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden https://github.com/mozilla-firefox/firefox/commit/254c15b5ac00 https://hg.mozilla.org/integration/autoland/rev/a1bd3b36031e Teach cctools-port's libtapi about arm64e.x1. r=firefox-build-system-reviewers,sergesanspaille https://github.com/mozilla-firefox/firefox/commit/7473b2886dc9 https://hg.mozilla.org/integration/autoland/rev/eb59c86ee05f Update macOS SDK to 27.2. r=firefox-build-system-reviewers,mac-reviewers,sergesanspaille,spohl,ahochheiden https://github.com/mozilla-firefox/firefox/commit/20b9636b76c2 https://hg.mozilla.org/integration/autoland/rev/285c2f681d2f Keep cpython from using pipe2 and dup3 on macOS. r=firefox-build-system-reviewers,sergesanspaille,glandium https://github.com/mozilla-firefox/firefox/commit/ff4d11ecdaf3 https://hg.mozilla.org/integration/autoland/rev/62abfd7bd873 Disable -Wcpp for macOS x86_64 builds. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden
See Also: → 2090905
Blocks: 2090948
No longer blocks: 2090948
Regressions: 2090948

llvm-strip from clang 22 can leave the string table of a stripped Mach-O binary 4-byte aligned. dyld on macOS 27 appears to reject such binaries once they're built against the macOS 27 SDK, which is what kept the 20261109214446 Nightly from starting (bug 2091237). clang 23 already has the fix.

Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1b9ab39f9b43 https://hg.mozilla.org/mozilla-central/rev/c50c88a5a25e Revert "Bug 2072073 - Disable -Wcpp for macOS x86_64 builds. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden" at Stephen Pohl request for causing MacOS nightly balrog issues

Local builds target 10.15 on aarch64 too, so keying the flag on x86_64 missed them.

Attachment #9678467 - Attachment description: Bug 2090948 - Disable -Wcpp for every macOS deployment target below 11.0. r?#firefox-build-system-reviewers → Bug 2072073 - Disable -Wcpp for every macOS deployment target below 11.0. r?#firefox-build-system-reviewers

FYI, we've had to temporarily stop Nightly updates on macOS because of an unfortunate sequence of events. The SDK bump to 27.2 in this bug landed around the same time as the switch to clang 23 in bug 2039813. clang 23 then had to be backed out for performance regressions (bug 2090871), which put our builds back on clang 22. clang 22's llvm-strip has a bug that was only fixed in clang 23: it can leave the string table of a stripped Mach-O binary misaligned. Once our binaries are built with the macOS 27.2 SDK, dyld on macOS 27 appears to reject them, so Nightly failed to start (bug 2091237).

The SDK bump has been backed out. I've added D341230 to this stack, which backports the upstream llvm-objcopy fix to clang 22, so the SDK bump no longer depends on clang 23 landing at the same time. glandium has already accepted it.

I've also moved the follow-up we had to land for the SDK bump (D340913, which disables -Wcpp for every macOS deployment target below 11.0 and was originally in bug 2090948) over to this bug and into the same stack. That way we can land everything at once, as soon as try comes back green and we've verified that the build launches. The updated stack is on try: https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=117287

I pushed the SDK 27.2 stack together with the clang 22 llvm-objcopy backport to try, and the resulting build looks good:

https://treeherder.mozilla.org/jobs?repo=try&revision=e0bc1aaec336

  • All 57 jobs succeeded, including the rebuilt toolchain-linux64-clang-22 and both macOS opt builds.
  • In the build-macosx64-aarch64/opt build, LC_SYMTAB.stroff is 8-byte aligned in XUL, libnss3.dylib, libEGL.dylib, libGLESv2.dylib, libmozavcodec.dylib, libmozavutil.dylib, libmozinference.dylib, libmozglue.dylib and firefox, and dyld_info no longer reports "mis-aligned LINKEDIT string pool" for any of them. These are the files that were misaligned in Nightly 20261109214446 (bug 2091237).
  • The build starts normally on macOS 27.3 (arm64). In Nightly 20261109214446, dyld rejected libnss3.dylib on the same machine.

I've only checked the arm64 opt build. The x86_64 slice and a signed shippable build haven't been checked yet.

Stephen, one wrinkle for the reland: bug 2091029 (on central since this morning) moved the libtapi fetch to the upstream revision that already includes the arm64e.x1 support, so D332002 is redundant now. Your try push predates it (its cctools-port job still applied libtapi-arm64e-x1.patch), and relanding D332002 on current main would re-add a patch that no longer applies.

Since the stack needs updating anyway, I've rebased it onto current main without D332002 and folded D340913 into D332005, which keeps the -Wcpp change in a single patch. Try push: https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=117497

Once that's green I plan to abandon D332002 and D340913 and resubmit the rest, D341230 included, unchanged. Let me know if you have local changes to the stack you'd rather I hold off for.

Attachment #9678467 - Attachment is obsolete: true
Attachment #9656054 - Attachment is obsolete: true
Attachment #9656057 - Attachment description: Bug 2072073 - Disable -Wcpp for macOS x86_64 builds. r?#firefox-build-system-reviewers → Bug 2072073 - Disable -Wcpp for macOS deployment targets below 11.0. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden

(In reply to Ryan VanderMeulen [:RyanVM] from comment #18)

Stephen, one wrinkle for the reland: bug 2091029 (on central since this morning) moved the libtapi fetch to the upstream revision that already includes the arm64e.x1 support, so D332002 is redundant now. Your try push predates it (its cctools-port job still applied libtapi-arm64e-x1.patch), and relanding D332002 on current main would re-add a patch that no longer applies.

Since the stack needs updating anyway, I've rebased it onto current main without D332002 and folded D340913 into D332005, which keeps the -Wcpp change in a single patch. Try push: https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=117497

Once that's green I plan to abandon D332002 and D340913 and resubmit the rest, D341230 included, unchanged. Let me know if you have local changes to the stack you'd rather I hold off for.

Thanks for catching this and your plan sounds good to me. Thank you!

See Also: → 2091305
Blocks: 2091466

The try push from my last comment is green.

I also checked the built binaries for the alignment problem from bug 2091237. In the macosx64/opt, macosx64-aarch64/opt and both shippable builds, every Mach-O's LC_SYMTAB.stroff is 8-byte aligned, in both the arm64 and x86_64 slices. Nightly 20261109214446 had 11 misaligned images in its arm64 slice and 14 in its x86_64 slice. I can't launch anything on macOS 27 myself, so please double-check that side if you get a chance.

The Phabricator stack is updated: D332002 is abandoned, since bug 2091029 already brought in the libtapi change, and D340913 is folded into D332005. From my side it can reland whenever you're comfortable.

To catch this class of problem at build time going forward, bug 2091466 (D341463, in review) makes packaging fail when a stripped Mach-O has a __LINKEDIT layout dyld would reject. On current main it fails the mac opt builds, as expected, and on top of this stack it passes. It depends on this bug landing first.

(In reply to Ryan VanderMeulen [:RyanVM] from comment #20)

The try push from my last comment is green.

I also checked the built binaries for the alignment problem from bug 2091237. In the macosx64/opt, macosx64-aarch64/opt and both shippable builds, every Mach-O's LC_SYMTAB.stroff is 8-byte aligned, in both the arm64 and x86_64 slices. Nightly 20261109214446 had 11 misaligned images in its arm64 slice and 14 in its x86_64 slice. I can't launch anything on macOS 27 myself, so please double-check that side if you get a chance.

The Phabricator stack is updated: D332002 is abandoned, since bug 2091029 already brought in the libtapi change, and D340913 is folded into D332005. From my side it can reland whenever you're comfortable.

To catch this class of problem at build time going forward, bug 2091466 (D341463, in review) makes packaging fail when a stripped Mach-O has a __LINKEDIT layout dyld would reject. On current main it fails the mac opt builds, as expected, and on top of this stack it passes. It depends on this bug landing first.

I have verified the try build on my end as well and can confirm that everything seems correct now. I'm in favor of re-landing these changes soon in order to catch anything else before the merge on the 20th. Thank you!

Pushed by rvandermeulen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/48cabcf157dc https://hg.mozilla.org/integration/autoland/rev/55361990343c Backport arm64e.x1 support to clang 22. r=firefox-build-system-reviewers,sylvestre https://github.com/mozilla-firefox/firefox/commit/41d623415809 https://hg.mozilla.org/integration/autoland/rev/ed306c4c7ee6 Backport the stack_protector_ignore attribute to clang 22. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden https://github.com/mozilla-firefox/firefox/commit/6ac679d0f2f2 https://hg.mozilla.org/integration/autoland/rev/a4fc85c348bd Backport the llvm-objcopy Mach-O LINKEDIT alignment fix to clang 22. r=firefox-build-system-reviewers,glandium https://github.com/mozilla-firefox/firefox/commit/4452f4cd3bc0 https://hg.mozilla.org/integration/autoland/rev/49569fac4100 Update macOS SDK to 27.2. r=firefox-build-system-reviewers,mac-reviewers,sergesanspaille,spohl,ahochheiden https://github.com/mozilla-firefox/firefox/commit/48c96e86fc8e https://hg.mozilla.org/integration/autoland/rev/0bb07f104b31 Keep cpython from using pipe2 and dup3 on macOS. r=firefox-build-system-reviewers,sergesanspaille,glandium https://github.com/mozilla-firefox/firefox/commit/5d4437c4b438 https://hg.mozilla.org/integration/autoland/rev/401155dcbbf7 Disable -Wcpp for macOS deployment targets below 11.0. r=firefox-build-system-reviewers,sergesanspaille,ahochheiden
See Also: → 2091600
Regressions: 2091837
Regressions: 2091237
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: