Chromium Code Reviews| 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 | |
| 3471 # The choice of toolchain used to build the IRT does not depend on the toolchain | 3472 # 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 | 3473 # 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 | 3474 # the only compiler for mips. nacl-clang is used on x86. |
| 3474 # building on XP, we can remove this exception). See | 3475 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') | 3476 nacl_irt_env.SetBits('bitcode') |
| 3480 else: | 3477 else: |
| 3481 nacl_irt_env.ClearBits('bitcode') | 3478 nacl_irt_env.ClearBits('bitcode') |
| 3479 if nacl_irt_env.Bit('build_x86_64') or nacl_irt_env.Bit('build_x86_32'): | |
| 3480 nacl_irt_env.SetBits('nacl_clang') | |
| 3481 # The IRT must be built using LLVM's assembler on x86-64 to preserve sandbox | |
| 3482 # base address hiding. It's also use on x86-32 for consistency. | |
|
jvoung (off chromium)
2015/03/19 17:36:25
"It's also use on" -> "It's also used on"
or somet
Derek Schuff
2015/03/19 18:36:16
Done.
| |
| 3483 nacl_irt_env.Append(CCFLAGS=['-integrated-as']) | |
|
jvoung (off chromium)
2015/03/19 17:36:25
Might want to check with Nick about the GN build.
Derek Schuff
2015/03/19 18:36:16
Yeah, my plan was to get this landed for gyp and e
| |
| 3484 if nacl_irt_env.Bit('build_x86_32'): | |
| 3485 # The x86-32 IRT needs to be callable with an under-aligned stack. | |
| 3486 # See https://code.google.com/p/nativeclient/issues/detail?id=3935 | |
| 3487 nacl_irt_env.Append(CCFLAGS=['-mstackrealign', '-mno-sse']) | |
| 3488 | |
| 3482 nacl_irt_env.ClearBits('pnacl_generate_pexe') | 3489 nacl_irt_env.ClearBits('pnacl_generate_pexe') |
|
jvoung (off chromium)
2015/03/19 17:36:25
Maybe these last couple of ClearBits('...') should
Derek Schuff
2015/03/19 18:36:16
Done.
| |
| 3483 nacl_irt_env.ClearBits('use_sandboxed_translator') | 3490 nacl_irt_env.ClearBits('use_sandboxed_translator') |
| 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 if nacl_irt_env.Bit('build_x86_64'): |
|
jvoung (off chromium)
2015/03/19 17:36:25
this case isn't possible anymore?
Derek Schuff
2015/03/19 18:36:16
Done.
| |
| 3499 nacl_irt_env.Append(CCFLAGS=['--target=x86_64-unknown-nacl']) | 3506 nacl_irt_env.Append(CCFLAGS=['--target=x86_64-unknown-nacl']) |
| 3500 nacl_irt_env.Append(LINKFLAGS=['--target=x86_64-unknown-nacl', | 3507 nacl_irt_env.Append(LINKFLAGS=['--target=x86_64-unknown-nacl', |
| 3501 '--pnacl-allow-translate', | 3508 '--pnacl-allow-translate', |
| 3502 '-arch', 'x86-64']) | 3509 '-arch', 'x86-64']) |
| 3503 elif nacl_irt_env.Bit('build_x86_32'): | 3510 elif nacl_irt_env.Bit('build_x86_32'): |
|
jvoung (off chromium)
2015/03/19 17:36:25
same
Derek Schuff
2015/03/19 18:36:16
Done.
| |
| 3504 nacl_irt_env.Append(CCFLAGS=['--target=i686-unknown-nacl']) | 3511 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 | 3512 # 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 | 3513 # SSE instructions, which can fault on misaligned addresses: see |
| 3507 # https://code.google.com/p/nativeclient/issues/detail?id=3935 | 3514 # https://code.google.com/p/nativeclient/issues/detail?id=3935 |
| 3508 nacl_irt_env.Append(LINKFLAGS=['--target=i686-unknown-nacl', | 3515 nacl_irt_env.Append(LINKFLAGS=['--target=i686-unknown-nacl', |
| 3509 '--pnacl-allow-translate', | 3516 '--pnacl-allow-translate', |
| 3510 '-arch', 'x86-32', | 3517 '-arch', 'x86-32', |
| 3511 '-Wt,-mattr=-sse']) | 3518 '-Wt,-mattr=-sse']) |
| 3512 elif nacl_irt_env.Bit('build_mips32'): | 3519 elif nacl_irt_env.Bit('build_mips32'): |
| 3513 # Disable the PNaCl IRT verifier since it will complain about | 3520 # Disable the PNaCl IRT verifier since it will complain about |
| 3514 # __executable_start symbol not being a valid external symbol. | 3521 # __executable_start symbol not being a valid external symbol. |
| 3515 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) | 3522 nacl_irt_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) |
| 3516 | 3523 |
| 3517 # The IRT is C only, don't link with the C++ linker so that it doesn't | 3524 # 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 | 3525 # start depending on the C++ standard library and (in the case of |
| 3519 # libc++) pthread. | 3526 # libc++) pthread. |
| 3520 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. | 3527 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. |
| 3521 replace('pnacl-clang++', 'pnacl-clang'))) | 3528 replace('pnacl-clang++', 'pnacl-clang'))) |
| 3529 nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK']. | |
| 3530 replace('nacl-clang++', 'nacl-clang'))) | |
| 3522 | 3531 |
| 3523 if nacl_irt_env.Bit('bitcode'): | 3532 if nacl_irt_env.Bit('bitcode'): |
| 3524 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) | 3533 nacl_irt_env.Append(LINKFLAGS=['--pnacl-allow-native']) |
|
jvoung (off chromium)
2015/03/19 17:36:24
Could put this under the "3504 if nacl_irt_env.Bit
Derek Schuff
2015/03/19 18:36:16
Done.
| |
| 3525 | 3534 |
| 3526 # All IRT code must avoid direct use of the TLS ABI register, which | 3535 # 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 | 3536 # 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 | 3537 # 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 | 3538 # 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 | 3539 # other platforms we modify the TLS register through tls_edit as a |
| 3531 # post process. | 3540 # post process. |
| 3532 if nacl_irt_env.Bit('build_mips32'): | 3541 if nacl_irt_env.Bit('build_mips32'): |
| 3533 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) | 3542 nacl_irt_env.Append(LINKFLAGS=['-Wt,-mtls-use-call']) |
| 3534 | 3543 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4009 nacl_env.ValidateSdk() | 4018 nacl_env.ValidateSdk() |
| 4010 | 4019 |
| 4011 if BROKEN_TEST_COUNT > 0: | 4020 if BROKEN_TEST_COUNT > 0: |
| 4012 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 4021 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
| 4013 if GetOption('brief_comstr'): | 4022 if GetOption('brief_comstr'): |
| 4014 msg += " Add --verbose to the command line for more information." | 4023 msg += " Add --verbose to the command line for more information." |
| 4015 print msg | 4024 print msg |
| 4016 | 4025 |
| 4017 # separate warnings from actual build output | 4026 # separate warnings from actual build output |
| 4018 Banner('B U I L D - O U T P U T:') | 4027 Banner('B U I L D - O U T P U T:') |
| OLD | NEW |