Drop secure channel lock before invoking NaClAppShutdown

Holding the secure channel lock while invoking NaClAppShutdown in
NaClSecureServiceConnectionCountDecr can lead to a deadlock when
application exits in a normal manner and invokes NaClAppReportExitStatus
which reports the exit status over NaClReverseHostInterface.

To avoid deadlock, we need to make sure we do not already hold the secure
service lock while taking the NaClApp lock. This change modifies
NaClSecureServiceConnectionCountDecr to drop the secure service lock
before invoking NaClAppShutdown which takes the NaClApp lock.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3653
TEST= small_tests
R=bsy@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12063 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
toolchain_build: Update binutils revision

This brings in a recent upstream fix, plus the support for
padding code segments out to page size.

BUG= none
TEST= toolchain trybots
R=bradnelson@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12064 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update newlib revision for all toolchains

This brings in the following change which brings the PNaCl
newlib into parity with the x86 and arm newlib builds:

  ff87898 Add -DSIGNAL_PROVIDED to NaCl build

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3646
TEST= toolchain buildbots
R=mseaborn@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12065 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update bot config for clang/asan mac bots 10.6 -> 10.7

Note the Mac Clang trybot is still 10.6.

BUG= none
TEST= none
R=bsy@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12066 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Change calling conv case-by-case test to always use --target for bitcode.

Take out the "pnaclcall" attribute tests / GCC commandline
flag tests since we no longer use "pnaclcall" in the IRT
shim.

If we run -expand-byval whenever --target is *not* given,
(https://codereview.chromium.org/22867042/) then it will
break these tests.  So, change these tests first.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12067 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update PNaCl binutils DEPS
Brings in removal of tls symbol type check for plugin symbols.
R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3478

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12068 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update perf expectation for TestThreadCreateAndJoin for lucid-32-bare-newlib-opt

This is not a permanent solution, since the performance statistics
gathering should generate smoother data (ignore more outliers?).
Other tests may experience similar larger variations and similarly
require updating.

Once statistics gathering has been improved, we probably will need to
update the performance expectations again to narrow the acceptable
window.

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12069 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Use biased bitcode for calling conv fuzz test, turn on struct passing.

Struct passing has a different ABI from gcc unless we use
the --target flags to bias the bitcode.

However, things are broken for x86-32.  Add at least the
self-consistency test, which is not using biased bitcode
and is not broken.

Without the --target, this test won't work if we want to
apply -expand-byval to AOT compiles:
https://codereview.chromium.org/22867042/

BUG=http://code.google.com/p/nativeclient/issues/detail?id=1902
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3650

shuffling how we test the ARM bugs:
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2378
BUG=http://code.google.com/p/nativeclient/issues/detail?id=3143

Those aren't fixed by biased bitcode, but they work with
pure bitcode linking, so test that too.

R=dschuff@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12070 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update binutils in ARM toolchain

The new binutils pads the code segment out to a page boundary.  This
requires changing the expectation of some of the "halt sled" test cases.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3621
TEST= trybots
R=bsy@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12071 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Run -expand-byval to make calling convs match, when not using --target=*

The current way of avoiding ABI simplification passes
completely when using C++ exceptions works for NaCl only
programs, but it does not work for PPAPI programs.
That is because PPAPI programs link to a shim which expects
us to have changed the calling convention.

Run -expand-byval to make calling convs match for PPAPI
programs.  Don't run it if targeting the native ABI.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=3488
NOTRY=true
R=dschuff@chromium.org

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

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

This brings in:
  b097198  Move .note.gnu.build-id to rodata segment
  10cd99c  Provide symbols for .note.gnu.build-id section bounds
  8060546  Update disassembler in NaCl binutils

  698564c  Backport GCC 4.5+ --enable-linker-build-id option
  f96a3cb  Fix mcount counter generation
  d913bb7  Use x86_64_general_operand in a bunch more SI mode insn patterns
  aca852e  Use x86_64_*_operand in LEA splitters
  46c2b9f  Use long long builtins of zero counting for x86-64

  2324fd9  Provide symbols for .note.gnu.build-id section bounds
  325363b  Allow use of alternative 'main' symbol
  f6905ea  Fix undefined NULL by including stddef.h
  8ec02f0  Enable process and thread CPU time clocks

R=halyavin@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12073 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
PNaCl: Fixes for mixed bitcode/native linking
1) In the linker, properly handle mixed bitcode/native archive libs, in particular when using --start-group/--end-group. These mostly worked accidentally already but now they are tested.
2) When specifying the __pnacl_start entrypoint, create an undefined reference to _start. _start is referenced from the shim (which is linked at the end of the native link). Usually _start comes from libnacl and will be in the pexe, but the IRT's special _start comes from libirt_browser and the object file containing won't get pulled in otherwise.
3) Add driver tests for the --target flag for the compiler (linker tests don't really work with the current driver test framework)
4) Add test for mixed use of TLS variables. These work currently but result in a non-fatal gold error (see https://codereview.chromium.org/23484004/ )

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12074 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
lower code coverage expectations, hopefully only temporarily

BUG= none
TEST= none
R=mcgrathr@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12075 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update PNaCl rev from 12036 to 12072, and turn on EH+CC tests.

r12072 | Run -expand-byval to make calling convs match, when not using --target=*
r12068 | Update PNaCl binutils DEPS
r12065 | Update newlib revision for all toolchains
r12062 | Update PNaCl DEPS to revert shared lib localmods to gold plugin and libLTO
r12060 | PNaCl driver support for empty archives
r12058 | Update pnacl llvm revisions.
r12053 | The archive checker should accept empty archives
r12052 | Remove symbol-wrapping support from pnacl-ld
r12047 | Make the PNaCl prune_test work with ninja builds of LLVM.

BUG=none
R=dschuff@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12076 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Fix library dependencies in pnacl_native_libs tests

Append rather than overwrite IMPLICIT_LIBS (otherwise the dependence on
libnacl is not honored).
R=jvoung@chromium.org
BUG=flaky pnacl_native_objects tests

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12077 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
update perf expectation for TestTlsVariable win7-64-bare-newlib-opt

BUG= none
TEST= none
R=jfb@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12078 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Update PNaCl LLVM rev.

fa8d800 Hardcode NaCl in ADT/Triple.h for NaCl only builds (no Darwin/Windows).
493d4ab Handle pointer conversions for call instructions.
1171118 PNaCl bitcode: Remove definition of unused constant, SWITCH_INST_MAGIC

BUG= https://code.google.com/p/nativeclient/issues/detail?id=1222
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590
R=kschimpf@google.com

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12079 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Add MachO and COFF symbols that are pruned to the pnacl prune_test.

Goes with: https://codereview.chromium.org/23453014/

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

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12080 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
run validator_arm tests on x86-64 too.

there doesn't seem to be any reason for these tests to be disabled on
x86-64, and re-enabling them makes our coverage statistics on those
bots more consistent with those from x86-32.

BUG= none
TEST= this enables more tests
R=jfb@chromium.org

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

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@12081 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
Revert 12081.  nacl-precise_64-newlib-dbg-clang was green, but really TODO(mcgrathr): linux clang disabled pending bot upgrades

It does appear that clang found a minor bug.  After this revert, the
CL for the bugfix will have to go in, before reverting this revert.

TBR= jfb@chromium.org
BUG= none
TEST= none

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

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