The former contents of the VM isolate are now included into each isolate group. This makes each isolate group's heap independent, and in particular allows each heap to be allocated to a separate pointer cage (not done in this CL).
The duplicated stubs that allowed PC relative calls are removed, since the originals can now be the target of PC relative calls.
The bootstrapping needing to load an AppJIT or AppAOT snapshot is reduced to allocating the oddballs. The code is entirely dropped in the AOT runtime, but the JIT runtime still has it to allow for flags to affect the compilation of the stub code. Further refactoring might be able to remove this for the JIT runtime too, with only gen_snapshot knowing how to bootstrap.
Class serialization no longer distinguishes predefined classes.
The page containing null is marked as never-evacuate. null, false and true must not move because the compiler relies on their low bits having certain patterns for some optimizations. (Previously, the entire VM isolate heap never moved.)
Compaction is disabled for IA32. Due to register pressure, some stub calls must not use a scratch register and embed the address of Code.
The page containing the call-through-safepoint stub is frozen when running with --write-protect-code and the stub is created at runtime (instead of loaded from an AppJIT or AppAOT snapshot). This stub must remain executable even during a safepoint, as a foreign call might during return during a safepoint and only block after the stub directs it to the runtime.
The snapshot symbols are renamed to kDartSnapshotData and kDartSnapshotText. There is no need to distinguish the VM isolate's snapshot, and snaphots are per isolate group not per isolate. Aliases with the old names are added to ease migration.
Some global flags that were automatically set based on the VM isolate's snapshot are now isolate group flags and automatically set by the isolate group's snapshot.
TEST=ci
Change-Id: Iee82016057d609112e9b021d178fc3d4d18b5044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Currently, the common prefix and suffix can end up being larger than one
of the two strings, if the other string has extra content that matches
the portion in the overlap. For example, in JSON output, there might be
a missing } in a run of consecutive }s when closing JSON outputs. (Or,
more likely thanks to our infrastructure for generating JSON outputs,
that the expected string has an extra }.) In this case, the returned
mismatches are empty, making it hard to discern what went wrong.
This CL fixes that by limiting the common suffix to be no larger than
the portion of the smaller string after the common prefix.
Also add handling in the case where the two strings are equal (here,
returning the escaped string in the prefix and leaving the other outputs
empty), though this shouldn't happen since this function is only called
when the null-terminated strings are not equal.
TEST=ci (manual testing on while working on CL 450381)
Change-Id: I52140f32bd44d7e31cf6ba97d862a89ac0568f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499221
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Currently, the failure message for EXPECT_STREQ just prints the
(escaped) expected and actual strings on failure, but if the
expected and actual strings are mostly the same, it can be difficult
to determine what the difference actually is.
Instead, do a bit of work to find the common prefix and suffix of
the expected and actual strings, so that the actual difference is
more apparent. If the lengths of the common prefix and suffix
combined is considered too short to separately print them, then
the output is the same as before.
TEST=ci (failure output change only, so tested with
vm/cc/SourceReport_Coverage output on vm-dyn-linux-debug-x64)
Change-Id: Iecaacde6ebf6628643bdf1440c6d77d4ff6599af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495980
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
When uploading to the App Store, the program must contain an
LC_ENCRYPTION_INFO segment in the Mach-O header so the App Store
can appropriately modify it for its purposes without changing the
header size and/or offsets/addresses in the rest of the shared object.
By default, the load command is only added to iOS snapshots, but
it can be added to any Mach-O snapshot using the --macho-encryptable
command line option.
TEST=vm/dart/use_macho_options_test
Cq-Include-Trybots: luci.dart.try:vm-aot-mac-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-linux-debug-x64-try
Change-Id: I4e79fd9cfb9ba9d49707ec209eca3fee1cefc28c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This change fixes the following gcc build errors:
```
../../runtime/vm/simulator_arm.cc:1403:44: error: ‘function’ attribute directive ignored [-Werror=attributes]
1403 | int32_t r4) {
| ^
../../runtime/vm/simulator_arm.cc:1417:47: error: ‘function’ attribute directive ignored [-Werror=attributes]
1417 | double d1) {
| ^
cc1plus: note: unrecognized command-line option ‘-Wno-unused-private-field’ may have been intended to silence earlier diagnostics
cc1plus: all warnings being treated as errors
```
It looks like gcc doesn't support [[no_sanitize("function")]]
attribute, so limit its usage to clang.
TEST=ci
Change-Id: Id054970b9970dd1bf9fec78e97b4dbed5fd12c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471521
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
- copy sanitizer runtime when using ubsan;
- avoid use of winnt.h CONTAINING_RECORD since it triggers ubsan "member access within null-pointer of type" error, use our copy which uses `offsetof`;
- have default virtual destructor in `ValueObject` to avoid ubsan complains about "insufficient space for an object of type 'dart:ValueObject'" at NoTemporaryAllocator use/declaration site;
- have virtual destructor in ZoneAllocated to avoid ubsan complains about "not having enough space to allocate object" at new RegExpEmpty() instantiation site;
- avoid using crashpad with ubsan as it causes dartvm to exit with error code 3;
- switch to windows, mac-friendly `[[gnu::no_sanitize(check)]]` from `__GNUC__` and `__has_feature` checks.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/62267
Change-Id: I8b922a8da329af276d4cefaa88fb841cc0457124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469840
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Inform ASAN and MSAN about reads and writes through FFI pointers or external typed data. Previously we only informed MSAN about writes, which was enough to prevent false positives in foreign code, but gave false negatives for Dart code. This mostly uses the same machinery used for TSAN, and replaces some of the existing MSAN unpoison calls.
Also fixes some marshalling of compounds by value that generate loads extending past the end of the compound.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/62221
Change-Id: Ia3573edb5a0aec32b6a57035a63e8f323a655ecc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467401
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
MSVC/arm64 cross-build on x64 fails with errors
runtime\platform\unwinding_records.h(256): error C2607: static assertion failed
It is incorrect to validate consistency between O/S structure (host
declaration) and Dart VM structure (target declaration) in case of
a mismatch between host and target.
TEST=ci
Change-Id: Icd2729656ce51088010c192308733896ce40a1b1
Cq-Include-Trybots: luci.dart.try:vm-msvc-win-arm64-try,vm-msvc-win-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463401
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In order to appropriately generate .dSYMs for a snapshot and allow
the strip tool to be used on the snapshot afterwards, add a mode that
not only outputs the snapshot (sans DWARF information) but also
an associated relocatable object file that contains the program's DWARF
information. That allows dsymutil to retrieve the DWARF information
from the relocatable object when run on the snapshot prior to stripping.
To specify that the relocatable object file should be output, use
the new --macho-object command line argument to gen_snapshot
to specify where the object file should be written.
This CL also adds an additional command line argument,
--macho-reduce-padding, which reduces the alignment used for segments
and the text/const sections in Mach-O outputs from 16KB to 64 bytes.
The larger padding is needed for some uses, like non-native loading
of Mach-O objects, but can be elided for other uses like Flutter builds.
TEST=vm/dart/use_dwarf_stack_traces_flag_test
vm/dart/use_macho_reduce_padding_flag_test
Change-Id: I2bf4bacb70c41299b8b6fdb7635c2374acf7a07d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457420
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This should allow Dart to start targeting Fuchsia API level 28.
TEST=ci
Bug: b/434220174
Change-Id: Id55deb491122be85d9a5731be2c7571b0126dcd8
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448260
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Call __tsan_func_entry/__tsan_func_exit in functions that use __tsan_read/__tsan_write or call other functions. Call __tsan_func_exit once per frame when unwinding for exceptions. Do so only in AOT, since TSAN won't be able to symbolize JIT functions anyway.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/61352
Cq-Include-Trybots: luci.dart.try:vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try
Change-Id: Ie52c978c25664d78b834e9b72ecf7eb2a12cc2ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444181
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Sanitizers can pickup configuration and suppressions via
special symbols in the binary (e.g. __*_default_suppressions and
__*_default_options). We have a bunch of stale files in the
buildroot which showed how to do it, but none of these were
actually used by the build process.
Update our BUILDCONFIG.gn to actually link this code into
the binaries and clean it up leaving behind only one relevant
suppression for TSAN.
Additionally fix libplatform targets - libdart_platform_no_tsan was
accidentally disabling TSAN for the whole libplatform by adding
no_tsan_config into public_configs instead of extra_configs.
This is needed to unblock landing https://dart-review.googlesource.com/c/sdk/+/444983
TEST=manually with the referenced CL to verify that suppressions work
Cq-Include-Trybots: luci.dart.try:vm-tsan-linux-release-x64-try,vm-tsan-linux-release-arm64-try
Change-Id: Id4e8a5b89c665cf5d89b18c4f5881ef31c3c9396
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445941
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Adds the following command line options to gen_snapshot:
* --macho-install-name: The name to use as the install name for the
dynamic library (used in the LC_ID_DYLIB and LC_CODE_SIGNATURE
load commands). If not provided, the output filename is used.
* --[no-]macho-linker-signature: Whether or not gen_snapshot should
generate an ad-hoc linker-signed signature. Defaults to true.
The following command line option is macOS/iOS-specific:
* --macho-rpath: Comma-delimited run paths that should be added at
runtime to the current run path used for finding @rpath-prefixed
dynamic libraries.
Adds support to parsing rpath and dylib load commands to
pkg/native_stack_traces's Mach-O parser in order to test the
command line options appropriately.
TEST=vm/dart/use_macho_options
Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I17618578a7bff7851a88cdaf27f299f058f98dd3
Cq-Include-Trybots: luci.dart.try:vm-aot-mac-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-linux-debug-arm64-try,vm-aot-linux-debug-x64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-linux-release-arm64-try,vm-aot-win-release-arm64-try,vm-aot-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Existing Monitor is not reentrable, doesn't support acquiring it if it is already acquired by this thread.
TEST=ReentrantMonitorAllowsReentrance
Change-Id: Id74479388a99ca907bca6e379c3a7e08191e841b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436542
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
* Disable RX workarounds on simulators: they cause host OS to crash;
* Remove Mac OS test for RX workarounds: it can cause host OS to crash;
* Remove old outdated code paths for OS versions that don't
need workarounds.
* Add code which detects whether workaround worked or not by intercepting EXC_BAD_ACCESS.
* Avoid using vm_remap in FFI callbacks when JITing, it does not work.
Instead restore old logic which manually copies page content, but adjust
FFI callbacks implementation to respect possible dual mapping.
This reworks changes done in commit
d194fcecaf after additional testing on a
wider range of hardware.
TEST=manually on physical devices and simulators
Change-Id: I339379386183c532fec25e88fa436ff0b970c2cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435120
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
For other architectures, a __eh_frame section is generated like
for non-MacOS platforms.
TEST=vm/dart/unwinding_information_test
Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I46c6ff1357c222f73a129e1becd9b12b3fb6ef9c
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,vm-aot-linux-release-simarm_x64-try,vm-gcc-linux-try,vm-ubsan-linux-release-arm64-try,vm-aot-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433020
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Adding this allows dsymutil to parse a DebugMap from the Mach-O file,
which allows it to then create an appropriate .dSYM package for the
dylib if desired.
TEST=vm/dart/unobfuscated_static_symbols_test
Cq-Include-Trybots: luci.dart.try:vm-aot-mac-release-arm64-try,vm-aot-linux-release-simarm_x64-try
Bug: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I723fde90b73d74e06840418c693858f5729cea58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434381
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Heap references always point into R/RW mapping (this simplifies the
marker) and entry points are retargeted into RX.
To simplify implementation we assume that there are no image pages
created - which means we can always go from Instructions to the start of
the page and check where it is dual mapped to.
TEST=vm/dart/macos_dual_mapping_smoke_test and manually on physical
device
Change-Id: Idbe02b7b695b3c048072cf92f7d062f5ab6e1beb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433940
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
The Mach-O writer puts the unwinding records in a __unwind_info
section, so just find the appropriate section and use its contents
instead of forcing it to be at the end of the segment's memory space.
Create an overload of UnwindingRecordsPlatform::RegisterExecutableMemory
that takes a pointer to the start of the unwinding records for use by
the Mach-O loader.
Add __unwind_info for any executable segments that are not the text
segment as well.
Instead of testing host/target windows plus 64-bit arch, use the
defines provided by platform/unwinding_records.h in the Mach-O
writer and the ELF and Mach-O loaders.
TEST=ci on Windows trybots
Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: Iee53c6725a681f44ac98ed9c9aecf1b75853ece5
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-gcc-linux-try,vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try,vm-win-release-x64-try,vm-win-release-arm64-try,vm-aot-win-debug-arm64-try,vm-win-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432960
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Factor out the .eh_frame section content generation from ElfWriter,
putting in as a static method in Dwarf instead.
Create a __eh_frame section in the __TEXT section of non-MacOS Mach-O
snapshots with the same information as .eh_frame in ELF snapshots.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I4e123f586e59e1263385c838b755c1575a6330eb
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,vm-linux-debug-ia32-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-release-simarm_x64-try,vm-gcc-linux-try,vm-ubsan-linux-release-arm64-try,vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try,vm-win-release-x64-try,vm-win-release-arm64-try,vm-aot-win-debug-arm64-try,vm-win-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431600
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Adds a Mach-O loader, similar to the existing ELF loader, that
can be used on platforms that do not support loading Mach-O dynamic
libraries via dlopen().
Other changes:
* Renames the --force-load-elf-from-memory command line argument
to --force-load-from-memory.
* Use CPU_TYPE_ANY and CPU_SUBTYPE_ANY for architectures that do
not have specific constants in <mach/machine.h> (e.g., RISCV),
as the snapshot header check after loading also catches architecture
mismatches.
* Emit the unwinding information at the end of the text segment
for Windows Mach-O snapshots as is done for ELF ones.
TEST=vm/dart/unobfuscated_static_symbols_test
vm/dart/use_dwarf_stack_traces_flag_test
Issue: https://github.com/dart-lang/sdk/issues/60307
Change-Id: I34a2a334f47d18d5c4f4a712956e71fd0ac94024
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,vm-linux-debug-ia32-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-release-simarm_x64-try,vm-gcc-linux-try,vm-ubsan-linux-release-arm64-try,vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try,vm-win-release-x64-try,vm-win-release-arm64-try,vm-aot-win-debug-arm64-try,vm-win-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430100
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This is a reland of commit 38ef28a058
Fixes:
* Fix comparisons in ASSERT_EQUAL statements on 32-bit architectures.
* Take simulated architectures into account when deciding whether
to use dlopen() for native shared object formats.
* Fix struct/field name collision for GCC.
* Use CPU_TYPE_ANY/CPU_SUBTYPE_ANY for architectures that do not
have more specific cpu_type_t/cpu_subtype_t constants defined.
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>
TEST=vm/dart/exported_symbols_test
vm/dart/unobfuscated_static_symbols_test
vm/dart/use_dwarf_stack_traces_flag_test
vm/cc/CanDetectMachOFiles
ci on trybots that failed on the original CL
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,vm-linux-debug-ia32-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-release-simarm_x64-try,vm-gcc-linux-try,vm-ubsan-linux-release-arm64-try
Change-Id: Iaffea0ddc6173100c8b5b2a9fe46c45f4f611a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431240
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
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 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>
Attempting to use the native definition when available causes problems
when cross-compiling, and the original attempts to avoid this broke in
subtle ways. Instead, just make a non-native definition that mimics
the native definition and use that with reinterpret_casts when sending
uses of the non-native definition to Windows API calls that expect
a value of the native definition.
TEST=windows ci
Fixes: https://github.com/dart-lang/sdk/issues/60771
Change-Id: I347fcaf8cccd809a3d8e6f041cc7e360b0b8226e
Cq-Include-Trybots: luci.dart.try:vm-aot-win-release-arm64-try,vm-aot-win-release-x64-try,vm-win-release-arm64-try,vm-win-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,pkg-win-release-try,pkg-win-release-arm64-try,dart-sdk-win-try,dart-sdk-win-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430400
Reviewed-by: Slava Egorov <vegorov@google.com>