diff options
-rw-r--r-- | chrome/chrome_dll.gypi | 3 | ||||
-rw-r--r-- | chrome/chrome_syzygy.gyp | 70 | ||||
-rwxr-xr-x | chrome/tools/build/win/wait_for_pdb.py | 107 |
3 files changed, 14 insertions, 166 deletions
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 0f73add2..052952c 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -136,12 +136,11 @@ 'AdditionalLibraryDirectories': ['$(DXSDK_DIR)/lib/x86'], 'BaseAddress': '0x01c30000', 'ImportLibrary': '$(OutDir)\\lib\\chrome_dll.lib', - 'ProgramDatabaseFile': '$(OutDir)\\chrome.dll.pdb', + 'ProgramDatabaseFile': '$(OutDir)\\chrome_dll.pdb', # Set /SUBSYSTEM:WINDOWS for chrome.dll (for consistency). 'SubSystem': '2', 'conditions': [ ['incremental_chrome_dll==1', { - 'ProgramDatabaseFile': '$(OutDir)\\initial\\chrome.dll.pdb', 'OutputFile': '$(OutDir)\\initial\\chrome.dll', 'UseLibraryDependencyInputs': "true", }], diff --git a/chrome/chrome_syzygy.gyp b/chrome/chrome_syzygy.gyp index b742944..d174ee4 100644 --- a/chrome/chrome_syzygy.gyp +++ b/chrome/chrome_syzygy.gyp @@ -4,58 +4,13 @@ { 'conditions': [ ['OS=="win" and fastbuild==0', { - 'variables': { - 'conditions': [ - ['incremental_chrome_dll==1', { - 'pdb_file': '<(PRODUCT_DIR)/initial/chrome.dll.pdb', - }, { - 'pdb_file': '<(PRODUCT_DIR)/chrome.dll.pdb', - }], - ], - }, + # Reorder the initial chrome DLL executable, placing the optimized + # output and corresponding PDB file into the "syzygy" subdirectory. + # If there's a matching chrome.dll-ordering.json file present in + # the output directory, chrome.dll will be ordered according to that, + # otherwise it will be randomized. + # This target won't build in fastbuild, since there are no PDBs. 'targets': [ - # The PDB is written by a background service, which means writes can - # happen after the build step which originated the request - # terminates. See BUG=126499 - # - # We hack around this by adding a script which will poll for write - # access to the PDB as a way to determine if the file is available. - # On success, we create stamp which is now gauranteed to be newer - # any inputs the PDB file depends on. - # - { - 'target_name': 'wait_chrome_pdb', - 'type': 'none', - 'sources' : [], - 'dependencies': [ - '<(DEPTH)/chrome/chrome.gyp:chrome_dll', - ], - 'actions': [ - { - 'action_name': 'Wait for PDB access.', - 'msvs_cygwin_shell': 0, - 'inputs': [ - '<(PRODUCT_DIR)/chrome.dll', - ], - 'outputs': [ - '<(PRODUCT_DIR)/chrome_dll_pdb.stamp', - ], - 'action': [ - 'python', - '<(DEPTH)/chrome/tools/build/win/wait_for_pdb.py', - '--input', '<(PRODUCT_DIR)/chrome.dll', - '--stamp', '<(PRODUCT_DIR)/chrome_dll_pdb.stamp', - '--pdb', '<(pdb_file)' - ], - }, - ], - }, - # Reorder the initial chrome DLL executable, placing the optimized - # output and corresponding PDB file into the "syzygy" subdirectory. - # If there's a matching chrome.dll-ordering.json file present in - # the output directory, chrome.dll will be ordered according to that, - # otherwise it will be randomized. - # This target won't build in fastbuild, since there are no PDBs. { 'target_name': 'chrome_dll_syzygy', 'type': 'none', @@ -64,24 +19,25 @@ '<(DEPTH)/chrome/chrome.gyp:chrome_dll', ], 'variables': { - 'dest_dir': '<(PRODUCT_DIR)/syzygy', + 'dest_dir': '<(PRODUCT_DIR)\\syzygy', }, 'actions': [ { 'action_name': 'Reorder Chrome with Syzygy', 'msvs_cygwin_shell': 0, 'inputs': [ - '<(PRODUCT_DIR)/chrome_dll_pdb.stamp', + '<(PRODUCT_DIR)\\chrome.dll', + '<(PRODUCT_DIR)\\chrome_dll.pdb', ], 'outputs': [ - '<(dest_dir)/chrome.dll', - '<(dest_dir)/chrome_dll.pdb', + '<(dest_dir)\\chrome.dll', + '<(dest_dir)\\chrome_dll.pdb', ], 'action': [ 'python', '<(DEPTH)/chrome/tools/build/win/syzygy_reorder.py', - '--input_executable', '<(PRODUCT_DIR)/chrome.dll', - '--input_symbol', '<(pdb_file)', + '--input_executable', '<(PRODUCT_DIR)\\chrome.dll', + '--input_symbol', '<(PRODUCT_DIR)\\chrome_dll.pdb', '--destination_dir', '<(dest_dir)', ], }, diff --git a/chrome/tools/build/win/wait_for_pdb.py b/chrome/tools/build/win/wait_for_pdb.py deleted file mode 100755 index 2d96809..0000000 --- a/chrome/tools/build/win/wait_for_pdb.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""A utility script to wait for PDB writes to complete.""" - -import optparse -import os -import sys -import time - - -def _ParseOptions(args): - print 'Args: ' + ' '.join(args) - option_parser = optparse.OptionParser() - option_parser.add_option('--input', action='append', default=[], - dest='inputs', help='Add the file to the list of input dependencies.') - option_parser.add_option('--pdb', action='store', default=None, - help='The PDB file to lock and compare time against.') - option_parser.add_option('--stamp', - help='The stamp file to generate when the PDB is ready.') - option_parser.add_option('--verbose', action='store_true', default=True, - help='Provide verbose output.') - option_parser.add_option('--epsilon', default=0.05, - help='Seconds (0.05) to wait.') - option_parser.add_option('--timeout', default=10.0, - help='Seconds (10.0) to wait before timing out with a failure.') - options, args = option_parser.parse_args(args) - - if not len(options.inputs): - option_parser.error('You must provide at least one input binary.') - if not options.pdb: - option_parser.error('You must provide the PDB to verify.') - if not options.stamp: - option_parser.error('You must provide the stamp file to create.') - - if len(args): - option_parser.error('Did not expect other inputs.') - - return options - - -def _TestPDBAccess(pdb): - """Attemps to open provided PDB filepath for writing - - This function will attempt to find and write to the provided PDB filepath - as a way to determine if the build system is no longer holding the file. - A succesful open of a zero size file is considered an accidental - create, so it also fails.""" - - try: - fd = os.open(pdb, os.O_APPEND + os.O_RDWR) - except OSError: - return -1 - - # Return the size since 0 implies something is wrong. - passed = os.fstat(fd).st_size - os.close(fd) - return passed - - -def main(args): - options = _ParseOptions(args[1:]) - - # While the PDB is expected to have been opened by mspdbsrv prior to the build - # process for inputs successfully exiting, we wait for epsilon since have - # no documentaion, and no wait to verify this. - time.sleep(options.epsilon) - - start = time.clock() - current = start - - # Verify each input exists, which should always be True - for input in options.inputs: - if not os.path.isfile(input): - print 'WaitForPDB: Failed to find file %s.' % input - return 1 - - # Continue to attempt open the PDB for writing until we succeed or timeout. - while (current - options.timeout) <= start: - time.sleep(options.epsilon) - current = time.clock() - - pdb_size = _TestPDBAccess(options.pdb) - if pdb_size == 0: - 'WaitForPDB: Opened %s size zero.' % options.pdb - return 1 - - # If we were able to open for writing, and the size is non-zero, assume - # mspdbsrv is done with the file. - if pdb_size > 0: - try: - open(options.stamp, 'w').write('Stamp for: %s\n' % options.pdb) - return 0 - except: - print 'Failed to write stamp file %s.' % options.stamp - return 1 - - if options.verbose: - print 'Waiting for %s.' % options.pdb - - print 'WaitForPDB: Time expired waiting for %s.' % options.pdb - return 1 - -if '__main__' == __name__: - sys.exit(main(sys.argv)) |