Revert "[vm, gen_snapshot] Add app-aot-macho-dylib option for AOT snapshots."

This reverts commit 38ef28a058.

Reason for revert: Breaks build on debug mode 32-bit arches,
                   release mode simarm_x64

Issue: https://github.com/dart-lang/sdk/issues/60307
Original change's description:
> [vm, gen_snapshot] Add app-aot-macho-dylib option for AOT snapshots.
>
> This is the initial framework for creating snapshots as Mach-O dynamic
> libraries. Note that this framework is not 100% feature complete
> compared to generating Mach-O snapshots via assembly. In particular,
> the directly-compiled Mach-O dylib does not yet contain compact
> unwinding information.
>
> Other changes:
>
> * Adds UuidCommand to the native_stack_traces package's Mach-O reader,
>   which now appropriately returns the UUID as the build ID for Mach-O
>   shared objects.
>
> * Adds Utils::Basename(path) for portably retrieving the basename
>   from a path. (Returns nullptr for all arguments where it is not
>   currently implemented on Fuchsia or Windows.)
>
> * Adjusts vm/timeline.h to avoid pulling in <mach_o/loader.h> on MacOS,
>   as that interferes with uses of the namespaced Mach-O definitions
>   in platform/mach_o.h.
>
> * Only attempt to dlopen() a snapshot if ELF is the native format
>   for the host platform or the snapshot is not an ELF shared object.
>   If dlopen() is used, report the error message if it fails rather
>   than attempting to manually load the snapshot as an ELF shared object.
>
> * Fix the magic number stored in DylibAppSnapshot for loaded non-ELF
>   dynamic libraries.
>
> * Remove the detection of reverse-endian Mach-O magic numbers in
>   DartUtils::SniffForMagicNumber(), since all our Mach-O related code
>   assumes host-endian Mach-O files and so there's no point other than
>   to give a slightly better error message when failing.
>
> TEST=vm/dart/exported_symbols_test
>      vm/dart/unobfuscated_static_symbols_test
>      vm/dart/use_dwarf_stack_traces_flag_test
>      vm/cc/CanDetectMachOFiles
>
> Issue: https://github.com/dart-lang/sdk/issues/60307
> Change-Id: Idf5b49d6c6d035ab033509613212b95520d65965
> Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-mac-release-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415020
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

Issue: https://github.com/dart-lang/sdk/issues/60307
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-mac-release-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iff2ab4c84a513a184784129f456bd357ae8e3a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431220
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
This commit is contained in:
Tess Strickland
2025-05-27 01:05:48 -07:00
committed by Commit Queue
parent 8ddfcbd396
commit 38ea3a8f5e
37 changed files with 464 additions and 4047 deletions
-3
View File
@@ -1,6 +1,3 @@
## 0.6.1
- Add handling for Mach-O UUID load commands.
## 0.6.1-wip
- Update SDK constraint to `^3.5.0`.
+1 -29
View File
@@ -124,7 +124,6 @@ class LoadCommand {
static const LC_SEGMENT = 0x1;
static const LC_SYMTAB = 0x2;
static const LC_SEGMENT_64 = 0x19;
static const LC_UUID = 0x1b;
static LoadCommand fromReader(Reader reader) {
final start = reader.offset; // cmdsize includes size of cmd and cmdsize.
@@ -140,9 +139,6 @@ class LoadCommand {
case LC_SYMTAB:
command = SymbolTableCommand.fromReader(reader, cmd, cmdsize);
break;
case LC_UUID:
command = UuidCommand.fromReader(reader, cmd, cmdsize);
break;
default:
break;
}
@@ -328,29 +324,6 @@ class SymbolTableCommand extends LoadCommand {
}
}
class UuidCommand extends LoadCommand {
Uint8List uuid;
static const kUuidSize = 16;
UuidCommand._(super.cmd, super.cmdsize, this.uuid) : super._();
static UuidCommand fromReader(Reader reader, int cmd, int cmdsize) {
final uuid = Uint8List.sublistView(
reader.bytes, reader.offset, reader.offset + kUuidSize);
return UuidCommand._(cmd, cmdsize, uuid);
}
String get uuidString => uuid.map((i) => paddedHex(i, 1)).join();
@override
void writeToStringBuffer(StringBuffer buffer) {
buffer
..write('UUID: ')
..write(uuidString);
}
}
class MachOHeader {
final int magic;
final int cputype;
@@ -550,8 +523,7 @@ class MachO extends DwarfContainer {
_symbolTable[constants.isolateSymbolName]?.value;
@override
String? get buildId =>
_commands.whereType<UuidCommand>().firstOrNull?.uuidString;
String? get buildId => null;
@override
DwarfContainerStringTable? get debugStringTable => _debugStringTable;
+2 -2
View File
@@ -1,5 +1,5 @@
name: native_stack_traces
version: 0.6.1
version: 0.6.1-wip
description: Utilities for working with non-symbolic stack traces.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/native_stack_traces
@@ -13,7 +13,7 @@ executables:
dependencies:
args: ^2.0.0
path: ^1.9.0
path: ^1.8.0
# We use 'any' version constraints here as we get our package versions from
# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the