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

Side by Side Diff: pylib/gyp/msvs_emulation.py

Issue 217813007: Pass the /safeseh option to ml.exe. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rename the assmebly code test file. Created 6 years, 8 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
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ 5 """
6 This module helps emulate Visual Studio 2008 behavior on top of other 6 This module helps emulate Visual Studio 2008 behavior on top of other
7 build systems, primarily ninja. 7 build systems, primarily ninja.
8 """ 8 """
9 9
10 import os 10 import os
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 generate_debug_info = self._Setting( 338 generate_debug_info = self._Setting(
339 ('VCLinkerTool', 'GenerateDebugInformation'), config) 339 ('VCLinkerTool', 'GenerateDebugInformation'), config)
340 if generate_debug_info: 340 if generate_debug_info:
341 if output_file: 341 if output_file:
342 return expand_special(self.ConvertVSMacros(output_file, config=config)) 342 return expand_special(self.ConvertVSMacros(output_file, config=config))
343 else: 343 else:
344 return default 344 return default
345 else: 345 else:
346 return None 346 return None
347 347
348 def GetAsmflags(self, config):
349 """Returns the flags that need to be added to ml invocations."""
350 config = self._TargetConfig(config)
351 asmflags = []
352 safeseh = self._Setting(('MASM', 'UseSafeExceptionHandlers'), config)
353 if safeseh == 'true':
354 asmflags.append('/safeseh')
355 return asmflags
356
348 def GetCflags(self, config): 357 def GetCflags(self, config):
349 """Returns the flags that need to be added to .c and .cc compilations.""" 358 """Returns the flags that need to be added to .c and .cc compilations."""
350 config = self._TargetConfig(config) 359 config = self._TargetConfig(config)
351 cflags = [] 360 cflags = []
352 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) 361 cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]])
353 cl = self._GetWrapper(self, self.msvs_settings[config], 362 cl = self._GetWrapper(self, self.msvs_settings[config],
354 'VCCLCompilerTool', append=cflags) 363 'VCCLCompilerTool', append=cflags)
355 cl('Optimization', 364 cl('Optimization',
356 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O', default='2') 365 map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O', default='2')
357 cl('InlineFunctionExpansion', prefix='/Ob') 366 cl('InlineFunctionExpansion', prefix='/Ob')
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 ld('LinkTimeCodeGeneration', 530 ld('LinkTimeCodeGeneration',
522 map={'1': '', '2': ':PGINSTRUMENT', '3': ':PGOPTIMIZE', 531 map={'1': '', '2': ':PGINSTRUMENT', '3': ':PGOPTIMIZE',
523 '4': ':PGUPDATE'}, 532 '4': ':PGUPDATE'},
524 prefix='/LTCG') 533 prefix='/LTCG')
525 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') 534 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:')
526 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) 535 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'})
527 ld('EntryPointSymbol', prefix='/ENTRY:') 536 ld('EntryPointSymbol', prefix='/ENTRY:')
528 ld('Profile', map={'true': '/PROFILE'}) 537 ld('Profile', map={'true': '/PROFILE'})
529 ld('LargeAddressAware', 538 ld('LargeAddressAware',
530 map={'1': ':NO', '2': ''}, prefix='/LARGEADDRESSAWARE') 539 map={'1': ':NO', '2': ''}, prefix='/LARGEADDRESSAWARE')
540 ld('ImageHasSafeExceptionHandlers', map={'true': '/SAFESEH'})
531 # TODO(scottmg): This should sort of be somewhere else (not really a flag). 541 # TODO(scottmg): This should sort of be somewhere else (not really a flag).
532 ld('AdditionalDependencies', prefix='') 542 ld('AdditionalDependencies', prefix='')
533 543
534 # If the base address is not specifically controlled, DYNAMICBASE should 544 # If the base address is not specifically controlled, DYNAMICBASE should
535 # be on by default. 545 # be on by default.
536 base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', 546 base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED',
537 ldflags) 547 ldflags)
538 if not base_flags: 548 if not base_flags:
539 ldflags.append('/DYNAMICBASE') 549 ldflags.append('/DYNAMICBASE')
540 550
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 969
960 # To determine processor word size on Windows, in addition to checking 970 # To determine processor word size on Windows, in addition to checking
961 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current 971 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current
962 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which 972 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which
963 # contains the actual word size of the system when running thru WOW64). 973 # contains the actual word size of the system when running thru WOW64).
964 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or 974 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or
965 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): 975 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')):
966 default_variables['MSVS_OS_BITS'] = 64 976 default_variables['MSVS_OS_BITS'] = 64
967 else: 977 else:
968 default_variables['MSVS_OS_BITS'] = 32 978 default_variables['MSVS_OS_BITS'] = 32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698