From c53bdf2dab079903a56e7e3a8d352319985c6d89 Mon Sep 17 00:00:00 2001 From: Daeho Ro <40587651+daeho-ro@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:17:21 -0700 Subject: [PATCH] mach_o: support two level namespace Closes https://github.com/dart-lang/sdk/pull/63116 GitOrigin-RevId: 8eb01fcda0586e02ec659285b357412e044b823c Change-Id: I85a2baaa046d207fe1b928043e1e479d3a74a3d2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493000 Reviewed-by: Ryan Macnak Reviewed-by: Nate Biggs Commit-Queue: Nate Biggs --- runtime/platform/mach_o.h | 2 ++ runtime/vm/mach_o.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/platform/mach_o.h b/runtime/platform/mach_o.h index bae6943287c..1c5e5f7030a 100644 --- a/runtime/platform/mach_o.h +++ b/runtime/platform/mach_o.h @@ -103,6 +103,8 @@ static constexpr uint32_t MH_DYLDLINK = 0x4; // The object file does not re-export any of its input dynamic // libraries. static constexpr uint32_t MH_NO_REEXPORTED_DYLIBS = 0x100000; +// The object file uses two-level namespace bindings. +static constexpr uint32_t MH_TWOLEVEL = 0x80; struct load_command { // The tag that specifies the load command for the following diff --git a/runtime/vm/mach_o.cc b/runtime/vm/mach_o.cc index cd8340e6f44..b16b84a3257 100644 --- a/runtime/vm/mach_o.cc +++ b/runtime/vm/mach_o.cc @@ -1932,7 +1932,7 @@ class MachOHeader : public MachOContents { uint32_t flags() const { if (type_ == SnapshotType::Snapshot) { return mach_o::MH_NOUNDEFS | mach_o::MH_DYLDLINK | - mach_o::MH_NO_REEXPORTED_DYLIBS; + mach_o::MH_NO_REEXPORTED_DYLIBS | mach_o::MH_TWOLEVEL; } ASSERT(type_ == SnapshotType::DebugInfo || type_ == SnapshotType::Object); return 0;