OLD | NEW |
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 ld('LinkTimeCodeGeneration', | 607 ld('LinkTimeCodeGeneration', |
608 map={'1': '', '2': ':PGINSTRUMENT', '3': ':PGOPTIMIZE', | 608 map={'1': '', '2': ':PGINSTRUMENT', '3': ':PGOPTIMIZE', |
609 '4': ':PGUPDATE'}, | 609 '4': ':PGUPDATE'}, |
610 prefix='/LTCG') | 610 prefix='/LTCG') |
611 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') | 611 ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') |
612 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) | 612 ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) |
613 ld('EntryPointSymbol', prefix='/ENTRY:') | 613 ld('EntryPointSymbol', prefix='/ENTRY:') |
614 ld('Profile', map={'true': '/PROFILE'}) | 614 ld('Profile', map={'true': '/PROFILE'}) |
615 ld('LargeAddressAware', | 615 ld('LargeAddressAware', |
616 map={'1': ':NO', '2': ''}, prefix='/LARGEADDRESSAWARE') | 616 map={'1': ':NO', '2': ''}, prefix='/LARGEADDRESSAWARE') |
617 ld('ImageHasSafeExceptionHandlers', map={'true': '/SAFESEH'}) | |
618 # TODO(scottmg): This should sort of be somewhere else (not really a flag). | 617 # TODO(scottmg): This should sort of be somewhere else (not really a flag). |
619 ld('AdditionalDependencies', prefix='') | 618 ld('AdditionalDependencies', prefix='') |
620 | 619 |
| 620 if self.GetArch(config) == 'x86': |
| 621 safeseh_default = 'true' |
| 622 else: |
| 623 safeseh_default = None |
| 624 ld('ImageHasSafeExceptionHandlers', |
| 625 map={'false': ':NO', 'true': ''}, prefix='/SAFESEH', |
| 626 default=safeseh_default) |
| 627 |
621 # If the base address is not specifically controlled, DYNAMICBASE should | 628 # If the base address is not specifically controlled, DYNAMICBASE should |
622 # be on by default. | 629 # be on by default. |
623 base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', | 630 base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', |
624 ldflags) | 631 ldflags) |
625 if not base_flags: | 632 if not base_flags: |
626 ldflags.append('/DYNAMICBASE') | 633 ldflags.append('/DYNAMICBASE') |
627 | 634 |
628 # If the NXCOMPAT flag has not been specified, default to on. Despite the | 635 # If the NXCOMPAT flag has not been specified, default to on. Despite the |
629 # documentation that says this only defaults to on when the subsystem is | 636 # documentation that says this only defaults to on when the subsystem is |
630 # Vista or greater (which applies to the linker), the IDE defaults it on | 637 # Vista or greater (which applies to the linker), the IDE defaults it on |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 | 1068 |
1062 # To determine processor word size on Windows, in addition to checking | 1069 # To determine processor word size on Windows, in addition to checking |
1063 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current | 1070 # PROCESSOR_ARCHITECTURE (which reflects the word size of the current |
1064 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which | 1071 # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which |
1065 # contains the actual word size of the system when running thru WOW64). | 1072 # contains the actual word size of the system when running thru WOW64). |
1066 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or | 1073 if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or |
1067 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): | 1074 '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): |
1068 default_variables['MSVS_OS_BITS'] = 64 | 1075 default_variables['MSVS_OS_BITS'] = 64 |
1069 else: | 1076 else: |
1070 default_variables['MSVS_OS_BITS'] = 32 | 1077 default_variables['MSVS_OS_BITS'] = 32 |
OLD | NEW |