Unverified Commit 89d887f3 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Strip debug symbols from ELF library snapshots (#34250)

AOT compiled code is now packaged as an ELF library for Android targets.
By default gen_snapshot's output contains debug symbols.  The symbols could
be stripped as a separate step, but that requires NDK tools that the user
may not have available.

This change passes a gen_snapshot flag that omits the symbols, and it filters
out a warning printed when that flag is used.
parent 6d0e6181
......@@ -63,7 +63,17 @@ class GenSnapshot {
final String hostArch = iosArch == IOSArch.armv7 ? '-i386' : '-x86_64';
return runCommandAndStreamOutput(<String>['/usr/bin/arch', hostArch, snapshotterPath]..addAll(args));
}
return runCommandAndStreamOutput(<String>[snapshotterPath]..addAll(args));
StringConverter outputFilter;
if (additionalArgs.contains('--strip')) {
// Filter out gen_snapshot's warning message about stripping debug symbols
// from ELF library snapshots.
const String kStripWarning = 'Warning: Generating ELF library without DWARF debugging information.';
outputFilter = (String line) => line != kStripWarning ? line : null;
}
return runCommandAndStreamOutput(<String>[snapshotterPath]..addAll(args),
mapFunction: outputFilter);
}
}
......@@ -138,6 +148,7 @@ class AOTSnapshotter {
outputPaths.add(aotSharedLibrary);
genSnapshotArgs.add('--snapshot_kind=app-aot-elf');
genSnapshotArgs.add('--elf=$aotSharedLibrary');
genSnapshotArgs.add('--strip');
} else {
// Blob AOT snapshot.
final String vmSnapshotData = fs.path.join(outputDir.path, 'vm_snapshot_data');
......
......@@ -418,6 +418,7 @@ void main() {
'--deterministic',
'--snapshot_kind=app-aot-elf',
'--elf=build/foo/app.so',
'--strip',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'main.dill',
......@@ -447,6 +448,7 @@ void main() {
'--deterministic',
'--snapshot_kind=app-aot-elf',
'--elf=build/foo/app.so',
'--strip',
'main.dill',
]);
}, overrides: contextOverrides);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment