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

Side by Side Diff: pydir/szbuild.py

Issue 631383003: Subzero: Fix emission of global initializers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove the -disable-globals option Created 6 years, 2 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 | « no previous file | src/IceClFlags.h » ('j') | tests_lit/llvm2ice_tests/globalinit.pnacl.ll » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import pipes 5 import pipes
6 import re 6 import re
7 import sys 7 import sys
8 8
9 from utils import shellcmd 9 from utils import shellcmd
10 from utils import FindBaseNaCl 10 from utils import FindBaseNaCl
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 llcbin = ( 168 llcbin = (
169 '{root}/toolchain/linux_x86/pnacl_newlib/bin/llc' 169 '{root}/toolchain/linux_x86/pnacl_newlib/bin/llc'
170 ).format(root=nacl_root) 170 ).format(root=nacl_root)
171 opt_level = args.optlevel 171 opt_level = args.optlevel
172 172
173 if args.force or NewerThanOrNotThere(pexe, obj_llc) or \ 173 if args.force or NewerThanOrNotThere(pexe, obj_llc) or \
174 NewerThanOrNotThere(llcbin, obj_llc): 174 NewerThanOrNotThere(llcbin, obj_llc):
175 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } 175 opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' }
176 shellcmd(['pnacl-translate', 176 shellcmd(['pnacl-translate',
177 '-ffunction-sections', 177 '-ffunction-sections',
178 '-fdata-sections',
178 '-c', 179 '-c',
179 '-arch', 'x86-32-linux', 180 '-arch', 'x86-32-linux',
180 '-O' + opt_level_map[opt_level], 181 '-O' + opt_level_map[opt_level],
181 '--pnacl-driver-append-LLC_FLAGS_EXTRA=-externalize', 182 '--pnacl-driver-append-LLC_FLAGS_EXTRA=-externalize',
182 '-o', obj_llc] + 183 '-o', obj_llc] +
183 args.llc_args + 184 args.llc_args +
184 [pexe], 185 [pexe],
185 echo=args.verbose) 186 echo=args.verbose)
186 shellcmd(( 187 shellcmd((
187 'objcopy --redefine-sym _start=_user_start {obj}' 188 'objcopy --redefine-sym _start=_user_start {obj}'
188 ).format(obj=obj_llc), echo=args.verbose) 189 ).format(obj=obj_llc), echo=args.verbose)
189 shellcmd(( 190 shellcmd((
190 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}' 191 'nm {obj} | sed -n "s/.* [a-zA-Z] //p" > {sym}'
191 ).format(obj=obj_llc, sym=sym_llc), echo=args.verbose) 192 ).format(obj=obj_llc, sym=sym_llc), echo=args.verbose)
192 if args.force or NewerThanOrNotThere(pexe, obj_sz) or \ 193 if args.force or NewerThanOrNotThere(pexe, obj_sz) or \
193 NewerThanOrNotThere(llvm2ice, obj_sz): 194 NewerThanOrNotThere(llvm2ice, obj_sz):
194 shellcmd([llvm2ice, 195 shellcmd([llvm2ice,
195 '-O' + opt_level, 196 '-O' + opt_level,
196 '-bitcode-format=pnacl', 197 '-bitcode-format=pnacl',
197 '-disable-globals',
198 '-externalize', 198 '-externalize',
199 '-ffunction-sections', 199 '-ffunction-sections',
200 '-fdata-sections',
200 '-o', asm_sz] + 201 '-o', asm_sz] +
201 args.sz_args + 202 args.sz_args +
202 [pexe], 203 [pexe],
203 echo=args.verbose) 204 echo=args.verbose)
204 shellcmd(( 205 shellcmd((
205 'llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj -o {obj} ' + 206 'llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj -o {obj} ' +
206 '{asm}' 207 '{asm}'
207 ).format(asm=asm_sz, obj=obj_sz), echo=args.verbose) 208 ).format(asm=asm_sz, obj=obj_sz), echo=args.verbose)
208 shellcmd(( 209 shellcmd((
209 'objcopy --redefine-sym _start=_user_start {obj}' 210 'objcopy --redefine-sym _start=_user_start {obj}'
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 # Put the extra verbose printing at the end. 266 # Put the extra verbose printing at the end.
266 if args.verbose: 267 if args.verbose:
267 print 'PATH={path}'.format(path=os.environ['PATH']) 268 print 'PATH={path}'.format(path=os.environ['PATH'])
268 print 'include={regex}'.format(regex=re_include_str) 269 print 'include={regex}'.format(regex=re_include_str)
269 print 'exclude={regex}'.format(regex=re_exclude_str) 270 print 'exclude={regex}'.format(regex=re_exclude_str)
270 print 'default_match={dm}'.format(dm=default_match) 271 print 'default_match={dm}'.format(dm=default_match)
271 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) 272 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms))
272 273
273 if __name__ == '__main__': 274 if __name__ == '__main__':
274 main() 275 main()
OLDNEW
« no previous file with comments | « no previous file | src/IceClFlags.h » ('j') | tests_lit/llvm2ice_tests/globalinit.pnacl.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698