Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: build/toolchain/gcc_ar_wrapper.py

Issue 2815453004: For building v8 using gn on aix_ppc64, linux_s390x and linux_ppc64. (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/toolchain/aix/BUILD.gn ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runs the 'ar' command after removing its output file first. 6 """Runs the 'ar' command after removing its output file first.
7 7
8 This script is invoked like: 8 This script is invoked like:
9 python gcc_ar_wrapper.py --ar=$AR --output=$OUT $OP $INPUTS 9 python gcc_ar_wrapper.py --ar=$AR --output=$OUT $OP $INPUTS
10 to do the equivalent of: 10 to do the equivalent of:
(...skipping 22 matching lines...) Expand all
33 help='Load plugin') 33 help='Load plugin')
34 parser.add_argument('--resource-whitelist', 34 parser.add_argument('--resource-whitelist',
35 help='Merge all resource whitelists into a single file.', 35 help='Merge all resource whitelists into a single file.',
36 metavar='PATH') 36 metavar='PATH')
37 parser.add_argument('operation', 37 parser.add_argument('operation',
38 help='Operation on the archive') 38 help='Operation on the archive')
39 parser.add_argument('inputs', nargs='+', 39 parser.add_argument('inputs', nargs='+',
40 help='Input files') 40 help='Input files')
41 args = parser.parse_args() 41 args = parser.parse_args()
42 42
43 if args.resource_whitelist: 43 # Specifies the type of object file ar should examine.
44 whitelist_candidates = wrapper_utils.ResolveRspLinks(args.inputs) 44 # The ar on linux ignores this option.
45 wrapper_utils.CombineResourceWhitelists( 45 object_mode = []
46 whitelist_candidates, args.resource_whitelist) 46 if sys.platform.startswith('aix'):
47 # The @file feature is not avaliable on ar for AIX.
48 # For linux (and other posix like systems), the @file_name
49 # option reads the contents of file_name as command line arguments.
50 # For AIX we must parse these (rsp files) manually.
51 # Read rspfile.
52 args.inputs = wrapper_utils.ResolveRspLinks(args.inputs)
53 object_mode = ['-X64']
54 else:
55 if args.resource_whitelist:
56 whitelist_candidates = wrapper_utils.ResolveRspLinks(args.inputs)
57 wrapper_utils.CombineResourceWhitelists(
58 whitelist_candidates, args.resource_whitelist)
47 59
48 command = [args.ar, args.operation] 60 command = [args.ar] + object_mode + [args.operation]
49 if args.plugin is not None: 61 if args.plugin is not None:
50 command += ['--plugin', args.plugin] 62 command += ['--plugin', args.plugin]
51 command.append(args.output) 63 command.append(args.output)
52 command += args.inputs 64 command += args.inputs
53 65
54 # Remove the output file first. 66 # Remove the output file first.
55 try: 67 try:
56 os.remove(args.output) 68 os.remove(args.output)
57 except OSError as e: 69 except OSError as e:
58 if e.errno != os.errno.ENOENT: 70 if e.errno != os.errno.ENOENT:
59 raise 71 raise
60 72
61 # Now just run the ar command. 73 # Now just run the ar command.
62 return subprocess.call(wrapper_utils.CommandToRun(command)) 74 return subprocess.call(wrapper_utils.CommandToRun(command))
63 75
64 76
65 if __name__ == "__main__": 77 if __name__ == "__main__":
66 sys.exit(main()) 78 sys.exit(main())
OLDNEW
« no previous file with comments | « build/toolchain/aix/BUILD.gn ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698