Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 # IMPORTANT NOTE: If you make local mods to this file, you must run: | 6 # IMPORTANT NOTE: If you make local mods to this file, you must run: |
| 7 # % pnacl/build.sh driver | 7 # % pnacl/build.sh driver |
| 8 # in order for them to take effect in the scons build. This command | 8 # in order for them to take effect in the scons build. This command |
| 9 # updates the copy in the toolchain/ tree. | 9 # updates the copy in the toolchain/ tree. |
| 10 # | 10 # |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 'STRIP_MODE' : 'none', | 33 'STRIP_MODE' : 'none', |
| 34 | 34 |
| 35 'STRIP_FLAGS' : '--do-not-wrap ${STRIP_FLAGS_%STRIP_MODE%}', | 35 'STRIP_FLAGS' : '--do-not-wrap ${STRIP_FLAGS_%STRIP_MODE%}', |
| 36 'STRIP_FLAGS_all' : '-s', | 36 'STRIP_FLAGS_all' : '-s', |
| 37 'STRIP_FLAGS_debug': '-S', | 37 'STRIP_FLAGS_debug': '-S', |
| 38 | 38 |
| 39 'OPT_INLINE_THRESHOLD': '100', | 39 'OPT_INLINE_THRESHOLD': '100', |
| 40 'OPT_LEVEL': '', # Default opt is 0, but we need to know if it's explicitly | 40 'OPT_LEVEL': '', # Default opt is 0, but we need to know if it's explicitly |
| 41 # requested or not, since we don't want to propagate | 41 # requested or not, since we don't want to propagate |
| 42 # the value to TRANSLATE_FLAGS if it wasn't explicitly set. | 42 # the value to TRANSLATE_FLAGS if it wasn't explicitly set. |
| 43 'OPT_FLAGS': '-O${#OPT_LEVEL ? ${OPT_LEVEL} : 0} ${OPT_STRIP_%STRIP_MODE%} ' + | 43 'OPT_LTO_FLAGS': '-std-link-opts -disable-internalize', |
|
jvoung - send to chromium...
2013/03/21 21:23:37
might also want to leave a comment on why -disable
| |
| 44 'OPT_FLAGS': '${#OPT_LEVEL && !OPT_LEVEL == 0 ? ${OPT_LTO_FLAGS}} ${OPT_STRIP_ %STRIP_MODE%} ' + | |
|
jvoung - send to chromium...
2013/03/21 21:17:05
80 cols
| |
| 44 '-inline-threshold=${OPT_INLINE_THRESHOLD} ' + | 45 '-inline-threshold=${OPT_INLINE_THRESHOLD} ' + |
| 45 '--do-not-wrap', | 46 '--do-not-wrap', |
| 46 'OPT_STRIP_none': '', | 47 'OPT_STRIP_none': '', |
| 47 'OPT_STRIP_all': '-disable-opt --strip', | 48 'OPT_STRIP_all': '-disable-opt --strip', |
| 48 'OPT_STRIP_debug': '-disable-opt --strip-debug', | 49 'OPT_STRIP_debug': '-disable-opt --strip-debug', |
| 49 | 50 |
| 50 'TRANSLATE_FLAGS': '${PIC ? -fPIC} ${!STDLIB ? -nostdlib} ' + | 51 'TRANSLATE_FLAGS': '${PIC ? -fPIC} ${!STDLIB ? -nostdlib} ' + |
| 51 '${STATIC ? -static} ' + | 52 '${STATIC ? -static} ' + |
| 52 '${SHARED ? -shared} ' + | 53 '${SHARED ? -shared} ' + |
| 53 '${#SONAME ? -Wl,--soname=${SONAME}} ' + | 54 '${#SONAME ? -Wl,--soname=${SONAME}} ' + |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 | 325 |
| 325 tng = TempNameGen([], output) | 326 tng = TempNameGen([], output) |
| 326 | 327 |
| 327 # Do the bitcode link. | 328 # Do the bitcode link. |
| 328 if HasBitcodeInputs(inputs): | 329 if HasBitcodeInputs(inputs): |
| 329 chain = DriverChain(inputs, output, tng) | 330 chain = DriverChain(inputs, output, tng) |
| 330 chain.add(LinkBC, 'pre_opt.' + bitcode_type) | 331 chain.add(LinkBC, 'pre_opt.' + bitcode_type) |
| 331 if env.getbool('STATIC') and len(native_objects) == 0: | 332 if env.getbool('STATIC') and len(native_objects) == 0: |
| 332 chain.add(DoExpandCtorsAndTls, 'expand_ctors_and_tls.' + bitcode_type) | 333 chain.add(DoExpandCtorsAndTls, 'expand_ctors_and_tls.' + bitcode_type) |
| 333 if env.getone('OPT_LEVEL') != '' and env.getone('OPT_LEVEL') != '0': | 334 if env.getone('OPT_LEVEL') != '' and env.getone('OPT_LEVEL') != '0': |
| 334 chain.add(DoOPT, 'opt.' + bitcode_type) | 335 chain.add(DoLTO, 'opt.' + bitcode_type) |
| 335 elif env.getone('STRIP_MODE') != 'none': | 336 elif env.getone('STRIP_MODE') != 'none': |
| 336 chain.add(DoStrip, 'stripped.' + bitcode_type) | 337 chain.add(DoStrip, 'stripped.' + bitcode_type) |
| 337 else: | 338 else: |
| 338 chain = DriverChain('', output, tng) | 339 chain = DriverChain('', output, tng) |
| 339 | 340 |
| 340 # If -arch is also specified, invoke pnacl-translate afterwards. | 341 # If -arch is also specified, invoke pnacl-translate afterwards. |
| 341 if arch_flag_given: | 342 if arch_flag_given: |
| 342 env.set('NATIVE_OBJECTS', *native_objects) | 343 env.set('NATIVE_OBJECTS', *native_objects) |
| 343 chain.add(DoTranslate, native_type) | 344 chain.add(DoTranslate, native_type) |
| 344 | 345 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 Log.Fatal("%s: Unexpected type of file for linking (%s)", | 428 Log.Fatal("%s: Unexpected type of file for linking (%s)", |
| 428 pathtools.touser(f), FileType(f)) | 429 pathtools.touser(f), FileType(f)) |
| 429 count += 1 | 430 count += 1 |
| 430 | 431 |
| 431 if count == 0: | 432 if count == 0: |
| 432 Log.Fatal("no input files") | 433 Log.Fatal("no input files") |
| 433 | 434 |
| 434 def DoExpandCtorsAndTls(infile, outfile): | 435 def DoExpandCtorsAndTls(infile, outfile): |
| 435 RunDriver('opt', ['-nacl-expand-ctors', | 436 RunDriver('opt', ['-nacl-expand-ctors', |
| 436 '-nacl-expand-tls', | 437 '-nacl-expand-tls', |
| 438 '--do-not-wrap', | |
| 437 infile, '-o', outfile]) | 439 infile, '-o', outfile]) |
| 438 | 440 |
| 439 def DoOPT(infile, outfile): | 441 def DoLTO(infile, outfile): |
| 440 opt_flags = env.get('OPT_FLAGS') | 442 opt_flags = env.get('OPT_FLAGS') |
| 441 RunDriver('opt', opt_flags + [ infile, '-o', outfile ]) | 443 RunDriver('opt', opt_flags + [ infile, '-o', outfile ]) |
| 442 | 444 |
| 443 def DoStrip(infile, outfile): | 445 def DoStrip(infile, outfile): |
| 444 strip_flags = env.get('STRIP_FLAGS') | 446 strip_flags = env.get('STRIP_FLAGS') |
| 445 RunDriver('strip', strip_flags + [ infile, '-o', outfile ]) | 447 RunDriver('strip', strip_flags + [ infile, '-o', outfile ]) |
| 446 | 448 |
| 447 def DoTranslate(infile, outfile): | 449 def DoTranslate(infile, outfile): |
| 448 args = env.get('TRANSLATE_FLAGS') | 450 args = env.get('TRANSLATE_FLAGS') |
| 449 args += ['-Wl,'+s for s in env.get('LD_FLAGS_NATIVE')] | 451 args += ['-Wl,'+s for s in env.get('LD_FLAGS_NATIVE')] |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 -O<opt-level> Optimize output file | 483 -O<opt-level> Optimize output file |
| 482 -M, --print-map Print map file on standard output | 484 -M, --print-map Print map file on standard output |
| 483 --whole-archive Include all objects from following archives | 485 --whole-archive Include all objects from following archives |
| 484 --no-whole-archive Turn off --whole-archive | 486 --no-whole-archive Turn off --whole-archive |
| 485 -s, --strip-all Strip all symbols | 487 -s, --strip-all Strip all symbols |
| 486 -S, --strip-debug Strip debugging symbols | 488 -S, --strip-debug Strip debugging symbols |
| 487 --undefined SYMBOL Start with undefined reference to SYMBOL | 489 --undefined SYMBOL Start with undefined reference to SYMBOL |
| 488 | 490 |
| 489 -help | -h Output this help. | 491 -help | -h Output this help. |
| 490 """ | 492 """ |
| OLD | NEW |