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 3450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3461 | 3461 |
3462 | 3462 |
3463 # The IRT-building environment was cloned from nacl_env, but it should | 3463 # The IRT-building environment was cloned from nacl_env, but it should |
3464 # ignore the --nacl_glibc, nacl_pic=1 and bitcode=1 switches. | 3464 # ignore the --nacl_glibc, nacl_pic=1 and bitcode=1 switches. |
3465 # We have to reinstantiate the naclsdk.py magic after clearing those flags, | 3465 # We have to reinstantiate the naclsdk.py magic after clearing those flags, |
3466 # so it regenerates the tool paths right. | 3466 # so it regenerates the tool paths right. |
3467 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. | 3467 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. |
3468 nacl_irt_env.ClearBits('nacl_glibc') | 3468 nacl_irt_env.ClearBits('nacl_glibc') |
3469 nacl_irt_env.ClearBits('nacl_pic') | 3469 nacl_irt_env.ClearBits('nacl_pic') |
3470 nacl_irt_env.ClearBits('nacl_clang') | 3470 nacl_irt_env.ClearBits('nacl_clang') |
3471 nacl_irt_env.ClearBits('pnacl_generate_pexe') | |
3472 nacl_irt_env.ClearBits('use_sandboxed_translator') | |
3473 | |
3471 # The choice of toolchain used to build the IRT does not depend on the toolchain | 3474 # The choice of toolchain used to build the IRT does not depend on the toolchain |
3472 # used to build user/test code. The PNaCl toolchain is used on x86, except on | 3475 # used to build user/test code. PNaCl is used on mips because that's currently |
3473 # Windows (because pnacl-clang doesn't run on Windows XP. If we stop supporting | 3476 # the only compiler for mips. nacl-clang is used on x86. |
3474 # building on XP, we can remove this exception). See | 3477 if nacl_irt_env.Bit('build_mips32'): |
3475 # https://code.google.com/p/nativeclient/issues/detail?id=3936 | |
3476 if (nacl_irt_env.Bit('build_mips32') or nacl_irt_env.Bit('build_x86_64') or | |
3477 (nacl_irt_env.Bit('build_x86_32') and | |
3478 not nacl_irt_env.Bit('host_windows'))): | |
3479 nacl_irt_env.SetBits('bitcode') | 3478 nacl_irt_env.SetBits('bitcode') |
3480 else: | 3479 else: |
3481 nacl_irt_env.ClearBits('bitcode') | 3480 nacl_irt_env.ClearBits('bitcode') |
3482 nacl_irt_env.ClearBits('pnacl_generate_pexe') | 3481 if nacl_irt_env.Bit('build_x86_64') or nacl_irt_env.Bit('build_x86_32'): |
3483 nacl_irt_env.ClearBits('use_sandboxed_translator') | 3482 nacl_irt_env.SetBits('nacl_clang') |
3483 # The IRT must be built using LLVM's assembler on x86-64 to preserve sandbox | |
3484 # base address hiding. It's also used on x86-32 for consistency. | |
3485 nacl_irt_env.Append(CCFLAGS=['-integrated-as']) | |
3486 if nacl_irt_env.Bit('build_x86_32'): | |
3487 # The x86-32 IRT needs to be callable with an under-aligned stack. | |
3488 # See https://code.google.com/p/nativeclient/issues/detail?id=3935 | |
Mark Seaborn
2015/03/19 20:54:48
Nit: excess space after "See"
| |
3489 nacl_irt_env.Append(CCFLAGS=['-mstackrealign', '-mno-sse']) | |
Mark Seaborn
2015/03/19 20:54:48
How are we applying these for the libraries in the
Derek Schuff
2015/03/19 21:28:29
The libraries do not need to be compiled without S
| |
3490 | |
3484 nacl_irt_env.Tool('naclsdk') | 3491 nacl_irt_env.Tool('naclsdk') |
3485 # These are unfortunately clobbered by running Tool, which | 3492 # These are unfortunately clobbered by running Tool, which |
3486 # we needed to do to get the destination directory reset. | 3493 # we needed to do to get the destination directory reset. |
3487 # We want all the same values from nacl_env. | 3494 # We want all the same values from nacl_env. |
3488 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], | 3495 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], |
3489 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], | 3496 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], |
3490 CCFLAGS=nacl_env['CCFLAGS'], | 3497 CCFLAGS=nacl_env['CCFLAGS'], |
3491 CFLAGS=nacl_env['CFLAGS'], | 3498 CFLAGS=nacl_env['CFLAGS'], |
3492 CXXFLAGS=nacl_env['CXXFLAGS']) | 3499 CXXFLAGS=nacl_env['CXXFLAGS']) |
3493 FixWindowsAssembler(nacl_irt_env) | 3500 FixWindowsAssembler(nacl_irt_env) |
3494 # Make it find the libraries it builds, rather than the SDK ones. | 3501 # Make it find the libraries it builds, rather than the SDK ones. |
3495 nacl_irt_env.Replace(LIBPATH='${LIB_DIR}') | 3502 nacl_irt_env.Replace(LIBPATH='${LIB_DIR}') |
3496 | 3503 |
3497 if nacl_irt_env.Bit('bitcode'): | 3504 if nacl_irt_env.Bit('bitcode'): |
3498 if nacl_irt_env.Bit('build_x86_64'): | 3505 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) |
3499 nacl_irt_env.Append(CCFLAGS=['--target=x86_64-unknown-nacl']) | 3506 if nacl_irt_env.Bit('build_mips32'): |
3500 nacl_irt_env.Append(LINKFLAGS=['--target=x86_64-unknown-nacl', | |
3501 '--pnacl-allow-translate', | |
3502 '-arch', 'x86-64']) | |
3503 elif nacl_irt_env.Bit('build_x86_32'): | |
3504 nacl_irt_env.Append(CCFLAGS=['--target=i686-unknown-nacl']) | |
3505 # X86-32 IRT needs to be callable with an under-aligned stack, so we disable | |
3506 # SSE instructions, which can fault on misaligned addresses: see | |
3507 # https://code.google.com/p/nativeclient/issues/detail?id=3935 | |
3508 nacl_irt_env.Append(LINKFLAGS=['--target=i686-unknown-nacl', | |
3509 '--pnacl-allow-translate', | |
3510 '-arch', 'x86-32', | |
3511 '-Wt,-mattr=-sse']) | |
3512 elif nacl_irt_env.Bit('build_mips32'): | |
3513 # Disable the PNaCl IRT verifier since it will complain about | 3507 # Disable the PNaCl IRT verifier since it will complain about |
3514 # __executable_start symbol not being a valid external symbol. | 3508 # __executable_start symbol not being a valid external symbol. |
3515 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) | 3509 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) |
3516 | 3510 |
3517 # The IRT is C only, don't link with the C++ linker so that it doesn't | 3511 # The IRT is C only, don't link with the C++ linker so that it doesn't |
3518 # start depending on the C++ standard library and (in the case of | 3512 # start depending on the C++ standard library and (in the case of |
3519 # libc++) pthread. | 3513 # libc++) pthread. |
3520 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. | 3514 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. |
3521 replace('pnacl-clang++', 'pnacl-clang'))) | 3515 replace('pnacl-clang++', 'pnacl-clang'))) |
3516 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. | |
3517 replace('nacl-clang++', 'nacl-clang'))) | |
3522 | 3518 |
3523 if nacl_irt_env.Bit('bitcode'): | |
3524 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) | |
3525 | 3519 |
3526 # All IRT code must avoid direct use of the TLS ABI register, which | 3520 # All IRT code must avoid direct use of the TLS ABI register, which |
3527 # is reserved for user TLS. Instead, ensure all TLS accesses use a | 3521 # is reserved for user TLS. Instead, ensure all TLS accesses use a |
3528 # call to __nacl_read_tp, which the IRT code overrides to segregate | 3522 # call to __nacl_read_tp, which the IRT code overrides to segregate |
3529 # IRT-private TLS from user TLS. This only applies to mips now, on | 3523 # IRT-private TLS from user TLS. This only applies to mips now, on |
3530 # other platforms we modify the TLS register through tls_edit as a | 3524 # other platforms we modify the TLS register through tls_edit as a |
3531 # post process. | 3525 # post process. |
3532 if nacl_irt_env.Bit('build_mips32'): | 3526 if nacl_irt_env.Bit('build_mips32'): |
3533 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) | 3527 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) |
3534 | 3528 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4009 nacl_env.ValidateSdk() | 4003 nacl_env.ValidateSdk() |
4010 | 4004 |
4011 if BROKEN_TEST_COUNT > 0: | 4005 if BROKEN_TEST_COUNT > 0: |
4012 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 4006 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
4013 if GetOption('brief_comstr'): | 4007 if GetOption('brief_comstr'): |
4014 msg += " Add --verbose to the command line for more information." | 4008 msg += " Add --verbose to the command line for more information." |
4015 print msg | 4009 print msg |
4016 | 4010 |
4017 # separate warnings from actual build output | 4011 # separate warnings from actual build output |
4018 Banner('B U I L D - O U T P U T:') | 4012 Banner('B U I L D - O U T P U T:') |
OLD | NEW |