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

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

Issue 2190813002: Add LC_ALL=C to gcc linker wrappers to speed up links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: target linker step onnly Created 4 years, 4 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/gcc_link_wrapper.py ('k') | no next file » | 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 'ld -shared' and generates a .TOC file that's untouched when unchanged. 6 """Runs 'ld -shared' and generates a .TOC file that's untouched when unchanged.
7 7
8 This script exists to avoid using complex shell commands in 8 This script exists to avoid using complex shell commands in
9 gcc_toolchain.gni's tool("solink"), in case the host running the compiler 9 gcc_toolchain.gni's tool("solink"), in case the host running the compiler
10 does not have a POSIX-like shell (e.g. Windows). 10 does not have a POSIX-like shell (e.g. Windows).
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 help='Output table-of-contents file', 93 help='Output table-of-contents file',
94 metavar='FILE') 94 metavar='FILE')
95 parser.add_argument('--output', 95 parser.add_argument('--output',
96 required=True, 96 required=True,
97 help='Final output shared object file', 97 help='Final output shared object file',
98 metavar='FILE') 98 metavar='FILE')
99 parser.add_argument('command', nargs='+', 99 parser.add_argument('command', nargs='+',
100 help='Linking command') 100 help='Linking command')
101 args = parser.parse_args() 101 args = parser.parse_args()
102 102
103 # Work-around for gold being slow-by-default. http://crbug.com/632230
104 fast_env = dict(os.environ)
105 fast_env['LC_ALL'] = 'C'
106
103 # First, run the actual link. 107 # First, run the actual link.
104 result = subprocess.call(CommandToRun(args.command)) 108 result = subprocess.call(CommandToRun(args.command), env=fast_env)
105 if result != 0: 109 if result != 0:
106 return result 110 return result
107 111
108 # Next, generate the contents of the TOC file. 112 # Next, generate the contents of the TOC file.
109 result, toc = CollectTOC(args) 113 result, toc = CollectTOC(args)
110 if result != 0: 114 if result != 0:
111 return result 115 return result
112 116
113 # If there is an existing TOC file with identical contents, leave it alone. 117 # If there is an existing TOC file with identical contents, leave it alone.
114 # Otherwise, write out the TOC file. 118 # Otherwise, write out the TOC file.
115 UpdateTOC(args.tocfile, toc) 119 UpdateTOC(args.tocfile, toc)
116 120
117 # Finally, strip the linked shared object file (if desired). 121 # Finally, strip the linked shared object file (if desired).
118 if args.strip: 122 if args.strip:
119 result = subprocess.call(CommandToRun([args.strip, '--strip-unneeded', 123 result = subprocess.call(CommandToRun([args.strip, '--strip-unneeded',
120 '-o', args.output, args.sofile])) 124 '-o', args.output, args.sofile]))
121 125
122 return result 126 return result
123 127
124 128
125 if __name__ == "__main__": 129 if __name__ == "__main__":
126 sys.exit(main()) 130 sys.exit(main())
OLDNEW
« no previous file with comments | « build/toolchain/gcc_link_wrapper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698