keep symbols for profile (#39530)
This commit is contained in:
@@ -178,7 +178,8 @@ class AOTSnapshotter {
|
||||
// is resolved.
|
||||
// The DWARF section confuses Xcode tooling, so this strips it. Ideally,
|
||||
// gen_snapshot would provide an argument to do this automatically.
|
||||
if (platform == TargetPlatform.ios && bitcode) {
|
||||
final bool stripSymbols = platform == TargetPlatform.ios && buildMode == BuildMode.release && bitcode;
|
||||
if (stripSymbols) {
|
||||
final IOSink sink = fs.file('$assembly.stripped.S').openWrite();
|
||||
for (String line in fs.file(assembly).readAsLinesSync()) {
|
||||
if (line.startsWith('.section __DWARF')) {
|
||||
@@ -201,12 +202,13 @@ class AOTSnapshotter {
|
||||
final RunResult result = await _buildFramework(
|
||||
appleArch: darwinArch,
|
||||
isIOS: platform == TargetPlatform.ios,
|
||||
assemblyPath: bitcode ? '$assembly.stripped.S' : assembly,
|
||||
assemblyPath: stripSymbols ? '$assembly.stripped.S' : assembly,
|
||||
outputPath: outputDir.path,
|
||||
bitcode: bitcode,
|
||||
);
|
||||
if (result.exitCode != 0)
|
||||
if (result.exitCode != 0) {
|
||||
return result.exitCode;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ void main() {
|
||||
), isNot(0));
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext('iOS debug AOT with bitcode uses right flags', () async {
|
||||
testUsingContext('iOS profile AOT with bitcode uses right flags', () async {
|
||||
fs.file('main.dill').writeAsStringSync('binary magic');
|
||||
|
||||
final String outputPath = fs.path.join('build', 'foo');
|
||||
@@ -204,6 +204,52 @@ void main() {
|
||||
verify(xcode.cc(argThat(contains('-fembed-bitcode')))).called(1);
|
||||
verify(xcode.clang(argThat(contains('-fembed-bitcode')))).called(1);
|
||||
|
||||
final File assemblyFile = fs.file(assembly);
|
||||
expect(assemblyFile.existsSync(), true);
|
||||
expect(assemblyFile.readAsStringSync().contains('.section __DWARF'), true);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext('iOS release AOT with bitcode uses right flags', () async {
|
||||
fs.file('main.dill').writeAsStringSync('binary magic');
|
||||
|
||||
final String outputPath = fs.path.join('build', 'foo');
|
||||
fs.directory(outputPath).createSync(recursive: true);
|
||||
|
||||
final String assembly = fs.path.join(outputPath, 'snapshot_assembly.S');
|
||||
genSnapshot.outputs = <String, String>{
|
||||
assembly: 'blah blah\n.section __DWARF\nblah blah\n',
|
||||
};
|
||||
|
||||
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
|
||||
when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
|
||||
when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
|
||||
|
||||
final int genSnapshotExitCode = await snapshotter.build(
|
||||
platform: TargetPlatform.ios,
|
||||
buildMode: BuildMode.release,
|
||||
mainPath: 'main.dill',
|
||||
packagesPath: '.packages',
|
||||
outputPath: outputPath,
|
||||
darwinArch: DarwinArch.armv7,
|
||||
bitcode: true,
|
||||
);
|
||||
|
||||
expect(genSnapshotExitCode, 0);
|
||||
expect(genSnapshot.callCount, 1);
|
||||
expect(genSnapshot.snapshotType.platform, TargetPlatform.ios);
|
||||
expect(genSnapshot.snapshotType.mode, BuildMode.release);
|
||||
expect(genSnapshot.additionalArgs, <String>[
|
||||
'--deterministic',
|
||||
'--snapshot_kind=app-aot-assembly',
|
||||
'--assembly=$assembly',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'main.dill',
|
||||
]);
|
||||
|
||||
verify(xcode.cc(argThat(contains('-fembed-bitcode')))).called(1);
|
||||
verify(xcode.clang(argThat(contains('-fembed-bitcode')))).called(1);
|
||||
|
||||
final File assemblyFile = fs.file(assembly);
|
||||
final File assemblyBitcodeFile = fs.file('$assembly.stripped.S');
|
||||
expect(assemblyFile.existsSync(), true);
|
||||
@@ -253,9 +299,7 @@ void main() {
|
||||
verifyNever(xcode.clang(argThat(contains('-fembed-bitcode'))));
|
||||
|
||||
final File assemblyFile = fs.file(assembly);
|
||||
final File assemblyBitcodeFile = fs.file('$assembly.bitcode');
|
||||
expect(assemblyFile.existsSync(), true);
|
||||
expect(assemblyBitcodeFile.existsSync(), false);
|
||||
expect(assemblyFile.readAsStringSync().contains('.section __DWARF'), true);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user