libpthread: Convert semaphore implementation to using futexes

 * Convert nc_semaphore.c to using futexes instead of using the IRT's
   semaphore interface (which is being deprecated).

 * Remove __nc_irt_sem, and the IRT query call that populates it,
   because it is no longer used.

 * Change SEM_VALUE_MAX to be INT_MAX because we might as well match
   glibc here.  Fix the SEM_VALUE_MAX tests to work on glibc too, by
   adding "(unsigned)" casts to avoid compiler warnings about constant
   overflow.

Tests:

 * Remove some tests for incorrect usage of sem_*() functions.  These
   tests checked that errors were returned.  sem_*() aren't required
   to return errors in these cases, though, and these tests were
   already disabled for glibc.

 * Enable a test for sem_post()'s handling of SEM_VALUE_MAX, because
   it now passes.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3484
TEST=run_semaphore_tests run_thread_test run_race_test run_thread_stack_test

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11731 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Add remaining 'regular' instructions to text-based validator spec.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3453
TEST= validator targeted tests (on bots)
TEST= ./scons dfacheckvalidator
R=halyavin@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11732 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Alter how text-based spec treats multiple write operands.

Now, to match closer actual validator behavior, only the second of two writes is considered zero-extending.

Along the way, split 'xhcg/xadd with mem' targeted tests into two pieces and add reference to related bug.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3453
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3071
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3487
TEST= this, on bots
R=halyavin@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11733 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Delete targeted validator test for push with memory operand.

(it became pointless years ago with the introduction of memory read sandboxing)

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3487
TEST= validator targeted tests (on bots)
R=halyavin@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11734 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Disallow access to control, debug and test registers in text-based spec.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3453
TEST= this, on bots
R=halyavin@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11735 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Add ud2 to text-based validator spec.

nacl-objdump prints ud2 as 'ud2a', while regular objdump (which our decoder is based on) prints 'ud2'

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3453
TEST= ./scons dfacheckvalidator
R=khim@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11736 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl driver: Make pnacl-strip ignore frozen bitcode.

Also make filetype cache shared across the filetype library, and clear it
when modifying a file in-place.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11737 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Rolling from revision 11698 to 11731

My particular reason for this roll is to get r11726 which should fix the SPEC regression on equake, but there are other changes:

r11730 | Disable the irt-blockhook (GC hooks) interface under PNaCl
r11728 | Pass file format argument from driver to pnacl-abicheck
r11727 | PNaCl driver: Factor file type checking into its own library
r11726 | Update LLVM revision in pnacl/DEPS. Pulls in:
r11725 | Update gcc revision in pnacl/DEPS. Pulls in a change in libstdc++:
r11724 | Fix checkdeps breakage introduced by r11723
r11723 | Disable some deprecated/disallowed IRT interfaces under PNaCl
r11722 | Update Clang revision in pnacl/DEPS. Pulls in:
r11718 | PNaCl: Update GCC revision in pnacl/DEPS: fix x86-64 stack unwinding
r11716 | Revert "Make pnacl-strip ignore frozen PNaCl bitcode."
r11715 | Make pnacl-strip ignore frozen PNaCl bitcode.
r11714 | Test that *InstPrinter::print* are pruned from sandboxed llvm.
r11713 | Run install-unwind-header at llvm-install time.
r11711 | PNaCl: Update LLVM revision in pnacl/DEPS: addend fix; translator pruning
r11708 | PNaCl: Extend llvm_try_change_helper.sh to work for Clang, binutils, etc.

BUG=None
R=dschuff@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11738 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Disable malloc()'s use of sbrk() to allocate memory in nacl-newlib

This is a step towards removing the sbrk() implementations from sbrk.c
and sbrk_private.c (or at least making them return an error).
However, that is more complex because it involves updating tests that
cover sbrk().  These tests will need to be changed to test
irt_memory's sysbrk() instead.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3542
TEST="pnacl-dis malloc.bc" shows that it doesn't call sbrk() any more

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11739 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl driver: don't run filetype test without host binaries
TBR=jvoung@chromium.org,nufullagar@chromium.org
BUG=none

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11740 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Enable x86-64 stack unwinding test under PNaCl

This test passes following the recent toolchain revision update.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=1933
TEST=run_unwind_restores_regs_test pnacl_generate_pexe=0

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11741 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Convert sbrk_test.c to test the IRT directly rather than testing sbrk()

Rework the test a little to make it clearer.  Add comments explaining
what is being tested.  Remove code to handle an unaligned break
pointer (because it never runs in practice) and instead assert that
the break pointer is aligned.

Add documentation for sysbrk() in irt.h to make it clearer what the
test should be testing for.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11742 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Disable building with GYP on win32 bots. This was broken in r10959.

Building via GYP always builds all toolchains (i.e. newlib, glibc, pnacl) by
default, but the win32 XP pnacl builds are pathologically slow (~38 seconds per compile on
the nacl-win32_glibc_opt trybot).

We could just disable pnacl, but we have Windows GYP testing on other bots --
disabling it for win32 is not reducing test coverage much.

BUG=none
R=jvoung@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11743 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
[MIPS] Remove NaClCheckDEP for MIPS

MIPS sandboxing does not require DEP, and the target MIPS platforms do not
support it. Thus, this change removes the code we do not need.

NOTRY=true
However, we have run a try job manually, and it passed fine, except for
the nacl-lucid64_validator_opt that is broken.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=2275
TEST= run smoke tests for MIPS platform

Review URL: https://chromiumcodereview.appspot.com/18861003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11744 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Build nacl_list_mappings and nosys w/ pnacl using GYP.

This will allow us to use GYP to build the NaCl SDK, instead of scons.

BUG=none
R=jvoung@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11745 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Mark movbe as non-zero-extening in text-based validator spec.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3453
TEST= ./scons dfacheckvalidator
R=halyavin@google.com, khim@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11746 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Allow alternate name for NaCl entry point.

This change allows the newlib _start function to use
'__nacl_main' as the entry point in place of 'main'.
The normal 'main' entry point is still used if no
'__nacl_main' symbol is linked into the binary.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11747 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Dedupe files for goma parallel build.

build_nexe.py automatically starts parallel build if goma is available.
If there are duplicated files listed to build, parallel build may cause
race condition.  Two threads may try to remove the same file, and it causes
the unexpected OSError.

To avoid this situation, files are deduped using set().  Since building
the same file twice is also waste of resources in non-parallel build,
files are deduped early in build_nexe.py.

Landing with NOTRY as on of the trybots is currently
failing consistently.

BUG= https://code.google.com/p/chromium/issues/detail?id=254599
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/18152003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11748 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Change nacl-newlib's sbrk() to be a no-op wrapper that returns ENOSYS

sbrk() is no longer used by malloc() and
__pthread_initialize_minimal(), so this only affects tests.

sbrk_private.c is no longer needed because it would have the same
contents as sbrk.c.

Remove two tests for sbrk() while keeping the tests for the sysbrk()
syscall:

 * TestSbrk() just tests that sbrk() can change the break pointer by a
   relative increment, which is the functionality we're removing.

 * TestIllegalSbrk() tests the same thing as TestIllegalSysbrk() but
   does it via sbrk() rather than sysbrk().

These sbrk() tests weren't enabled for nacl-glibc so we're not losing
any glibc test coverage.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@11749 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl: Disallow the IRT semaphore interface, now that libpthread doesn't use it

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3484
TEST=PNaCl toolchain trybots

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

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