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

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

Issue 12303010: fixes to libcmt stripper to correctly strip x64 objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes to prep_libc to supply target_arch on command line instead of via output directory 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 | « base/allocator/allocator.gyp ('k') | 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 <VCLibDir> <OutputDir> <arch>
11 # 11 #
12 # VCInstallDir is the path where VC is installed, something like: 12 # VCLibDir 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\lib
14 #
15 # OutputDir is the directory where the modified libcmt file should be stored. 14 # OutputDir is the directory where the modified libcmt file should be stored.
15 # arch is either 'ia32' or 'x64'
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 bindir = 'SELF_X86'
35 objdir = 'INTEL'
34 vs_install_dir = sys.argv[1] 36 vs_install_dir = sys.argv[1]
35 outdir = sys.argv[2] 37 outdir = sys.argv[2]
36 if "x64" in sys.argv[2]: 38 if "x64" in sys.argv[3]:
39 bindir = 'SELF_64_amd64'
40 objdir = 'amd64'
37 vs_install_dir = os.path.join(vs_install_dir, 'amd64') 41 vs_install_dir = os.path.join(vs_install_dir, 'amd64')
38 output_lib = os.path.join(outdir, 'libcmt.lib') 42 output_lib = os.path.join(outdir, 'libcmt.lib')
39 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib) 43 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib)
40 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'), 44 shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'),
41 os.path.join(outdir, 'libcmt.pdb')) 45 os.path.join(outdir, 'libcmt.pdb'))
46
42 vspaths = [ 47 vspaths = [
43 'build\\intel\\mt_obj\\', 48 'build\\intel\\mt_obj\\',
44 'f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\', 49 'f:\\dd\\vctools\\crt_bld\\' + bindir + \
45 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec \\\\', 50 '\\crt\\src\\build\\' + objdir + '\\mt_obj\\',
46 'F:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\nativec pp\\\\', 51 'F:\\dd\\vctools\\crt_bld\\' + bindir + \
47 ] 52 '\\crt\\src\\build\\' + objdir + '\\mt_obj\\nativec\\\\',
53 'F:\\dd\\vctools\\crt_bld\\' + bindir + \
54 '\\crt\\src\\build\\' + objdir + '\\mt_obj\\nativecpp\\\\' ]
55
48 objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2', 56 objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2',
49 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk', 57 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk',
50 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl', 58 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl',
51 'new_mode', 'newopnt'] 59 'new_mode', 'newopnt']
52 for obj in objfiles: 60 for obj in objfiles:
53 for vspath in vspaths: 61 for vspath in vspaths:
54 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' % 62 cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' %
55 (vspath, obj, output_lib)) 63 (vspath, obj, output_lib))
56 run(cmd, obj + '.obj') 64 run(cmd, obj + '.obj')
57 65
58 if __name__ == "__main__": 66 if __name__ == "__main__":
59 sys.exit(main()) 67 sys.exit(main())
OLDNEW
« no previous file with comments | « base/allocator/allocator.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698