| OLD | NEW |
| 1 #! -*- python -*- | 1 #! -*- python -*- |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import atexit | 6 import atexit |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import platform | 9 import platform |
| 10 import re | 10 import re |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 # | 1012 # |
| 1013 | 1013 |
| 1014 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture', | 1014 DeclareBit('build_x86_32', 'Building binaries for the x86-32 architecture', |
| 1015 exclusive_groups='build_arch') | 1015 exclusive_groups='build_arch') |
| 1016 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture', | 1016 DeclareBit('build_x86_64', 'Building binaries for the x86-64 architecture', |
| 1017 exclusive_groups='build_arch') | 1017 exclusive_groups='build_arch') |
| 1018 DeclareBit('build_mips32', 'Building binaries for the MIPS architecture', | 1018 DeclareBit('build_mips32', 'Building binaries for the MIPS architecture', |
| 1019 exclusive_groups='build_arch') | 1019 exclusive_groups='build_arch') |
| 1020 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture', | 1020 DeclareBit('build_arm_arm', 'Building binaries for the ARM architecture', |
| 1021 exclusive_groups='build_arch') | 1021 exclusive_groups='build_arch') |
| 1022 DeclareBit('target_x86_32', 'Tools being built will process x86-32 binaries', | |
| 1023 exclusive_groups='target_arch') | |
| 1024 DeclareBit('target_x86_64', 'Tools being built will process x86-36 binaries', | |
| 1025 exclusive_groups='target_arch') | |
| 1026 DeclareBit('target_mips32', 'Tools being built will process MIPS binaries', | |
| 1027 exclusive_groups='target_arch') | |
| 1028 DeclareBit('target_arm_arm', 'Tools being built will process ARM binaries', | |
| 1029 exclusive_groups='target_arch') | |
| 1030 | 1022 |
| 1031 # Shorthand for either the 32 or 64 bit version of x86. | 1023 # Shorthand for either the 32 or 64 bit version of x86. |
| 1032 DeclareBit('build_x86', 'Building binaries for the x86 architecture') | 1024 DeclareBit('build_x86', 'Building binaries for the x86 architecture') |
| 1033 DeclareBit('target_x86', 'Tools being built will process x86 binaries') | |
| 1034 | 1025 |
| 1035 DeclareBit('build_arm', 'Building binaries for the arm architecture') | 1026 DeclareBit('build_arm', 'Building binaries for the arm architecture') |
| 1036 DeclareBit('target_arm', 'Tools being built will process arm binaries') | |
| 1037 | 1027 |
| 1038 | 1028 |
| 1039 def MakeArchSpecificEnv(platform=None): | 1029 def MakeArchSpecificEnv(platform=None): |
| 1040 env = pre_base_env.Clone() | 1030 env = pre_base_env.Clone() |
| 1041 if platform is None: | 1031 if platform is None: |
| 1042 platform = GetTargetPlatform() | 1032 platform = GetTargetPlatform() |
| 1043 | 1033 |
| 1044 arch = pynacl.platform.GetArch(platform) | 1034 arch = pynacl.platform.GetArch(platform) |
| 1045 if pynacl.platform.IsArch64Bit(platform): | 1035 if pynacl.platform.IsArch64Bit(platform): |
| 1046 subarch = '64' | 1036 subarch = '64' |
| 1047 else: | 1037 else: |
| 1048 subarch = '32' | 1038 subarch = '32' |
| 1049 | 1039 |
| 1050 env.Replace(BUILD_FULLARCH=platform) | 1040 env.Replace(BUILD_FULLARCH=platform) |
| 1051 env.Replace(BUILD_ARCHITECTURE=arch) | 1041 env.Replace(BUILD_ARCHITECTURE=arch) |
| 1052 env.Replace(BUILD_SUBARCH=subarch) | 1042 env.Replace(BUILD_SUBARCH=subarch) |
| 1053 env.Replace(TARGET_FULLARCH=platform) | 1043 env.Replace(TARGET_FULLARCH=platform) |
| 1054 env.Replace(TARGET_ARCHITECTURE=arch) | 1044 env.Replace(TARGET_ARCHITECTURE=arch) |
| 1055 env.Replace(TARGET_SUBARCH=subarch) | 1045 env.Replace(TARGET_SUBARCH=subarch) |
| 1056 | 1046 |
| 1057 # Example: PlatformBit('build', 'x86-32') -> build_x86_32 | 1047 env.SetBits('build_%s' % platform.replace('-', '_')) |
| 1058 def PlatformBit(prefix, platform): | |
| 1059 return "%s_%s" % (prefix, platform.replace('-', '_')) | |
| 1060 | |
| 1061 env.SetBits(PlatformBit('build', platform)) | |
| 1062 env.SetBits(PlatformBit('target', platform)) | |
| 1063 | 1048 |
| 1064 if env.Bit('build_x86_32') or env.Bit('build_x86_64'): | 1049 if env.Bit('build_x86_32') or env.Bit('build_x86_64'): |
| 1065 env.SetBits('build_x86') | 1050 env.SetBits('build_x86') |
| 1066 if env.Bit('build_arm_arm'): | 1051 if env.Bit('build_arm_arm'): |
| 1067 env.SetBits('build_arm') | 1052 env.SetBits('build_arm') |
| 1068 | 1053 |
| 1069 if env.Bit('target_x86_32') or env.Bit('target_x86_64'): | |
| 1070 env.SetBits('target_x86') | |
| 1071 if env.Bit('target_arm_arm'): | |
| 1072 env.SetBits('target_arm') | |
| 1073 | |
| 1074 env.Replace(BUILD_ISA_NAME=platform) | 1054 env.Replace(BUILD_ISA_NAME=platform) |
| 1075 | 1055 |
| 1076 if env.Bit('target_mips32'): | 1056 if env.Bit('build_mips32'): |
| 1077 # This is a silent default on MIPS. | 1057 # This is a silent default on MIPS. |
| 1078 env.SetBits('bitcode') | 1058 env.SetBits('bitcode') |
| 1079 | 1059 |
| 1080 # Determine where the object files go | 1060 # Determine where the object files go |
| 1081 env.Replace(BUILD_TARGET_NAME=platform) | 1061 env.Replace(BUILD_TARGET_NAME=platform) |
| 1082 # This may be changed later; see target_variant_map, below. | 1062 # This may be changed later; see target_variant_map, below. |
| 1083 env.Replace(TARGET_VARIANT='') | 1063 env.Replace(TARGET_VARIANT='') |
| 1084 env.Replace(TARGET_ROOT= | 1064 env.Replace(TARGET_ROOT= |
| 1085 '${DESTINATION_ROOT}/${BUILD_TYPE}-${BUILD_TARGET_NAME}${TARGET_VARIANT}') | 1065 '${DESTINATION_ROOT}/${BUILD_TYPE}-${BUILD_TARGET_NAME}${TARGET_VARIANT}') |
| 1086 return env | 1066 return env |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 # The dynamic linker's ability to receive arguments over IPC at | 1454 # The dynamic linker's ability to receive arguments over IPC at |
| 1475 # startup currently requires it to reject the plugin's first | 1455 # startup currently requires it to reject the plugin's first |
| 1476 # connection, but this interferes with the sel_universal-based | 1456 # connection, but this interferes with the sel_universal-based |
| 1477 # testing because sel_universal does not retry the connection. | 1457 # testing because sel_universal does not retry the connection. |
| 1478 # TODO(mseaborn): Fix by retrying the connection or by adding an | 1458 # TODO(mseaborn): Fix by retrying the connection or by adding an |
| 1479 # option to ld.so to disable its argv-over-IPC feature. | 1459 # option to ld.so to disable its argv-over-IPC feature. |
| 1480 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'): | 1460 if env.Bit('nacl_glibc') and not env.Bit('nacl_static_link'): |
| 1481 return [] | 1461 return [] |
| 1482 | 1462 |
| 1483 # TODO(petarj): Sel_universal hangs on qemu-mips. Enable when fixed. | 1463 # TODO(petarj): Sel_universal hangs on qemu-mips. Enable when fixed. |
| 1484 if env.Bit('target_mips32') and env.UsingEmulator(): | 1464 if env.Bit('build_mips32') and env.UsingEmulator(): |
| 1485 return [] | 1465 return [] |
| 1486 | 1466 |
| 1487 if sel_universal_flags is None: | 1467 if sel_universal_flags is None: |
| 1488 sel_universal_flags = [] | 1468 sel_universal_flags = [] |
| 1489 | 1469 |
| 1490 # When run under qemu, sel_universal must sneak in qemu to the execv | 1470 # When run under qemu, sel_universal must sneak in qemu to the execv |
| 1491 # call that spawns sel_ldr. | 1471 # call that spawns sel_ldr. |
| 1492 if env.UsingEmulator(): | 1472 if env.UsingEmulator(): |
| 1493 sel_universal_flags.append('--command_prefix') | 1473 sel_universal_flags.append('--command_prefix') |
| 1494 sel_universal_flags.append(env.GetEmulator()) | 1474 sel_universal_flags.append(env.GetEmulator()) |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 # See http://code.google.com/p/nativeclient/issues/detail?id=1987 | 2179 # See http://code.google.com/p/nativeclient/issues/detail?id=1987 |
| 2200 gtest_env.FilterOut(LINKFLAGS=['-static']) | 2180 gtest_env.FilterOut(LINKFLAGS=['-static']) |
| 2201 | 2181 |
| 2202 gtest_env.Prepend(LIBS=['gtest']) | 2182 gtest_env.Prepend(LIBS=['gtest']) |
| 2203 return gtest_env | 2183 return gtest_env |
| 2204 | 2184 |
| 2205 pre_base_env.AddMethod(MakeGTestEnv) | 2185 pre_base_env.AddMethod(MakeGTestEnv) |
| 2206 | 2186 |
| 2207 def MakeUntrustedNativeEnv(env): | 2187 def MakeUntrustedNativeEnv(env): |
| 2208 native_env = nacl_env.Clone() | 2188 native_env = nacl_env.Clone() |
| 2209 if native_env.Bit('bitcode') and not native_env.Bit('target_mips32'): | 2189 if native_env.Bit('bitcode') and not native_env.Bit('build_mips32'): |
| 2210 native_env = native_env.PNaClGetNNaClEnv() | 2190 native_env = native_env.PNaClGetNNaClEnv() |
| 2211 return native_env | 2191 return native_env |
| 2212 | 2192 |
| 2213 pre_base_env.AddMethod(MakeUntrustedNativeEnv) | 2193 pre_base_env.AddMethod(MakeUntrustedNativeEnv) |
| 2214 | 2194 |
| 2215 def MakeBaseTrustedEnv(platform=None): | 2195 def MakeBaseTrustedEnv(platform=None): |
| 2216 base_env = MakeArchSpecificEnv(platform) | 2196 base_env = MakeArchSpecificEnv(platform) |
| 2217 base_env.Append( | 2197 base_env.Append( |
| 2218 IS_BUILD_ENV = False, | 2198 IS_BUILD_ENV = False, |
| 2219 BUILD_SUBTYPE = '', | 2199 BUILD_SUBTYPE = '', |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 'tests/unittests/trusted/bits/build.scons', | 2262 'tests/unittests/trusted/bits/build.scons', |
| 2283 'tests/unittests/trusted/platform_qualify/build.scons', | 2263 'tests/unittests/trusted/platform_qualify/build.scons', |
| 2284 'tests/unittests/trusted/service_runtime/build.scons', | 2264 'tests/unittests/trusted/service_runtime/build.scons', |
| 2285 'toolchain_build/build.scons', | 2265 'toolchain_build/build.scons', |
| 2286 ]) | 2266 ]) |
| 2287 | 2267 |
| 2288 base_env.AddMethod(SDKInstallBin) | 2268 base_env.AddMethod(SDKInstallBin) |
| 2289 | 2269 |
| 2290 # The ARM and MIPS validators can be built for any target that doesn't use | 2270 # The ARM and MIPS validators can be built for any target that doesn't use |
| 2291 # ELFCLASS64. | 2271 # ELFCLASS64. |
| 2292 if not base_env.Bit('target_x86_64'): | 2272 if not base_env.Bit('build_x86_64'): |
| 2293 base_env.Append( | 2273 base_env.Append( |
| 2294 BUILD_SCONSCRIPTS = [ | 2274 BUILD_SCONSCRIPTS = [ |
| 2295 'src/trusted/validator_mips/build.scons', | 2275 'src/trusted/validator_mips/build.scons', |
| 2296 ]) | 2276 ]) |
| 2297 | 2277 |
| 2298 base_env.AddChromeFilesFromGroup('trusted_scons_files') | 2278 base_env.AddChromeFilesFromGroup('trusted_scons_files') |
| 2299 | 2279 |
| 2300 base_env.Replace( | 2280 base_env.Replace( |
| 2301 NACL_BUILD_FAMILY = 'TRUSTED', | 2281 NACL_BUILD_FAMILY = 'TRUSTED', |
| 2302 ) | 2282 ) |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 return linux_env | 2866 return linux_env |
| 2887 | 2867 |
| 2888 (linux_debug_env, linux_optimized_env) = \ | 2868 (linux_debug_env, linux_optimized_env) = \ |
| 2889 GenerateOptimizationLevels(MakeTrustedLinuxEnv()) | 2869 GenerateOptimizationLevels(MakeTrustedLinuxEnv()) |
| 2890 | 2870 |
| 2891 | 2871 |
| 2892 def BiasedBitcodeFlags(env): | 2872 def BiasedBitcodeFlags(env): |
| 2893 """ Return clang flags to use biased bitcode and generate native-ABI-compliant | 2873 """ Return clang flags to use biased bitcode and generate native-ABI-compliant |
| 2894 code. Does not imply pre-translation. | 2874 code. Does not imply pre-translation. |
| 2895 """ | 2875 """ |
| 2896 if env.Bit('target_x86_32'): | 2876 if env.Bit('build_x86_32'): |
| 2897 return ['--target=i686-unknown-nacl'] | 2877 return ['--target=i686-unknown-nacl'] |
| 2898 if env.Bit('target_x86_64'): | 2878 if env.Bit('build_x86_64'): |
| 2899 return ['--target=x86_64-unknown-nacl'] | 2879 return ['--target=x86_64-unknown-nacl'] |
| 2900 if env.Bit('target_arm'): | 2880 if env.Bit('build_arm'): |
| 2901 return ['--target=armv7-unknown-nacl-gnueabihf', '-mfloat-abi=hard'] | 2881 return ['--target=armv7-unknown-nacl-gnueabihf', '-mfloat-abi=hard'] |
| 2902 if env.Bit('target_mips32'): | 2882 if env.Bit('build_mips32'): |
| 2903 return [] | 2883 return [] |
| 2904 raise UserError('No known target bits set') | 2884 raise UserError('No known target bits set') |
| 2905 | 2885 |
| 2906 pre_base_env.AddMethod(BiasedBitcodeFlags) | 2886 pre_base_env.AddMethod(BiasedBitcodeFlags) |
| 2907 | 2887 |
| 2908 # Do this before the site_scons/site_tools/naclsdk.py stuff to pass it along. | 2888 # Do this before the site_scons/site_tools/naclsdk.py stuff to pass it along. |
| 2909 pre_base_env.Append( | 2889 pre_base_env.Append( |
| 2910 PNACL_BCLDFLAGS = ARGUMENTS.get('pnacl_bcldflags', '').split(':')) | 2890 PNACL_BCLDFLAGS = ARGUMENTS.get('pnacl_bcldflags', '').split(':')) |
| 2911 | 2891 |
| 2912 | 2892 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 PTHREAD_LIBS = ['pthread_private'], | 2964 PTHREAD_LIBS = ['pthread_private'], |
| 2985 DYNCODE_LIBS = ['nacl_dyncode_private'], | 2965 DYNCODE_LIBS = ['nacl_dyncode_private'], |
| 2986 EXCEPTION_LIBS = ['nacl_exception_private'], | 2966 EXCEPTION_LIBS = ['nacl_exception_private'], |
| 2987 LIST_MAPPINGS_LIBS = ['nacl_list_mappings_private'], | 2967 LIST_MAPPINGS_LIBS = ['nacl_list_mappings_private'], |
| 2988 RANDOM_LIBS = ['nacl_random_private'], | 2968 RANDOM_LIBS = ['nacl_random_private'], |
| 2989 ) | 2969 ) |
| 2990 | 2970 |
| 2991 def UsesAbiNote(env): | 2971 def UsesAbiNote(env): |
| 2992 """Return True if using a new-style GCC with .note.NaCl.ABI.* notes. | 2972 """Return True if using a new-style GCC with .note.NaCl.ABI.* notes. |
| 2993 This means there will always be an RODATA segment, even if just for the note.""" | 2973 This means there will always be an RODATA segment, even if just for the note.""" |
| 2994 return env.Bit('target_arm') and not env.Bit('bitcode') | 2974 return env.Bit('build_arm') and not env.Bit('bitcode') |
| 2995 | 2975 |
| 2996 nacl_env.AddMethod(UsesAbiNote) | 2976 nacl_env.AddMethod(UsesAbiNote) |
| 2997 | 2977 |
| 2998 def UnderWindowsCoverage(env): | 2978 def UnderWindowsCoverage(env): |
| 2999 """Return True if using running on coverage under windows.""" | 2979 """Return True if using running on coverage under windows.""" |
| 3000 if 'TRUSTED_ENV' not in env: | 2980 if 'TRUSTED_ENV' not in env: |
| 3001 return False | 2981 return False |
| 3002 return env['TRUSTED_ENV'].Bit('coverage_enabled') and env.Bit('host_windows') | 2982 return env['TRUSTED_ENV'].Bit('coverage_enabled') and env.Bit('host_windows') |
| 3003 | 2983 |
| 3004 nacl_env.AddMethod(UnderWindowsCoverage) | 2984 nacl_env.AddMethod(UnderWindowsCoverage) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3035 # For each architecture, we only attempt to make our inline | 3015 # For each architecture, we only attempt to make our inline |
| 3036 # assembly code work with one untrusted-code toolchain. For x86, | 3016 # assembly code work with one untrusted-code toolchain. For x86, |
| 3037 # we target GCC, but not PNaCl/Clang, because the latter's | 3017 # we target GCC, but not PNaCl/Clang, because the latter's |
| 3038 # assembly support has various quirks that we don't want to have | 3018 # assembly support has various quirks that we don't want to have |
| 3039 # to debug. For ARM, we target PNaCl/Clang, because that is the | 3019 # to debug. For ARM, we target PNaCl/Clang, because that is the |
| 3040 # only current ARM toolchain. One day, we will have an ARM GCC | 3020 # only current ARM toolchain. One day, we will have an ARM GCC |
| 3041 # toolchain, and we will no longer need to use inline assembly | 3021 # toolchain, and we will no longer need to use inline assembly |
| 3042 # with PNaCl/Clang at all. | 3022 # with PNaCl/Clang at all. |
| 3043 # | 3023 # |
| 3044 # For Non-SFI NaCl we use inline assembly in PNaCl/Clang. | 3024 # For Non-SFI NaCl we use inline assembly in PNaCl/Clang. |
| 3045 if not (env.Bit('target_arm') or env.Bit('target_mips32') | 3025 if not (env.Bit('build_arm') or env.Bit('build_mips32') |
| 3046 or env.Bit('nonsfi_nacl')): | 3026 or env.Bit('nonsfi_nacl')): |
| 3047 return False | 3027 return False |
| 3048 # Inline assembly does not work in pexes. | 3028 # Inline assembly does not work in pexes. |
| 3049 if env.Bit('pnacl_generate_pexe'): | 3029 if env.Bit('pnacl_generate_pexe'): |
| 3050 return False | 3030 return False |
| 3051 env.AddBiasForPNaCl() | 3031 env.AddBiasForPNaCl() |
| 3052 env.PNaClForceNative() | 3032 env.PNaClForceNative() |
| 3053 | 3033 |
| 3054 if env.Bit('target_x86_32'): | 3034 if env.Bit('build_x86_32'): |
| 3055 env.AppendUnique(CCFLAGS=['--target=i686-unknown-nacl']) | 3035 env.AppendUnique(CCFLAGS=['--target=i686-unknown-nacl']) |
| 3056 elif env.Bit('target_x86_64'): | 3036 elif env.Bit('build_x86_64'): |
| 3057 env.AppendUnique(CCFLAGS=['--target=x86_64-unknown-nacl']) | 3037 env.AppendUnique(CCFLAGS=['--target=x86_64-unknown-nacl']) |
| 3058 elif env.Bit('target_arm'): | 3038 elif env.Bit('build_arm'): |
| 3059 env.AppendUnique(CCFLAGS=['--target=armv7a-unknown-nacl-gnueabihf', | 3039 env.AppendUnique(CCFLAGS=['--target=armv7a-unknown-nacl-gnueabihf', |
| 3060 '-mfloat-abi=hard']) | 3040 '-mfloat-abi=hard']) |
| 3061 return True | 3041 return True |
| 3062 | 3042 |
| 3063 nacl_env.AddMethod(AllowInlineAssembly) | 3043 nacl_env.AddMethod(AllowInlineAssembly) |
| 3064 | 3044 |
| 3065 | 3045 |
| 3066 # TODO(mseaborn): Enable this unconditionally once the C code on the | 3046 # TODO(mseaborn): Enable this unconditionally once the C code on the |
| 3067 # Chromium side compiles successfully with this warning. | 3047 # Chromium side compiles successfully with this warning. |
| 3068 if not enable_chrome: | 3048 if not enable_chrome: |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3236 # See http://code.google.com/p/nativeclient/issues/detail?id=1298 | 3216 # See http://code.google.com/p/nativeclient/issues/detail?id=1298 |
| 3237 def GetLinkerScriptBaseName(env): | 3217 def GetLinkerScriptBaseName(env): |
| 3238 if env.Bit('build_x86_64'): | 3218 if env.Bit('build_x86_64'): |
| 3239 return 'elf_x86_64_nacl' | 3219 return 'elf_x86_64_nacl' |
| 3240 else: | 3220 else: |
| 3241 return 'elf_i386_nacl' | 3221 return 'elf_i386_nacl' |
| 3242 | 3222 |
| 3243 if (nacl_env.Bit('nacl_glibc') and | 3223 if (nacl_env.Bit('nacl_glibc') and |
| 3244 nacl_env.Bit('nacl_static_link')): | 3224 nacl_env.Bit('nacl_static_link')): |
| 3245 nacl_env.Append(LINKFLAGS=['-static']) | 3225 nacl_env.Append(LINKFLAGS=['-static']) |
| 3246 if nacl_env.Bit('target_x86'): | 3226 if nacl_env.Bit('build_x86'): |
| 3247 # The "-lc" is necessary because libgcc_eh depends on libc but for | 3227 # The "-lc" is necessary because libgcc_eh depends on libc but for |
| 3248 # some reason nacl-gcc is not linking with "--start-group/--end-group". | 3228 # some reason nacl-gcc is not linking with "--start-group/--end-group". |
| 3249 nacl_env.Append(LINKFLAGS=[ | 3229 nacl_env.Append(LINKFLAGS=[ |
| 3250 '-T', 'ldscripts/%s.x.static' % GetLinkerScriptBaseName(nacl_env), | 3230 '-T', 'ldscripts/%s.x.static' % GetLinkerScriptBaseName(nacl_env), |
| 3251 '-lc']) | 3231 '-lc']) |
| 3252 | 3232 |
| 3253 if nacl_env.Bit('running_on_valgrind'): | 3233 if nacl_env.Bit('running_on_valgrind'): |
| 3254 nacl_env.Append(CCFLAGS = ['-g', '-Wno-overlength-strings', | 3234 nacl_env.Append(CCFLAGS = ['-g', '-Wno-overlength-strings', |
| 3255 '-fno-optimize-sibling-calls'], | 3235 '-fno-optimize-sibling-calls'], |
| 3256 CPPDEFINES = [['DYNAMIC_ANNOTATIONS_ENABLED', '1' ], | 3236 CPPDEFINES = [['DYNAMIC_ANNOTATIONS_ENABLED', '1' ], |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 # We have to reinstantiate the naclsdk.py magic after clearing those flags, | 3500 # We have to reinstantiate the naclsdk.py magic after clearing those flags, |
| 3521 # so it regenerates the tool paths right. | 3501 # so it regenerates the tool paths right. |
| 3522 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. | 3502 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. |
| 3523 nacl_irt_env.ClearBits('nacl_glibc') | 3503 nacl_irt_env.ClearBits('nacl_glibc') |
| 3524 nacl_irt_env.ClearBits('nacl_pic') | 3504 nacl_irt_env.ClearBits('nacl_pic') |
| 3525 # The choice of toolchain used to build the IRT does not depend on the toolchain | 3505 # The choice of toolchain used to build the IRT does not depend on the toolchain |
| 3526 # used to build user/test code. The PNaCl toolchain is used on x86, except on | 3506 # used to build user/test code. The PNaCl toolchain is used on x86, except on |
| 3527 # Windows (because pnacl-clang doesn't run on Windows XP. If we stop supporting | 3507 # Windows (because pnacl-clang doesn't run on Windows XP. If we stop supporting |
| 3528 # building on XP, we can remove this exception). See | 3508 # building on XP, we can remove this exception). See |
| 3529 # https://code.google.com/p/nativeclient/issues/detail?id=3936 | 3509 # https://code.google.com/p/nativeclient/issues/detail?id=3936 |
| 3530 if (nacl_irt_env.Bit('target_mips32') or nacl_irt_env.Bit('target_x86_64') or | 3510 if (nacl_irt_env.Bit('build_mips32') or nacl_irt_env.Bit('build_x86_64') or |
| 3531 (nacl_irt_env.Bit('target_x86_32') and | 3511 (nacl_irt_env.Bit('build_x86_32') and |
| 3532 not nacl_irt_env.Bit('host_windows'))): | 3512 not nacl_irt_env.Bit('host_windows'))): |
| 3533 nacl_irt_env.SetBits('bitcode') | 3513 nacl_irt_env.SetBits('bitcode') |
| 3534 else: | 3514 else: |
| 3535 nacl_irt_env.ClearBits('bitcode') | 3515 nacl_irt_env.ClearBits('bitcode') |
| 3536 nacl_irt_env.ClearBits('pnacl_generate_pexe') | 3516 nacl_irt_env.ClearBits('pnacl_generate_pexe') |
| 3537 nacl_irt_env.ClearBits('use_sandboxed_translator') | 3517 nacl_irt_env.ClearBits('use_sandboxed_translator') |
| 3538 nacl_irt_env.Tool('naclsdk') | 3518 nacl_irt_env.Tool('naclsdk') |
| 3539 # These are unfortunately clobbered by running Tool, which | 3519 # These are unfortunately clobbered by running Tool, which |
| 3540 # we needed to do to get the destination directory reset. | 3520 # we needed to do to get the destination directory reset. |
| 3541 # We want all the same values from nacl_env. | 3521 # We want all the same values from nacl_env. |
| 3542 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], | 3522 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], |
| 3543 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], | 3523 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], |
| 3544 CCFLAGS=nacl_env['CCFLAGS'], | 3524 CCFLAGS=nacl_env['CCFLAGS'], |
| 3545 CFLAGS=nacl_env['CFLAGS'], | 3525 CFLAGS=nacl_env['CFLAGS'], |
| 3546 CXXFLAGS=nacl_env['CXXFLAGS']) | 3526 CXXFLAGS=nacl_env['CXXFLAGS']) |
| 3547 FixWindowsAssembler(nacl_irt_env) | 3527 FixWindowsAssembler(nacl_irt_env) |
| 3548 # Make it find the libraries it builds, rather than the SDK ones. | 3528 # Make it find the libraries it builds, rather than the SDK ones. |
| 3549 nacl_irt_env.Replace(LIBPATH='${LIB_DIR}') | 3529 nacl_irt_env.Replace(LIBPATH='${LIB_DIR}') |
| 3550 | 3530 |
| 3551 if nacl_irt_env.Bit('bitcode'): | 3531 if nacl_irt_env.Bit('bitcode'): |
| 3552 if nacl_irt_env.Bit('target_x86_64'): | 3532 if nacl_irt_env.Bit('build_x86_64'): |
| 3553 nacl_irt_env.Append(CCFLAGS=['--target=x86_64-unknown-nacl']) | 3533 nacl_irt_env.Append(CCFLAGS=['--target=x86_64-unknown-nacl']) |
| 3554 nacl_irt_env.Append(LINKFLAGS=['--target=x86_64-unknown-nacl', | 3534 nacl_irt_env.Append(LINKFLAGS=['--target=x86_64-unknown-nacl', |
| 3555 '--pnacl-allow-translate', | 3535 '--pnacl-allow-translate', |
| 3556 '-arch', 'x86-64']) | 3536 '-arch', 'x86-64']) |
| 3557 elif nacl_irt_env.Bit('target_x86_32'): | 3537 elif nacl_irt_env.Bit('build_x86_32'): |
| 3558 nacl_irt_env.Append(CCFLAGS=['--target=i686-unknown-nacl']) | 3538 nacl_irt_env.Append(CCFLAGS=['--target=i686-unknown-nacl']) |
| 3559 # X86-32 IRT needs to be callable with an under-aligned stack, so we disable | 3539 # X86-32 IRT needs to be callable with an under-aligned stack, so we disable |
| 3560 # SSE instructions, which can fault on misaligned addresses: see | 3540 # SSE instructions, which can fault on misaligned addresses: see |
| 3561 # https://code.google.com/p/nativeclient/issues/detail?id=3935 | 3541 # https://code.google.com/p/nativeclient/issues/detail?id=3935 |
| 3562 nacl_irt_env.Append(LINKFLAGS=['--target=i686-unknown-nacl', | 3542 nacl_irt_env.Append(LINKFLAGS=['--target=i686-unknown-nacl', |
| 3563 '--pnacl-allow-translate', | 3543 '--pnacl-allow-translate', |
| 3564 '-arch', 'x86-32', | 3544 '-arch', 'x86-32', |
| 3565 '-Wt,-mattr=-sse']) | 3545 '-Wt,-mattr=-sse']) |
| 3566 elif nacl_irt_env.Bit('target_mips32'): | 3546 elif nacl_irt_env.Bit('build_mips32'): |
| 3567 # Disable the PNaCl IRT verifier since it will complain about | 3547 # Disable the PNaCl IRT verifier since it will complain about |
| 3568 # __executable_start symbol not being a valid external symbol. | 3548 # __executable_start symbol not being a valid external symbol. |
| 3569 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) | 3549 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) |
| 3570 | 3550 |
| 3571 # The IRT is C only, don't link with the C++ linker so that it doesn't | 3551 # The IRT is C only, don't link with the C++ linker so that it doesn't |
| 3572 # start depending on the C++ standard library and (in the case of | 3552 # start depending on the C++ standard library and (in the case of |
| 3573 # libc++) pthread. | 3553 # libc++) pthread. |
| 3574 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. | 3554 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. |
| 3575 replace('pnacl-clang++', 'pnacl-clang'))) | 3555 replace('pnacl-clang++', 'pnacl-clang'))) |
| 3576 | 3556 |
| 3577 if nacl_irt_env.Bit('bitcode'): | 3557 if nacl_irt_env.Bit('bitcode'): |
| 3578 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) | 3558 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) |
| 3579 | 3559 |
| 3580 # All IRT code must avoid direct use of the TLS ABI register, which | 3560 # All IRT code must avoid direct use of the TLS ABI register, which |
| 3581 # is reserved for user TLS. Instead, ensure all TLS accesses use a | 3561 # is reserved for user TLS. Instead, ensure all TLS accesses use a |
| 3582 # call to __nacl_read_tp, which the IRT code overrides to segregate | 3562 # call to __nacl_read_tp, which the IRT code overrides to segregate |
| 3583 # IRT-private TLS from user TLS. This only applies to mips now, on | 3563 # IRT-private TLS from user TLS. This only applies to mips now, on |
| 3584 # other platforms we modify the TLS register through tls_edit as a | 3564 # other platforms we modify the TLS register through tls_edit as a |
| 3585 # post process. | 3565 # post process. |
| 3586 if nacl_irt_env.Bit('target_mips32'): | 3566 if nacl_irt_env.Bit('build_mips32'): |
| 3587 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) | 3567 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) |
| 3588 | 3568 |
| 3589 # TODO(mcgrathr): Clean up uses of these methods. | 3569 # TODO(mcgrathr): Clean up uses of these methods. |
| 3590 def AddLibraryDummy(env, nodes): | 3570 def AddLibraryDummy(env, nodes): |
| 3591 return nodes | 3571 return nodes |
| 3592 nacl_irt_env.AddMethod(AddLibraryDummy, 'AddLibraryToSdk') | 3572 nacl_irt_env.AddMethod(AddLibraryDummy, 'AddLibraryToSdk') |
| 3593 | 3573 |
| 3594 def AddObjectInternal(env, nodes): | 3574 def AddObjectInternal(env, nodes): |
| 3595 return env.Replicate('${LIB_DIR}', nodes) | 3575 return env.Replicate('${LIB_DIR}', nodes) |
| 3596 nacl_env.AddMethod(AddObjectInternal, 'AddObjectToSdk') | 3576 nacl_env.AddMethod(AddObjectInternal, 'AddObjectToSdk') |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 # We want to do this for nacl_env when not under --nacl_glibc, | 3634 # We want to do this for nacl_env when not under --nacl_glibc, |
| 3655 # but for nacl_irt_env whether or not under --nacl_glibc, so | 3635 # but for nacl_irt_env whether or not under --nacl_glibc, so |
| 3656 # we do it separately for each after making nacl_irt_env and | 3636 # we do it separately for each after making nacl_irt_env and |
| 3657 # clearing its Bit('nacl_glibc'). | 3637 # clearing its Bit('nacl_glibc'). |
| 3658 def AddImplicitLibs(env): | 3638 def AddImplicitLibs(env): |
| 3659 implicit_libs = [] | 3639 implicit_libs = [] |
| 3660 | 3640 |
| 3661 # Require the pnacl_irt_shim for pnacl x86-64 and arm. | 3641 # Require the pnacl_irt_shim for pnacl x86-64 and arm. |
| 3662 # Use -B to have the compiler look for the fresh libpnacl_irt_shim.a. | 3642 # Use -B to have the compiler look for the fresh libpnacl_irt_shim.a. |
| 3663 if ( env.Bit('bitcode') and | 3643 if ( env.Bit('bitcode') and |
| 3664 (env.Bit('target_x86_64') or env.Bit('target_arm')) | 3644 (env.Bit('build_x86_64') or env.Bit('build_arm')) |
| 3665 and env['NACL_BUILD_FAMILY'] != 'UNTRUSTED_IRT'): | 3645 and env['NACL_BUILD_FAMILY'] != 'UNTRUSTED_IRT'): |
| 3666 # Note: without this hack ibpnacl_irt_shim.a will be deleted | 3646 # Note: without this hack ibpnacl_irt_shim.a will be deleted |
| 3667 # when "built_elsewhere=1" | 3647 # when "built_elsewhere=1" |
| 3668 # Since we force the build in a previous step the dependency | 3648 # Since we force the build in a previous step the dependency |
| 3669 # is not really needed. | 3649 # is not really needed. |
| 3670 # Note: the "precious" mechanism did not work in this case | 3650 # Note: the "precious" mechanism did not work in this case |
| 3671 if not env.Bit('built_elsewhere'): | 3651 if not env.Bit('built_elsewhere'): |
| 3672 if env.Bit('enable_chrome_side'): | 3652 if env.Bit('enable_chrome_side'): |
| 3673 implicit_libs += ['libpnacl_irt_shim.a'] | 3653 implicit_libs += ['libpnacl_irt_shim.a'] |
| 3674 | 3654 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 nacl_env.ValidateSdk() | 4043 nacl_env.ValidateSdk() |
| 4064 | 4044 |
| 4065 if BROKEN_TEST_COUNT > 0: | 4045 if BROKEN_TEST_COUNT > 0: |
| 4066 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 4046 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
| 4067 if GetOption('brief_comstr'): | 4047 if GetOption('brief_comstr'): |
| 4068 msg += " Add --verbose to the command line for more information." | 4048 msg += " Add --verbose to the command line for more information." |
| 4069 print msg | 4049 print msg |
| 4070 | 4050 |
| 4071 # separate warnings from actual build output | 4051 # separate warnings from actual build output |
| 4072 Banner('B U I L D - O U T P U T:') | 4052 Banner('B U I L D - O U T P U T:') |
| OLD | NEW |