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

Side by Side Diff: base/allocator/prep_libc.py

Issue 12258025: Fixes to prep_libc.py to support correct stripping of x64 libcmt on x64 target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # This script takes libcmt.lib for VS2005/08/10 and removes the allocation 7 # This script takes libcmt.lib for VS2005/08/10 and removes the allocation
8 # related functions from it. 8 # related functions from it.
9 # 9 #
10 # Usage: prep_libc.py <VCInstallDir> <OutputDir> 10 # Usage: prep_libc.py <VCInstallDir> <OutputDir>
11 # 11 #
12 # VCInstallDir is the path where VC is installed, something like: 12 # VCInstallDir is the path where VC is installed, something like:
13 # C:\Program Files\Microsoft Visual Studio 8\VC\ 13 # C:\Program Files\Microsoft Visual Studio 8\VC\
rvargas (doing something else) 2013/02/14 02:37:11 This should have "lib" at the end.
14 # 14 #
15 # OutputDir is the directory where the modified libcmt file should be stored. 15 # OutputDir is the directory where the modified libcmt file should be stored.
16 16
17 import os 17 import os
18 import shutil 18 import shutil
19 import subprocess 19 import subprocess
20 import sys 20 import sys
21 21
22 def run(command, filter=None): 22 def run(command, filter=None):
23 """Run |command|, removing any lines that match |filter|. The filter is 23 """Run |command|, removing any lines that match |filter|. The filter is
24 to remove the echoing of input filename that 'lib' does.""" 24 to remove the echoing of input filename that 'lib' does."""
25 popen = subprocess.Popen( 25 popen = subprocess.Popen(
26 command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 26 command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
27 out, _ = popen.communicate() 27 out, _ = popen.communicate()
28 for line in out.splitlines(): 28 for line in out.splitlines():
29 if filter and line.strip() != filter: 29 if filter and line.strip() != filter:
30 print line 30 print line
31 return popen.returncode 31 return popen.returncode
32 32
33 def main(): 33 def main():
34 vs_install_dir = sys.argv[1] 34 vs_install_dir = sys.argv[1]
35 outdir = sys.argv[2] 35 outdir = sys.argv[2]
36 if "x64" in sys.argv[2]:
37 vs_install_dir = os.path.join(vs_install_dir, 'amd64')
36 output_lib = os.path.join(outdir, 'libcmt.lib') 38 output_lib = os.path.join(outdir, 'libcmt.lib')
37 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib) 39 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib)
38 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'), 40 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'),
39 os.path.join(outdir, 'libcmt.pdb')) 41 os.path.join(outdir, 'libcmt.pdb'))
40 vspaths = [ 42 vspaths = [
41 'build\\intel\\mt_obj\\', 43 'build\\intel\\mt_obj\\',
42 'f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\', 44 'f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\',
43 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec \\\\', 45 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec \\\\',
44 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec pp\\\\', 46 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec pp\\\\',
45 ] 47 ]
46 objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2', 48 objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2',
47 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk', 49 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk',
48 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl', 50 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl',
49 'new_mode', 'newopnt'] 51 'new_mode', 'newopnt']
50 for obj in objfiles: 52 for obj in objfiles:
51 for vspath in vspaths: 53 for vspath in vspaths:
52 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' % 54 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' %
53 (vspath, obj, output_lib)) 55 (vspath, obj, output_lib))
54 run(cmd, obj + '.obj') 56 run(cmd, obj + '.obj')
55 57
56 if __name__ == "__main__": 58 if __name__ == "__main__":
57 sys.exit(main()) 59 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698