| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """A utility script to help building Syzygy-reordered Chrome binaries.""" | 6 """A utility script to help building Syzygy-reordered Chrome binaries.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| 11 import subprocess | 11 import subprocess |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 | 14 |
| 15 # The default relink executable to use to reorder binaries. | 15 # The default relink executable to use to reorder binaries. |
| 16 _DEFAULT_RELINKER = os.path.join( | 16 _DEFAULT_RELINKER = os.path.join( |
| 17 os.path.join(os.path.dirname(__file__), '../../../../..'), | 17 os.path.join(os.path.dirname(__file__), '../../..'), |
| 18 'third_party/syzygy/binaries/exe/relink.exe') | 18 'third_party/syzygy/binaries/exe/relink.exe') |
| 19 | 19 |
| 20 _LOGGER = logging.getLogger() | 20 _LOGGER = logging.getLogger() |
| 21 | 21 |
| 22 # We use the same seed for all random reorderings to get a deterministic build. | 22 # We use the same seed for all random reorderings to get a deterministic build. |
| 23 _RANDOM_SEED = 1347344 | 23 _RANDOM_SEED = 1347344 |
| 24 | 24 |
| 25 | 25 |
| 26 def _Shell(*cmd, **kw): | 26 def _Shell(*cmd, **kw): |
| 27 """Shells out to "cmd". Returns a tuple of cmd's stdout, stderr.""" | 27 """Shells out to "cmd". Returns a tuple of cmd's stdout, stderr.""" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 option_parser.error('You must provide an input symbol file.') | 102 option_parser.error('You must provide an input symbol file.') |
| 103 | 103 |
| 104 if not options.destination_dir: | 104 if not options.destination_dir: |
| 105 options.destination_dir = os.path.join(options.output_dir, 'reordered') | 105 options.destination_dir = os.path.join(options.output_dir, 'reordered') |
| 106 | 106 |
| 107 return options | 107 return options |
| 108 | 108 |
| 109 | 109 |
| 110 if '__main__' == __name__: | 110 if '__main__' == __name__: |
| 111 sys.exit(main(_ParseOptions())) | 111 sys.exit(main(_ParseOptions())) |
| OLD | NEW |