[vm] Output accompaning relocatable object for Mach-O snapshots.
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 commit is contained in:
committed by
Commit Queue
parent
18e6ccadc3
commit
bc021bbc01
@@ -4175,6 +4175,58 @@ Dart_CreateAppAOTSnapshotAsBinary(Dart_AotBinaryFormat format,
|
||||
const char* identifier,
|
||||
const char* path);
|
||||
|
||||
/**
|
||||
* Creates a precompiled snapshot along with a relocatable object file.
|
||||
* - A root library must have been loaded.
|
||||
* - Dart_Precompile must have been called.
|
||||
*
|
||||
* Outputs both a snapshot and a relocatable object file in
|
||||
* the specified binary format defining the symbols
|
||||
* - _kDartVmSnapshotData
|
||||
* - _kDartVmSnapshotInstructions
|
||||
* - _kDartIsolateSnapshotData
|
||||
* - _kDartIsolateSnapshotInstructions
|
||||
* Whether or not the snapshot is stripped, the relocatable object file
|
||||
* contains all debugging information.
|
||||
*
|
||||
* The shared library should be dynamically loaded by the embedder.
|
||||
* Running this snapshot requires a VM compiled with DART_PRECOMPILED_RUNTIME.
|
||||
* The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to
|
||||
* Dart_Initialize. The kDartIsolateSnapshotData and
|
||||
* kDartIsolateSnapshotInstructions should be passed to Dart_CreateIsolate.
|
||||
*
|
||||
* The callback will be invoked one or more times to provide the binary output.
|
||||
*
|
||||
* If stripped is true, then the binary output will not include DWARF
|
||||
* debugging sections.
|
||||
*
|
||||
* If debug_callback_data is provided, debug_callback_data will be used with
|
||||
* the callback to provide separate debugging information.
|
||||
*
|
||||
* The identifier should be an appropriate string for identifying the resulting
|
||||
* dynamic library. For example, the identifier is used in ID_DYLIB and
|
||||
* CODE_SIGNATURE load commands for Mach-O dynamic libraries and for DW_AT_name
|
||||
* in the Dart progam's root DWARF compilation unit.
|
||||
*
|
||||
* The path should be the full path of the resulting relocatable object file.
|
||||
* Currently, it is only used in Mach-O relocatable object files and snapshots
|
||||
* to create an appropriate N_OSO symbolic debugging variable
|
||||
* so dsymutil can be used. Note that an external strip utility is needed to
|
||||
* remove the N_OSO symbolic debugging variable after dsymutil usage.
|
||||
*
|
||||
* \return A valid handle if no error occurs during the operation.
|
||||
*/
|
||||
DART_EXPORT DART_API_WARN_UNUSED_RESULT Dart_Handle
|
||||
Dart_CreateAppAOTSnapshotAndRelocatableObject(
|
||||
Dart_AotBinaryFormat format,
|
||||
Dart_StreamingWriteCallback callback,
|
||||
void* snapshot_callback_data,
|
||||
void* object_callback_data,
|
||||
bool stripped,
|
||||
void* debug_callback_data,
|
||||
const char* identifier,
|
||||
const char* path);
|
||||
|
||||
/**
|
||||
* Like Dart_CreateAppAOTSnapshotAsAssembly, but only includes
|
||||
* kDartVmSnapshotData and kDartVmSnapshotInstructions. It also does
|
||||
|
||||
Reference in New Issue
Block a user