Add support for producing unstripped AOT snapshots. (#75243)

This commit is contained in:
Vyacheslav Egorov
2021-02-02 18:16:04 +01:00
committed by GitHub
parent 44d5950d27
commit 4ba26191ea
3 changed files with 84 additions and 3 deletions

View File

@@ -137,9 +137,20 @@ class AOTSnapshotter {
final List<String> genSnapshotArgs = <String>[
'--deterministic',
];
// We strip snapshot by default, but allow to suppress this behavior
// by supplying --no-strip in extraGenSnapshotOptions.
bool shouldStrip = true;
if (extraGenSnapshotOptions != null && extraGenSnapshotOptions.isNotEmpty) {
_logger.printTrace('Extra gen_snapshot options: $extraGenSnapshotOptions');
genSnapshotArgs.addAll(extraGenSnapshotOptions);
for (final String option in extraGenSnapshotOptions) {
if (option == '--no-strip') {
shouldStrip = false;
continue;
}
genSnapshotArgs.add(option);
}
}
final String assembly = _fileSystem.path.join(outputDir.path, 'snapshot_assembly.S');
@@ -147,17 +158,19 @@ class AOTSnapshotter {
genSnapshotArgs.addAll(<String>[
'--snapshot_kind=app-aot-assembly',
'--assembly=$assembly',
'--strip'
]);
} else {
final String aotSharedLibrary = _fileSystem.path.join(outputDir.path, 'app.so');
genSnapshotArgs.addAll(<String>[
'--snapshot_kind=app-aot-elf',
'--elf=$aotSharedLibrary',
'--strip'
]);
}
if (shouldStrip) {
genSnapshotArgs.add('--strip');
}
if (platform == TargetPlatform.android_arm || darwinArch == DarwinArch.armv7) {
// Use softfp for Android armv7 devices.
// This is the default for armv7 iOS builds, but harmless to set.