Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This creates a workaround for targets whose PDB sizes exceeds 1GB, using the same trick originally implemented here: https://codereview.chromium.org/11968015/ There are currently 4 targets using this, and another 4 targets that need to use it hence the desire to centralize this functionality. BUG=174136 Review URL: https://codereview.chromium.org/12476002 git-svn-id: http://gyp.googlecode.com/svn/trunk@1600 78cadc50-ecff-11dd-a971-7dbc132099af
- Loading branch information
chrisha@chromium.org
committed
Mar 18, 2013
1 parent
82e7402
commit 9ee1e40
Showing
8 changed files
with
291 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// This file is used to generate an empty .pdb -- with a 4KB pagesize -- that is | ||
// then used during the final link for modules that have large PDBs. Otherwise, | ||
// the linker will generate a pdb with a page size of 1KB, which imposes a limit | ||
// of 1GB on the .pdb. By generating an initial empty .pdb with the compiler | ||
// (rather than the linker), this limit is avoided. With this in place PDBs may | ||
// grow to 2GB. | ||
// | ||
// This file is referenced by the msvs_large_pdb mechanism in MSVSUtil.py. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright (c) 2013 Google Inc. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
""" | ||
Make sure msvs_large_pdb works correctly. | ||
""" | ||
|
||
import TestGyp | ||
|
||
import struct | ||
import sys | ||
|
||
|
||
CHDIR = 'large-pdb' | ||
|
||
|
||
def CheckImageAndPdb(test, image_basename, expected_page_size): | ||
pdb_basename = image_basename + '.pdb' | ||
test.built_file_must_exist(image_basename, chdir=CHDIR) | ||
test.built_file_must_exist(pdb_basename, chdir=CHDIR) | ||
|
||
# We expect the PDB to have the given page size. For full details of the | ||
# header look here: https://code.google.com/p/pdbparser/wiki/MSF_Format | ||
# We read the little-endian 4-byte unsigned integer at position 32 of the | ||
# file. | ||
pdb_path = test.built_file_path(pdb_basename, chdir=CHDIR) | ||
pdb_file = open(pdb_path, 'rb') | ||
pdb_file.seek(32, 0) | ||
page_size = struct.unpack('<I', pdb_file.read(4))[0] | ||
if page_size != expected_page_size: | ||
print "Expected page size of %d, got %d for PDB file `%s'." % ( | ||
expected_page_size, page_size, pdb_path) | ||
|
||
|
||
if sys.platform == 'win32': | ||
test = TestGyp.TestGyp(formats=['msvs', 'ninja']) | ||
|
||
test.run_gyp('large-pdb.gyp', chdir=CHDIR) | ||
test.build('large-pdb.gyp', test.ALL, chdir=CHDIR) | ||
|
||
CheckImageAndPdb(test, 'large_pdb_exe.exe', 4096) | ||
CheckImageAndPdb(test, 'small_pdb_exe.exe', 1024) | ||
CheckImageAndPdb(test, 'large_pdb_dll.dll', 4096) | ||
CheckImageAndPdb(test, 'small_pdb_dll.dll', 1024) | ||
|
||
test.pass_test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <windows.h> | ||
|
||
BOOL WINAPI DllMain(HINSTANCE hinstance, DWORD reason, LPVOID reserved) { | ||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) 2013 Google Inc. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
{ | ||
'targets': [ | ||
{ | ||
'target_name': 'large_pdb_exe', | ||
'type': 'executable', | ||
'msvs_large_pdb': 1, | ||
'sources': [ | ||
'main.cc', | ||
], | ||
'msvs_settings': { | ||
'VCLinkerTool': { | ||
'GenerateDebugInformation': 'true', | ||
'ProgramDatabaseFile': '<(PRODUCT_DIR)/large_pdb_exe.exe.pdb', | ||
}, | ||
}, | ||
}, | ||
{ | ||
'target_name': 'small_pdb_exe', | ||
'type': 'executable', | ||
'msvs_large_pdb': 0, | ||
'sources': [ | ||
'main.cc', | ||
], | ||
'msvs_settings': { | ||
'VCLinkerTool': { | ||
'GenerateDebugInformation': 'true', | ||
'ProgramDatabaseFile': '<(PRODUCT_DIR)/small_pdb_exe.exe.pdb', | ||
}, | ||
}, | ||
}, | ||
{ | ||
'target_name': 'large_pdb_dll', | ||
'type': 'shared_library', | ||
'msvs_large_pdb': 1, | ||
'sources': [ | ||
'dllmain.cc', | ||
], | ||
'msvs_settings': { | ||
'VCLinkerTool': { | ||
'GenerateDebugInformation': 'true', | ||
'ProgramDatabaseFile': '<(PRODUCT_DIR)/large_pdb_dll.dll.pdb', | ||
}, | ||
}, | ||
}, | ||
{ | ||
'target_name': 'small_pdb_dll', | ||
'type': 'shared_library', | ||
'msvs_large_pdb': 0, | ||
'sources': [ | ||
'dllmain.cc', | ||
], | ||
'msvs_settings': { | ||
'VCLinkerTool': { | ||
'GenerateDebugInformation': 'true', | ||
'ProgramDatabaseFile': '<(PRODUCT_DIR)/small_pdb_dll.dll.pdb', | ||
}, | ||
}, | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) 2013 Google Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
int main(int argc, const char** argv) { | ||
return 0; | ||
} |