Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4173601

Browse files
authored
Add tool to create multi-arch iOS gen_snapshot (#4948)
This adds create_macos_gen_snapshot.py, which can be used to generate a multi-architecture (x86_64, i386) gen_snapshot fat binary. The resulting binary can then be run in the desired mode using: /usr/bin/arch -i386 path/to/gen_snapshot /usr/bin/arch -x86_64 path/to/gen_snapshot When creating AOT snapshots for iOS, running as an i386 binary will generate armv7 code, whereas running as an x86_64 binary will generate arm64 code. The primary user of this script is the build bot.
1 parent 0122d58 commit 4173601

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python
2+
# Copyright 2018 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
import argparse
7+
import subprocess
8+
import sys
9+
import os
10+
11+
12+
def main():
13+
parser = argparse.ArgumentParser(description='Creates multi-arch gen_snapshot')
14+
15+
parser.add_argument('--dst', type=str, required=True)
16+
parser.add_argument('--arm64-out-dir', type=str, required=True)
17+
parser.add_argument('--armv7-out-dir', type=str, required=True)
18+
19+
args = parser.parse_args()
20+
21+
fat_gen_snapshot = os.path.join(args.dst, 'gen_snapshot')
22+
arm64_gen_snapshot = os.path.join(args.arm64_out_dir, 'clang_x64', 'gen_snapshot')
23+
armv7_gen_snapshot = os.path.join(args.armv7_out_dir, 'clang_x86', 'gen_snapshot')
24+
25+
if not os.path.isfile(arm64_gen_snapshot):
26+
print 'Cannot find x86_64 (arm64) gen_snapshot at', arm64_gen_snapshot
27+
return 1
28+
29+
if not os.path.isfile(armv7_gen_snapshot):
30+
print 'Cannot find i386 (armv7) gen_snapshot at', armv7_gen_snapshot
31+
return 1
32+
33+
subprocess.call([
34+
'lipo',
35+
arm64_gen_snapshot,
36+
armv7_gen_snapshot,
37+
'-create',
38+
'-output',
39+
fat_gen_snapshot,
40+
])
41+
42+
43+
if __name__ == '__main__':
44+
sys.exit(main())
45+

0 commit comments

Comments
 (0)