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 os | 7 import os |
8 import platform | 8 import platform |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2286 ]) | 2286 ]) |
2287 # /usr/lib makes sense for most configuration except this one | 2287 # /usr/lib makes sense for most configuration except this one |
2288 # No ARM compatible libs can be found there. | 2288 # No ARM compatible libs can be found there. |
2289 # So this just makes the command lines longer and sometimes results | 2289 # So this just makes the command lines longer and sometimes results |
2290 # in linker warnings referring to this directory. | 2290 # in linker warnings referring to this directory. |
2291 env.FilterOut(LIBPATH=['/usr/lib']) | 2291 env.FilterOut(LIBPATH=['/usr/lib']) |
2292 | 2292 |
2293 # get_plugin_dirname.cc has a dependency on dladdr | 2293 # get_plugin_dirname.cc has a dependency on dladdr |
2294 env.Append(LIBS=['dl']) | 2294 env.Append(LIBS=['dl']) |
2295 | 2295 |
2296 def SetupLinuxEnvMips(env): | |
2297 jail = '${SCONSTRUCT_DIR}/toolchain/linux_mips-trusted' | |
2298 if env.Bit('built_elsewhere'): | |
2299 def FakeInstall(dest, source, env): | |
2300 print 'Not installing', dest | |
2301 # Replace build commands with no-ops | |
2302 env.Replace(CC='true', CXX='true', LD='true', | |
2303 AR='true', RANLIB='true', INSTALL=FakeInstall) | |
2304 # Allow emulation on x86 hosts for testing built_elsewhere flag | |
2305 if not platform.machine().startswith('mips'): | |
2306 env.Replace(EMULATOR=jail + '/run_under_qemu_mips32') | |
2307 else: | |
2308 sys.path.append('tools/trusted_cross_toolchains') | |
2309 from setup_mips32_trusted_toolchain import mips32_env | |
2310 sys.path.pop() | |
2311 # Allow env vars to override these settings, for what it's worth. | |
2312 mips32_env = mips32_env.copy() | |
2313 mips32_env.update(os.environ) | |
2314 env.Replace(CC=mips32_env.get('MIPS32_CC', 'NO-MIPSEL-CC-SPECIFIED'), | |
2315 CXX=mips32_env.get('MIPS32_CXX', 'NO-MIPSEL-CXX-SPECIFIED' ), | |
Mark Seaborn
2012/09/08 02:43:14
Nit: fix indentation to line up with previous line
petarj
2012/09/11 16:58:13
Done.
| |
2316 LD=mips32_env.get('MIPS32_LD', 'NO-MIPSEL-LD-SPECIFIED'), | |
2317 EMULATOR=mips32_env.get('MIPS32_EMU', ''), | |
2318 ASFLAGS=[], | |
2319 LIBPATH=['${LIB_DIR}', | |
2320 mips32_env.get('MIPS32_LIB_DIR', '').split()], | |
2321 LINKFLAGS=mips32_env.get('MIPS32_LINKFLAGS', ''), | |
2322 ) | |
2323 | |
2324 env.Append(LIBS=['rt', 'dl', 'pthread', 'crypto', 'z'], | |
Mark Seaborn
2012/09/08 02:43:14
I'm pretty sure you don't need libcrypto -- I remo
petarj
2012/09/11 16:58:13
Done.
| |
2325 CCFLAGS=['-EL', '-Wl,-EL', '-march=mips32r2']) | |
2326 | |
2296 def MakeLinuxEnv(): | 2327 def MakeLinuxEnv(): |
2297 linux_env = MakeUnixLikeEnv().Clone( | 2328 linux_env = MakeUnixLikeEnv().Clone( |
2298 BUILD_TYPE = '${OPTIMIZATION_LEVEL}-linux', | 2329 BUILD_TYPE = '${OPTIMIZATION_LEVEL}-linux', |
2299 BUILD_TYPE_DESCRIPTION = 'Linux ${OPTIMIZATION_LEVEL} build', | 2330 BUILD_TYPE_DESCRIPTION = 'Linux ${OPTIMIZATION_LEVEL} build', |
2300 tools = ['target_platform_linux'], | 2331 tools = ['target_platform_linux'], |
2301 # TODO(bradnelson): this should really be able to live in unix_like_env | 2332 # TODO(bradnelson): this should really be able to live in unix_like_env |
2302 # but can't due to what the target_platform_x module is | 2333 # but can't due to what the target_platform_x module is |
2303 # doing. | 2334 # doing. |
2304 LINK = '$CXX', | 2335 LINK = '$CXX', |
2305 ) | 2336 ) |
(...skipping 18 matching lines...) Expand all Loading... | |
2324 LINKFLAGS = ['-m32', '-L/usr/lib32', ], | 2355 LINKFLAGS = ['-m32', '-L/usr/lib32', ], |
2325 ) | 2356 ) |
2326 elif linux_env.Bit('build_x86_64'): | 2357 elif linux_env.Bit('build_x86_64'): |
2327 linux_env.Prepend( | 2358 linux_env.Prepend( |
2328 CCFLAGS = ['-m64', ], | 2359 CCFLAGS = ['-m64', ], |
2329 LINKFLAGS = ['-m64', '-L/usr/lib64', ], | 2360 LINKFLAGS = ['-m64', '-L/usr/lib64', ], |
2330 ) | 2361 ) |
2331 elif linux_env.Bit('build_arm'): | 2362 elif linux_env.Bit('build_arm'): |
2332 SetupLinuxEnvArm(linux_env) | 2363 SetupLinuxEnvArm(linux_env) |
2333 elif linux_env.Bit('build_mips32'): | 2364 elif linux_env.Bit('build_mips32'): |
2334 # TODO(petarj): Add support for MIPS. | 2365 SetupLinuxEnvMips(linux_env) |
2335 pass | |
2336 else: | 2366 else: |
2337 Banner('Strange platform: %s' % GetPlatform()) | 2367 Banner('Strange platform: %s' % GetPlatform()) |
2338 | 2368 |
2339 # These are desireable options for every Linux platform: | 2369 # These are desireable options for every Linux platform: |
2340 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions | 2370 # _FORTIFY_SOURCE: general paranoia "hardening" option for library functions |
2341 # -fPIE/-pie: create a position-independent executable | 2371 # -fPIE/-pie: create a position-independent executable |
2342 # relro/now: "hardening" options for linking | 2372 # relro/now: "hardening" options for linking |
2343 # noexecstack: ensure that the executable does not get a PT_GNU_STACK | 2373 # noexecstack: ensure that the executable does not get a PT_GNU_STACK |
2344 # header that causes the kernel to set the READ_IMPLIES_EXEC | 2374 # header that causes the kernel to set the READ_IMPLIES_EXEC |
2345 # personality flag, which disables NX page protection. | 2375 # personality flag, which disables NX page protection. |
2346 linux_env.Prepend( | 2376 linux_env.Prepend( |
2347 CPPDEFINES=[['-D_FORTIFY_SOURCE', '2']], | 2377 CPPDEFINES=[['-D_FORTIFY_SOURCE', '2']], |
2348 LINKFLAGS=['-pie', '-Wl,-z,relro', '-Wl,-z,now', '-Wl,-z,noexecstack'], | 2378 LINKFLAGS=['-pie', '-Wl,-z,relro', '-Wl,-z,now', '-Wl,-z,noexecstack'], |
2349 ) | 2379 ) |
2350 # The ARM toolchain has a linker that doesn't handle the code its | 2380 # The ARM toolchain has a linker that doesn't handle the code its |
2351 # compiler generates under -fPIE. | 2381 # compiler generates under -fPIE. |
2352 if linux_env.Bit('build_arm'): | 2382 if linux_env.Bit('build_arm') or linux_env.Bit('build_mips32'): |
2353 linux_env.Prepend(CCFLAGS=['-fPIC']) | 2383 linux_env.Prepend(CCFLAGS=['-fPIC']) |
2354 # TODO(mcgrathr): Temporarily punt _FORTIFY_SOURCE for ARM because | 2384 # TODO(mcgrathr): Temporarily punt _FORTIFY_SOURCE for ARM because |
2355 # it causes a libc dependency newer than the old bots have installed. | 2385 # it causes a libc dependency newer than the old bots have installed. |
2356 linux_env.FilterOut(CPPDEFINES=[['-D_FORTIFY_SOURCE', '2']]) | 2386 linux_env.FilterOut(CPPDEFINES=[['-D_FORTIFY_SOURCE', '2']]) |
2357 else: | 2387 else: |
2358 linux_env.Prepend(CCFLAGS=['-fPIE']) | 2388 linux_env.Prepend(CCFLAGS=['-fPIE']) |
2359 | 2389 |
2360 # We always want to use the same flags for .S as for .c because | 2390 # We always want to use the same flags for .S as for .c because |
2361 # code-generation flags affect the predefines we might test there. | 2391 # code-generation flags affect the predefines we might test there. |
2362 linux_env.Replace(ASFLAGS=['${CCFLAGS}']) | 2392 linux_env.Replace(ASFLAGS=['${CCFLAGS}']) |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3311 nacl_env.ValidateSdk() | 3341 nacl_env.ValidateSdk() |
3312 | 3342 |
3313 if BROKEN_TEST_COUNT > 0: | 3343 if BROKEN_TEST_COUNT > 0: |
3314 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3344 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3315 if GetOption('brief_comstr'): | 3345 if GetOption('brief_comstr'): |
3316 msg += " Add --verbose to the command line for more information." | 3346 msg += " Add --verbose to the command line for more information." |
3317 print msg | 3347 print msg |
3318 | 3348 |
3319 # separate warnings from actual build output | 3349 # separate warnings from actual build output |
3320 Banner('B U I L D - O U T P U T:') | 3350 Banner('B U I L D - O U T P U T:') |
OLD | NEW |