toolchain_build_pnacl: Add support for cmake, clang, and sanitizers

Ninja is mostly for our own convenience, and sanitizers are obviously
useful for debugging. If at some point we add support for building
the gold plugin in the Windows CMake buid, we can switch to cmake
entirely.

The ideal behavior (IMO) for this would be to have separate build
directories for the autoconf and cmake-built targets (i.e. give them
different target names) but not require them both to be built
in a 'build-all' run, and still have an easy mechanism for the
target libs to depend on one or the other (so you don't have to
build the target libs with the sanitized version if you don't want
to, and/or you don't keep triggering rebuilds of the target libs).
That might be made feasible by a mechanism which would e.g. allow
a target to be defined but not built by default.
For now, we use the same target name which has different behavior
depending on the flags, and the user can choose when to clobber
and when/what to install using the -c and -i flags.

R=jfb@chromium.org, jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3719

Review URL: https://codereview.chromium.org/152513012

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12719 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl: Update Clang revision in pnacl/COMPONENT_REVISIONS

This pulls in the following Clang change:

6606795: (jvoung@chromium.org) Cherrypick clang r199335 to make i686-nacl longlong alignment match nacl-gcc.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3650
TEST= PNaCl toolchain trybots
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/132113014

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12720 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Remove old sel_main_chrome.h/nacl_chrome.h interface variants

Specifically, remove:
 * sel_main_chrome.h header, replaced by nacl_chrome.h.
 * initial_ipc_desc and urandom_fd, replaced by NaClAppSetDesc()
   and NaClChromeMainSetUrandomFd().
 * NaClChromeMainStart(), replaced by NaClChromeMainStartApp().

Update sel_main_chrome_test.cc to cover the new code path.

Add some CHECKs to ensure functions are called in the proper order.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3734
TEST=run_sel_main_chrome_test
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/141713011

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12721 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Add a couple more mnemonics to pnacl-ld (-u, --trace, --library, etc.)

Also, gold only accepts -relocatable not --relocatable. The
driver already matched that in the option parsing, but the
help message was off.

BUG=none
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/149913007

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12722 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl driver: use module-splitting by default for offline translation.

For finalized pexes, use up to 4-way module splitting if there are enough cores.

Also update LLVM revision in pnacl/COMPONENT_REVISIONS.
This pulls in the following LLVM changes:

3456b4e: (dschuff@chromium.org) parallelize pnacl-llc's module splitting with pthreads.
814a483: (dschuff@chromium.org) Fix pathnames to run LLVM regressions with msys make

R=jfb@chromium.org, jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3777
https://code.google.com/p/nativeclient/issues/detail?id=3719

Review URL: https://codereview.chromium.org/154723003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12723 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
IRT TLS now depends on tls_edit instead of compiling in changes.

IRT used to compile in the IRT offsets directly, now we just compile it
normally and depend on tls_edit to point the instructions to the right
TLs location.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3127
TEST= trybots
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/150963002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12724 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
NaCl: Remove bad comment in sel_main_chrome.c

The comment above NaClSecureCommandChannel() in sel_main_chrome.c is incorrect. It appears to have been copied directly from sel_main.c.

NaClSecureCommandChannel() creates the SRPC-handling thread that handles the "load_module" request which calls NaClAppLoadFile(), so NaClAppLoadFile() can't be called before we call NaClSecureCommandChannel().

I'm removing this since it caused some confusion when reading through code.

BUG=none

Review URL: https://codereview.chromium.org/157653002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12725 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Fix arm rules for pnacl_native_biased in untrusted.gypi.

Split checking of target_arch into conditions and checking of
target_defaults variables into target_conditions.

Made some changes last time, splitting the x86 checks into
conditions and target conditions, and forget to check
ARM again / do the same.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3784
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/157643003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12726 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Make 32-bit LLVM builds correct with cmake

Also brings in the following LLVM revision in COMPONENT_REVISIONS:
1096df: Allow disabling of libxml in the cmake build

R=jfb@chromium.org, jvoung@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/157843002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12727 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Refactor and add detach, kill, complete, disconnect gdb tests.

Changed gdb tests to gracefully exit.
Added detach, kill, complete, and disconnect tests.

Refactor existing tests to use unittest.
Move gdb.Quit() to tearDown for consistency (some tests had call it directly, others relied on the one in gdb_test.py)

Disabling stepi_after_break on arm/mips under qemu as it doesn't work reliably there due to inability to flush the code cache.

R=mseaborn@chromium.org, bsy@google.com
BUG=None
TEST=gdb tests (added detach, kill, complete, disconnect)

Review URL: https://codereview.chromium.org/141113009

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12728 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update TOOL_REVISIONS for PNaCl r12703->r12727

Pull the following PNaCl changes into NaCl:
  r12707: (dschuff@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 3456b4e: (dschuff@chromium.org) parallelize pnacl-llc's module splitting with pthreads.
    | 814a483: (dschuff@chromium.org) Fix pathnames to run LLVM regressions with msys make
  r12717: (mcgrathr@chromium.org) toolchain_build: Update gdb to 7.7 release
  r12718: (noelallen@google.com) Add bionic upload
  r12719: (dschuff@chromium.org) toolchain_build_pnacl: Add support for cmake, clang, and sanitizers
  r12720: (jvoung@google.com) PNaCl: Update Clang revision in pnacl/COMPONENT_REVISIONS
    | 6606795: (jvoung@chromium.org) Cherrypick clang r199335 to make i686-nacl longlong alignment match nacl-gcc.
  r12722: (jvoung@google.com) Add a couple more mnemonics to pnacl-ld (-u, --trace, --library, etc.)
  r12723: (dschuff@chromium.org) PNaCl driver: use module-splitting by default for offline translation.
    | 3456b4e: (dschuff@chromium.org) parallelize pnacl-llc's module splitting with pthreads.
    | 814a483: (dschuff@chromium.org) Fix pathnames to run LLVM regressions with msys make
  r12727: (dschuff@chromium.org) Make 32-bit LLVM builds correct with cmake

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3777
BUG= 337703
BUG= none
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3650
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3719
R= noelallen@google.com, jvoung@google.com, bradnelson@google.com, jvoung@chromium.org, dschuff@chromium.org, jfb@chromium.org, mcgrathr@chromium.org, dyen@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/152213005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12729 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Remove remaining reference to irt-local aeabi_read_tp.S from irt.gyp.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3127
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/141313005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12730 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Turn on tests/callingconv_case_by_case for PNaCl --target=i686-nacl.

fixed after r12720 rolled in

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3650
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/140663015

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12731 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Dropping remaining python_26 references.

We recently started using the environment provide python on windows.
Scripts that invoke scons.bat (toolchain), however, were still hitting a copy
of python_26 checked out on the bots.

Dropping this reference to python_26.

BUG=http://code.google.com/p/chromium/issues/detail?id=319558
TEST=trybots
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/152383003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12732 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update .DEPS.git

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12733 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Default to all trybot sets when pynacl/ code is touched

The code in the new pynacl/ subdirectory is used by toolchain_build
Python code, pnacl Python code, and other Python code.  So run all
the bots.

BUG= none
TEST= trybots
R=dyen@chromium.org, ncbray@chromium.org

Review URL: https://codereview.chromium.org/154863004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12734 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Add pnacl-compress driver tool to compress pnacl bitcode files.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/147323007

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12735 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Fix more instances of use-after-free due to incorrect clean up.

TEST= small_tests
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3785

Review URL: https://codereview.chromium.org/155773003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12736 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update newlib revision used by toolchain builders.

This brings in the following newlib change:

a9ae3c6: Fix fopen.c when REENTRANT_SYSCALLS_PROVIDED is defined.
384617c: Remove isatty and rename symbols from newlib NaCl build.
8a6bb89: Define REENTRANT_SYSCALLS_PROVIDED when building for NaCl.

TEST= toolchain trybots
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3776
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/136303009

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12737 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
build_nexe.py can now apply tls_edit

Instead of custom gyp rules to apply tls_edit to IRT nexe's, build_nexe
can now apply tls_edit as an option. The gyp rule to build IRTs using
build_nexe.py can simply specify this option making all the custom
gyp rules irrelevent.

Note this change does not actually remove the extra tls_edit gyp rules,
that will be done as a separate step.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3127
TEST= trybots
R=bradnelson@google.com, mcgrathr@chromium.org, noelallen@chromium.org

Review URL: https://codereview.chromium.org/137803016

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12738 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2