Stop embedding bitcode for iOS in tool (#112831)
This commit is contained in:
@@ -47,43 +47,6 @@ Future<String?> minPhoneOSVersion(String pathToBinary) async {
|
||||
return minVersion;
|
||||
}
|
||||
|
||||
Future<bool> containsBitcode(String pathToBinary) async {
|
||||
// See: https://stackoverflow.com/questions/32755775/how-to-check-a-static-library-is-built-contain-bitcode
|
||||
final String loadCommands = await eval('otool', <String>[
|
||||
'-l',
|
||||
'-arch',
|
||||
'arm64',
|
||||
pathToBinary,
|
||||
]);
|
||||
if (!loadCommands.contains('__LLVM')) {
|
||||
return false;
|
||||
}
|
||||
// Presence of the section may mean a bitcode marker was embedded (size=1), but there is no content.
|
||||
if (!loadCommands.contains('size 0x0000000000000001')) {
|
||||
return true;
|
||||
}
|
||||
// Check the false positives: size=1 wasn't referencing the __LLVM section.
|
||||
|
||||
bool emptyBitcodeMarkerFound = false;
|
||||
// Section
|
||||
// sectname __bundle
|
||||
// segname __LLVM
|
||||
// addr 0x003c4000
|
||||
// size 0x0042b633
|
||||
// offset 3932160
|
||||
// ...
|
||||
final List<String> lines = LineSplitter.split(loadCommands).toList();
|
||||
lines.asMap().forEach((int index, String line) {
|
||||
if (line.contains('segname __LLVM') && lines.length - index - 1 > 3) {
|
||||
emptyBitcodeMarkerFound |= lines
|
||||
.skip(index - 1)
|
||||
.take(4)
|
||||
.any((String line) => line.contains(' size 0x0000000000000001'));
|
||||
}
|
||||
});
|
||||
return !emptyBitcodeMarkerFound;
|
||||
}
|
||||
|
||||
/// Creates and boots a new simulator, passes the new simulator's identifier to
|
||||
/// `testFunction`.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user