native_client/src/native_client.git
43 hours agoAdded tests for unlink functions irt_ext. master
dyen@chromium.org [Sat, 20 Sep 2014 00:21:48 +0000 (00:21 +0000)]
Added tests for unlink functions irt_ext.

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

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

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

45 hours agoAdded tests for rename functions in irt_ext.
dyen@chromium.org [Fri, 19 Sep 2014 22:35:38 +0000 (22:35 +0000)]
Added tests for rename functions in irt_ext.

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

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

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

46 hours agoAllowed decrementing program break with sbrk() in MinSFI
dbrazdil@google.com [Fri, 19 Sep 2014 21:29:52 +0000 (21:29 +0000)]
Allowed decrementing program break with sbrk() in MinSFI

Even though the POSIX standard does not define the behaviour of sbrk()
when its 'increment' argument is negative, dlmalloc does free memory
by calling sbrk() in that way. This patch changes sbrk() so that it
does not trap but rather adjusts the untrusted program break accordingly.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons platform=x86_64 bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

46 hours agoUpdate .DEPS.git
chrome-admin@google.com [Fri, 19 Sep 2014 21:28:29 +0000 (21:28 +0000)]
Update .DEPS.git

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

46 hours agoUpdate .DEPS.git
chrome-admin@google.com [Fri, 19 Sep 2014 21:26:31 +0000 (21:26 +0000)]
Update .DEPS.git

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

47 hours agoPass naclsdk_validate=0 to scons runs run by main waterfall bots
dschuff@chromium.org [Fri, 19 Sep 2014 21:01:17 +0000 (21:01 +0000)]
Pass naclsdk_validate=0 to scons runs run by main waterfall bots

r13764 changed the directory layout used by the PNaCl toolchain; SCons
checks for the presence of headers in this known location when it starts
up, to be sure the NaCl compiler is present, and that revision updated
it to the new location. This means the main waterfall bots would be
broken until the toolchain rolls. So disable them for now. This
can be reverted after the next PNaCl toolchain roll.

R=jvoung@chromium.org
BUG=red bots

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

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

47 hours agoSwitch PNaCl lib, include, and translator directories for new layout
dschuff@chromium.org [Fri, 19 Sep 2014 20:21:29 +0000 (20:21 +0000)]
Switch PNaCl lib, include, and translator directories for new layout

This makes the directory layout more like a standard gnu-style toolchain and more suitable for support of multiple architectures, which will be used in direct-to-nacl mode. For now, since the biased bitcode builds will have to be around until direct-to-nacl mode can replace them, they are included in the same scheme as if they were their own architectures.

For now the directories used by the translator (the "native libs" and translator nexes) have a similar layout to before except that they all move into the translator/ directory.

The changes to the bitcode lib builds should also make it easier to reuse them  for direct-to-nacl mode if desired.

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

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

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

2 days agoAdd CreateNaClDescWithFilePathMetadata fn.
teravest@chromium.org [Fri, 19 Sep 2014 19:48:48 +0000 (19:48 +0000)]
Add CreateNaClDescWithFilePathMetadata fn.

This change adds a method to create a NaClDesc for a NaClHandle which has
file path information without requiring the emebedder to do some of the work
preparing the internals of the NaClDesc.

WithFilePathMetadata has been added to the end of this method name since ncbray
suggested that we may want to create validated NaClDescs using different
metadata types.

BUG=chromium:394130
R=mseaborn@chromium.org

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

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

2 days agoSupport file path metadata for the main nexe.
teravest@chromium.org [Fri, 19 Sep 2014 18:21:58 +0000 (18:21 +0000)]
Support file path metadata for the main nexe.

Instead of passing file token data to the plugin for the main nexe, Chromium is
changing to fetch file path metadata on the browser and pass it down to the
plugin initially. This removes an unnecessary IPC round trip and simplifies the
main nexe loading codepath.

This change allows an embedder to supply a NaClDesc that already has origin
information and is marked safe-for-mmap, instead of clearing that information
and fetching metadata based on file tokens.

As far as I can tell, the existing call to NaClDescMarkUnsafeForMmap()
is unnecessary since I don't see how that desc could have been marked
safe for mmap.

This is needed to support a Chromium-side change to simplify validation behavior
for the main nexe:
  https://codereview.chromium.org/572973002

This has been manually tested with that change.

BUG=chromium:394130
R=mseaborn@chromium.org

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

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

2 days agoFix mmap() with length > 0xffff0000 to behave consistently on 32/64-bit
mseaborn@chromium.org [Fri, 19 Sep 2014 06:55:35 +0000 (06:55 +0000)]
Fix mmap() with length > 0xffff0000 to behave consistently on 32/64-bit

Before this change, mmap() with such a length would succeed on x86-32
(this was a corner-case where creating a zero-length mapping was
allowed) but fail on x86-64 with ENOMEM.

This adds tests for two cases:
 * mmap() with length == 0
 * mmap() with length == 0xffffffff

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

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

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

2 days agountrusted.gypi: Factor out duplicated "--gomadir" option
mseaborn@chromium.org [Fri, 19 Sep 2014 00:04:06 +0000 (00:04 +0000)]
untrusted.gypi: Factor out duplicated "--gomadir" option

This can be moved to "common_args".

I tested this by doing the following:

cd ..
./native_client/build/gyp_nacl native_client/build/all.gyp \
    --generator-output=out-gyp -D use_goma=1 -D gomadir=MYGOMADIR

I checked that the makefiles in out-gyp pass "--gomadir=MYGOMADIR"
before and after the change.

I also checked that there was no change when omitting "-D gomadir=..."
and when passing "-D use_goma=0".

BUG=none
TEST=see above

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

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

2 days agoUpdate revision for PNaCl r13739->r13753
dschuff@chromium.org [Thu, 18 Sep 2014 23:22:47 +0000 (23:22 +0000)]
Update revision for PNaCl r13739->r13753

Pull the following PNaCl changes into NaCl:
  r13745: (jvoung@google.com) PNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS
    | e58178a: (wala@chromium.org) Subzero: Factor our commonalities between mov-like instructions.
    | c8e8781: (jvoung@chromium.org) Convert lit test llvm-mc -arch arguments to full -triple.
    | f820da5: (jvoung@chromium.org) Emit .local before .comm for bss to make llvm-mc happy.
    | d4799f4: (wala@chromium.org) Subzero: Align spill locations to natural alignment.
    | 9dbe38e: (wala@chromium.org) Subzero: Start a list of SIMD improvement ideas.
    | c330274: (wala@chromium.org) Subzero: Randomly insert nops.
    | 4d79fe5: (stichnot@chromium.org) Subzero: Fix the simple register allocation for -Om1.
    | 420e8bf: (stichnot@chromium.org) COmmit
    | 6170e75: (stichnot@chromium.org) Revert "COmmit"
    | bfb03e5: (stichnot@chromium.org) Subzero: Fixes for Hello World and bisection debugging.
    | ac9c943: (stichnot@chromium.org) Subzero: Add a check-lit target for faster smoke testing.
    | ef8cf0e: (stichnot@chromium.org) Subzero: Fix some legalization issues involving immediates.
    | 14c3f41: (stichnot@chromium.org) Subzero: Fix the link command for Trusty.
    | 89d7956: (stichnot@chromium.org) Subzero: Fix address mode optimization involving phi temporaries.
    | d6064a1: (kschimpf@google.com) Start processing function blocks.
    | ce58163: (jvoung@chromium.org) Add pnacl-freeze to the tests_lit/lit.cfg. Also, unsigned vs signed.
    | b17f61d: (jvoung@chromium.org) Align function starts to target-specific bundle alignment.
    | dddc306: (jvoung@chromium.org) Convert lit tests to check disassembled assembly.
    | c0fdc27: (kschimpf@google.com) Add cast instructions to subzero's pnacl bitcode translator.
    | 16178a1: (stichnot@chromium.org) Subzero: Remove the need for a separate NaCl SDK installation.
    | 94539ce: (stichnot@chromium.org) Subzero: Rename -external to -externalize to match llc.
    | 71ba822: (kschimpf@google.com) Add vector insert/extract instructions to Subzero bitcode reader.
    | cabfa30: (stichnot@chromium.org) Subzero: Render constants in dump() to be more like LLVM.
    | dd7b846: (stichnot@chromium.org) Subzero: Make sure register preferences obey register class constraints.
    | 523ef72: (stichnot@chromium.org) Subzero: Work around another llvm-mc parser bug for relocatable symbols.
    | 1d6f0e4: (kschimpf@google.com) Add select instruction to Subzero bitcode reader.
    | dd30c81: (stichnot@chromium.org) Subzero: Fix sext/zext lowering with i1 source operands.
    | 83f9f0c: (kschimpf@google.com) Add icmp and fcmp instructions to Subzero bitcode reader.
    | c836acb: (kschimpf@google.com) Add branch instructions to Subzero bitcode reader.
    | b63cd88: (stichnot@chromium.org) Subzero: Use cvttss2si and similar instead of cvtss2si for fp->int casts.
    | 3ef786f: (stichnot@chromium.org) Subzero: Be more strict about i1 calculations.
    | 7076c88: (stichnot@chromium.org) Subzero: Move python scripts into a common pydir.
    | f12355e: (kschimpf@google.com) Add constants block to PNaCl bitcode reader.
    | 72a8f8d: (stichnot@chromium.org) Subzero: Make sure alloca with align=0 is handled correctly.
    | 10ea698: (stichnot@chromium.org) Subzero: Add a script that builds a hybrid Subzero/llc native executable.
    | 742d72d: (kschimpf@google.com) Add alloca instruction to Subzero bitcode reader.
    | 6d4f564: (stichnot@chromium.org) Subzero: The cross tests should use the actual Subzero runtime.
    | a262333: (jvoung@chromium.org) List Subzero's local optlevel flags after LLVM's cxxflags (precedence).
    | e5a5be7: (stichnot@chromium.org) Subzero: Fix Phi lowering.
    | 41689df: (kschimpf@google.com) Add load and store instructions to Subzero bitcode reader.
    | 64dcde7: (kschimpf@google.com) Fix bug introduced by CL 561883002.
    | c132b76: (kschimpf@google.com) Fix symbol table handling in functions.
    | 65d8d53: (stichnot@chromium.org) Subzero: Print defaults as appropriate in python script help text.
    | 4766156: (kschimpf@google.com) Add phi instruction to Subzero bitcode reader.
    | 44d53e1: (jvoung@chromium.org) Mark setjmp as "returns twice" and turn off SimpleCoalescing when called.
    | 5ee234a: (kschimpf@google.com) Allow ability to name unnamed global addresses in Subzero.
    | 1eb3a55: (jvoung@chromium.org) Switch to llvm::findFirstSet instead of ffs since mingw doesn't have ffs.
  r13749: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 41b16f5: (jvoung@chromium.org) Ensure that x86 prefixes are bundled-locked to instruction (in asm mode).
    | f33570d: (kschimpf@google.com) Allow errors in PNaCl bitcode readers to be directed to any raw_ostream.
  r13752: (uekawa@chromium.org) NonSFI mode: Add libcrt_platform for native/mixed linking.
  r13753: (dschuff@chromium.org) Remove i686-hosted Linux build and start switching to new directory layout

BUG= https://code.google.com/p/chromium/issues/detail?id=408879
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3929
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3946
R= uekawa@chromium.org, kschimpf@google.com, jvoung@chromium.org, dschuff@chromium.org, jvoung@google.com, noelallen@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

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

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

2 days agoCleanup: Use NaClCopyInFromUser() in one case in mmap()
mseaborn@chromium.org [Thu, 18 Sep 2014 23:15:02 +0000 (23:15 +0000)]
Cleanup: Use NaClCopyInFromUser() in one case in mmap()

Using NaClCopyInFromUser() is preferred over NaClUserToSysAddrRange()
(+ a volatile memory access) where possible, because it takes care of
any necessary locking.

It looks like this case was missed when the NaClCopyIn/Out functions
were introduced.

Also remove an unnecessary check for "offp == 0".  This is left over
from when mmap() was converted from taking a 32-bit offset arg (by
value) to taking a 64-bit offset arg (by pointer).  It was added as a
sanity check against accidentally forgetting to convert call sites of
the mmap syscall.  The conversion was done long ago, so this check is
no longer needed.

BUG=none
TEST=run_mmap_test and others

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

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

2 days agoDisable goma on win7-32 bots because it doesn't suport that platform.
bradnelson@google.com [Thu, 18 Sep 2014 22:29:43 +0000 (22:29 +0000)]
Disable goma on win7-32 bots because it doesn't suport that platform.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3933
BUG=https://code.google.com/p/chromium/issues/detail?id=390764
TEST=None
R=ncbray@chromium.org

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

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

2 days agoImplemented the _exit() syscall in MinSFI.
dbrazdil@google.com [Thu, 18 Sep 2014 22:00:39 +0000 (22:00 +0000)]
Implemented the _exit() syscall in MinSFI.

The syscall allows to immediatelly terminate execution of the
sandbox. It is implemented with the C setjmp/longjmp exception
mechanism, and will jump back to the MinsfiInvokeSandbox function.

Calling exit() now becomes the only legal way of terminating
the sandbox, and returning from the entry function is considered
an error. This allows us to conform to the standard signature of
_start() which returns void.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons platform=x86_64 bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

3 days agoTurning on goma on nacl bots.
bradnelson@google.com [Thu, 18 Sep 2014 19:51:50 +0000 (19:51 +0000)]
Turning on goma on nacl bots.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3933
BUG=https://code.google.com/p/chromium/issues/detail?id=390764
TEST=trybots
R=ncbray@chromium.org, mseaborn@chromium.org

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

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

3 days agoexport_header.py: Mangle include guards in exported headers
dschuff@chromium.org [Thu, 18 Sep 2014 19:42:39 +0000 (19:42 +0000)]
export_header.py: Mangle include guards in exported headers

Some code (e.g. in the IRT) compiled by newlib compilers #includes
headers directly from native_client/src/trusted/service_runtime/include
e.g. to use the definitions of NACL_ABI_-prefixed errno values.
However if some other header causes the exported version of errno.h in the
toolchain to be included first, its include guard will prevent the direct
version from src/trusted from acutally being included.

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

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

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

3 days agoRemove i686-hosted Linux build and start switching to new directory layout
dschuff@chromium.org [Thu, 18 Sep 2014 19:40:54 +0000 (19:40 +0000)]
Remove i686-hosted Linux build and start switching to new directory layout

Switch the default host for the toolchain on Linux to x86_64, and stop
building the i686 version.

Also stop using the host_x86_{32,64} directories for host binaries and
instead put everything (including the driver scripts) into bin/
(This also reverts r13694, removing the pnacl-llc driver script, as that
was the only script that had a name clash with an LLVM binary. It was
only added as a proxy to the pnacl-llc binary anyway).

This moves us closer to a layout that is more direct-to-nacl-friendly
and more like existing gnu-style toolchains.
Also update the README file which describes the layout. It reflects the
intended eventual state (including the placement of the PNaCl target
libraries and translator libraries which will move in a separate CL), but
does not yet include direct-to-nacl-related items.

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

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

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

3 days agoNonSFI mode: Add libcrt_platform for native/mixed linking.
uekawa@chromium.org [Thu, 18 Sep 2014 18:43:07 +0000 (18:43 +0000)]
NonSFI mode: Add libcrt_platform for native/mixed linking.

For ARM link failure happens trying to link exception_test.o because
of missing __aeabi_read_tp symbol, this solves the problem.

$ ./scons -j20 --mode=dbg-host,nacl_irt_test bitcode=1 nonsfi_nacl=1 \
  pnacl_generate_pexe=0 run_exception_test_irt \
  use_newlib_nonsfi_loader=0 platform=arm

BUG= https://code.google.com/p/chromium/issues/detail?id=408879
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3951

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

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

3 days agoNonSFI mode: Make tests/common/register_set.h PIC-friendly
uekawa@chromium.org [Thu, 18 Sep 2014 01:17:29 +0000 (01:17 +0000)]
NonSFI mode: Make tests/common/register_set.h PIC-friendly

For x86-32 obtain address via GOT instead.

This is a necessary preparation to be able to compile via
pnacl-clang for Non-SFI NaCl.
ARM version is already position-independent.

BUG= https://code.google.com/p/chromium/issues/detail?id=408879

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

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

3 days agoAdded tests for remaining directory functions in irt_ext.
dyen@chromium.org [Wed, 17 Sep 2014 22:49:59 +0000 (22:49 +0000)]
Added tests for remaining directory functions in irt_ext.

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

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

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

5 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Tue, 16 Sep 2014 20:01:05 +0000 (20:01 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM change:

41b16f5: (jvoung@chromium.org) Ensure that x86 prefixes are bundled-locked to instruction (in asm mode).
f33570d: (kschimpf@google.com) Allow errors in PNaCl bitcode readers to be directed to any raw_ostream.

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

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

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

6 days agoPass -std=gnu++0x in build_nexe.py.
thakis@chromium.org [Mon, 15 Sep 2014 17:19:48 +0000 (17:19 +0000)]
Pass -std=gnu++0x in build_nexe.py.

Doing this here instead of untrusted.gypi since the option isn't valid for
C files.

BUG=chromium:414314
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:linux_rel_precise32,linux_nacl_sdk,linux_chromium_dbg,linux_arm_cross_compile
R=dschuff@chromium.org

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

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

6 days agoFix toolchain build and sandboxed translation tests on FYI bots
dschuff@chromium.org [Mon, 15 Sep 2014 15:51:08 +0000 (15:51 +0000)]
Fix toolchain build and sandboxed translation tests on FYI bots

The FYI bots are not running the step which downloads the current
Chrome clang, and so are failing to build the toolchain.
The sandboxed translation tests are also failing because a service
runtime test depends on a nexe built by the toolchain.

This CL adds the clang update step, and disables the "trusted"
NaCl tests (as we do on other scons runs that test the PNaCl
toolchain)

R=jvoung@chromium.org
BUG=red FYI bots

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

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

8 days agoAdd creat() declaration to newlib fcntl.h
sbc@chromium.org [Sat, 13 Sep 2014 01:13:30 +0000 (01:13 +0000)]
Add creat() declaration to newlib fcntl.h

newlib contains generic creat() implementation that
forwards to open(). We are already shipping this
in libcrt_common.a but not declaring it.

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

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

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

8 days agoPNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Fri, 12 Sep 2014 23:38:31 +0000 (23:38 +0000)]
PNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS

This pulls in the following Subzero changes:

e58178a: (wala@chromium.org) Subzero: Factor our commonalities between mov-like instructions.
c8e8781: (jvoung@chromium.org) Convert lit test llvm-mc -arch arguments to full -triple.
f820da5: (jvoung@chromium.org) Emit .local before .comm for bss to make llvm-mc happy.
d4799f4: (wala@chromium.org) Subzero: Align spill locations to natural alignment.
9dbe38e: (wala@chromium.org) Subzero: Start a list of SIMD improvement ideas.
c330274: (wala@chromium.org) Subzero: Randomly insert nops.
4d79fe5: (stichnot@chromium.org) Subzero: Fix the simple register allocation for -Om1.
420e8bf: (stichnot@chromium.org) COmmit
6170e75: (stichnot@chromium.org) Revert "COmmit"
bfb03e5: (stichnot@chromium.org) Subzero: Fixes for Hello World and bisection debugging.
ac9c943: (stichnot@chromium.org) Subzero: Add a check-lit target for faster smoke testing.
ef8cf0e: (stichnot@chromium.org) Subzero: Fix some legalization issues involving immediates.
14c3f41: (stichnot@chromium.org) Subzero: Fix the link command for Trusty.
89d7956: (stichnot@chromium.org) Subzero: Fix address mode optimization involving phi temporaries.
d6064a1: (kschimpf@google.com) Start processing function blocks.
ce58163: (jvoung@chromium.org) Add pnacl-freeze to the tests_lit/lit.cfg. Also, unsigned vs signed.
b17f61d: (jvoung@chromium.org) Align function starts to target-specific bundle alignment.
dddc306: (jvoung@chromium.org) Convert lit tests to check disassembled assembly.
c0fdc27: (kschimpf@google.com) Add cast instructions to subzero's pnacl bitcode translator.
16178a1: (stichnot@chromium.org) Subzero: Remove the need for a separate NaCl SDK installation.
94539ce: (stichnot@chromium.org) Subzero: Rename -external to -externalize to match llc.
71ba822: (kschimpf@google.com) Add vector insert/extract instructions to Subzero bitcode reader.
cabfa30: (stichnot@chromium.org) Subzero: Render constants in dump() to be more like LLVM.
dd7b846: (stichnot@chromium.org) Subzero: Make sure register preferences obey register class constraints.
523ef72: (stichnot@chromium.org) Subzero: Work around another llvm-mc parser bug for relocatable symbols.
1d6f0e4: (kschimpf@google.com) Add select instruction to Subzero bitcode reader.
dd30c81: (stichnot@chromium.org) Subzero: Fix sext/zext lowering with i1 source operands.
83f9f0c: (kschimpf@google.com) Add icmp and fcmp instructions to Subzero bitcode reader.
c836acb: (kschimpf@google.com) Add branch instructions to Subzero bitcode reader.
b63cd88: (stichnot@chromium.org) Subzero: Use cvttss2si and similar instead of cvtss2si for fp->int casts.
3ef786f: (stichnot@chromium.org) Subzero: Be more strict about i1 calculations.
7076c88: (stichnot@chromium.org) Subzero: Move python scripts into a common pydir.
f12355e: (kschimpf@google.com) Add constants block to PNaCl bitcode reader.
72a8f8d: (stichnot@chromium.org) Subzero: Make sure alloca with align=0 is handled correctly.
10ea698: (stichnot@chromium.org) Subzero: Add a script that builds a hybrid Subzero/llc native executable.
742d72d: (kschimpf@google.com) Add alloca instruction to Subzero bitcode reader.
6d4f564: (stichnot@chromium.org) Subzero: The cross tests should use the actual Subzero runtime.
a262333: (jvoung@chromium.org) List Subzero's local optlevel flags after LLVM's cxxflags (precedence).
e5a5be7: (stichnot@chromium.org) Subzero: Fix Phi lowering.
41689df: (kschimpf@google.com) Add load and store instructions to Subzero bitcode reader.
64dcde7: (kschimpf@google.com) Fix bug introduced by CL 561883002.
c132b76: (kschimpf@google.com) Fix symbol table handling in functions.
65d8d53: (stichnot@chromium.org) Subzero: Print defaults as appropriate in python script help text.
4766156: (kschimpf@google.com) Add phi instruction to Subzero bitcode reader.
44d53e1: (jvoung@chromium.org) Mark setjmp as "returns twice" and turn off SimpleCoalescing when called.
5ee234a: (kschimpf@google.com) Allow ability to name unnamed global addresses in Subzero.
1eb3a55: (jvoung@chromium.org) Switch to llvm::findFirstSet instead of ffs since mingw doesn't have ffs.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3929
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3892
TEST= PNaCl toolchain trybots
R=kschimpf@google.com

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

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

8 days agoOnly allow fastbuild to affect symbol level.
bradnelson@google.com [Fri, 12 Sep 2014 22:15:16 +0000 (22:15 +0000)]
Only allow fastbuild to affect symbol level.

We've misinterpreted what fastbuild was meant to control in the chrome build.
It was only meant to affect the debug information level.
We instead allowed it to affect optimization.
Switching it to match chrome.

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

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

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

8 days agoAdd a checkdeps stage to the PNaCl bots/trybots as well.
jvoung@chromium.org [Fri, 12 Sep 2014 22:08:41 +0000 (22:08 +0000)]
Add a checkdeps stage to the PNaCl bots/trybots as well.

Make it slightly more consistent with buildbot_standard
and the PNaCl toolchain bots.

This helps check things when running tryjobs on only the
PNaCl bots, before running full tryjobs on all bots.

BUG=none

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

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

9 days agoAdded testing for file dup/dup2 functions for irt_ext.
dyen@chromium.org [Fri, 12 Sep 2014 20:09:23 +0000 (20:09 +0000)]
Added testing for file dup/dup2 functions for irt_ext.

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

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

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

9 days agoImplemented sysconf(), sbrk(), malloc() in MinSFI.
dbrazdil@google.com [Fri, 12 Sep 2014 19:28:29 +0000 (19:28 +0000)]
Implemented sysconf(), sbrk(), malloc() in MinSFI.

This patch adds support for heap allocation. It uses the same Doug Lea's
implementation of malloc() as libnacl and introduces the following MinSFI
system calls required to compile it.

heaplim(): Returns the limits of the heap as pre-allocated by the loader.
  It is used by sbrk() inside the untrusted support library.

sysconf(): Returns configuration information. Supports only page size
  queries at the moment.

The sched_yield() call is stubbed out.

Tests are now built with strict error reporting.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons platform=x86_64 bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

9 days agoUpdate revision for PNaCl r13726->r13739
dschuff@chromium.org [Fri, 12 Sep 2014 18:29:10 +0000 (18:29 +0000)]
Update revision for PNaCl r13726->r13739

Pull the following PNaCl changes into NaCl:
  r13739: (hidehiko@chromium.org) Non-SFI mode: Add -malign-double flag to pnacl-translate.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3913
TBR= hidehiko@chromium.org, mseaborn@chromium.org, dschuff@chromium.org
TEST=git cl try
(Please LGTM this change and tick the "commit" box)

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

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

9 days agoNon-SFI mode: Add -malign-double flag to pnacl-translate.
hidehiko@chromium.org [Fri, 12 Sep 2014 04:27:25 +0000 (04:27 +0000)]
Non-SFI mode: Add -malign-double flag to pnacl-translate.

A new flag -malign-double is supported by
https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-llvm.git;a=commit;h=969f37dfef3241dcc04ce1c9d029f06a62cb0e95
This CL passes through the flag.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3913
TEST=Ran trybot. Patch this and the llvm-side CL locally and build a binary.
R=dschuff@chromium.org, mseaborn@chromium.org

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

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

9 days agoOverride xcode architecture for ia32 standalone builds
dschuff@chromium.org [Fri, 12 Sep 2014 02:47:52 +0000 (02:47 +0000)]
Override xcode architecture for ia32 standalone builds

This fixes the -arch flag passed to clang on recent Xcode versions on
systems where the default is x86-64.

R=bradnelson@chromium.org
BUG=local mac build

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

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

9 days agoUpdate .DEPS.git
chrome-admin@google.com [Fri, 12 Sep 2014 01:37:10 +0000 (01:37 +0000)]
Update .DEPS.git

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

9 days agoUpdate .DEPS.git
chrome-admin@google.com [Fri, 12 Sep 2014 01:36:02 +0000 (01:36 +0000)]
Update .DEPS.git

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

9 days agoAdded testing for file link operations in irt_ext tests.
dyen@chromium.org [Fri, 12 Sep 2014 00:07:13 +0000 (00:07 +0000)]
Added testing for file link operations in irt_ext tests.

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

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

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

9 days agoAdded support for extending basic thread functions in irt_ext.
dyen@chromium.org [Fri, 12 Sep 2014 00:02:17 +0000 (00:02 +0000)]
Added support for extending basic thread functions in irt_ext.

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

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

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

9 days agoBuild x86-32 IRT with PNaCl
dschuff@chromium.org [Thu, 11 Sep 2014 23:00:47 +0000 (23:00 +0000)]
Build x86-32 IRT with PNaCl

This builds the IRT with PNaCl instead of nacl-gcc on x86-32.
This uses the same flags and build style that we use on x86-64,
and will allow use of C++11 language features in the Chromium
code that goes into the IRT. Some notes:
 * the x86-64 IRT already uses PNaCl.
 * the ARM IRT uses arm-nacl-gcc which is gcc 4.8 and so
 has C++11 support. We plan to switch ARM to PNaCl as
 well anyway for consistency, and to simplify the GYP.
 * PNaCl still uses libstdc++ instead of libc++ for the
 IRT. This was done for consistency with the gcc builds,
 but we will switch to libc++ soon. This will allow C++11
 library features as well (and will allow us to drop
 libstdc++ from PNaCl entirely).

This is a reland of r13687/13692, with the exception that we still
build with nacl-gcc in scons on Windows, and disable SSE instructions.

R=mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3935
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3936

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

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

10 days agoUpdate GCC toolchains to r13729
mcgrathr@chromium.org [Thu, 11 Sep 2014 19:34:14 +0000 (19:34 +0000)]
Update GCC toolchains to r13729

This brings in a GDB build that supports --tui on Linux.

BUG= https://code.google.com/p/chromium/issues/detail?id=391170
TEST= trybots
R=bradnelson@google.com, dyen@chromium.org

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

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

10 days agoTurn on goma for nacl and switch windows to ninja, fix tls_edit weirdness.
bradnelson@google.com [Thu, 11 Sep 2014 18:23:07 +0000 (18:23 +0000)]
Turn on goma for nacl and switch windows to ninja, fix tls_edit weirdness.

Only invoke pnacl tools with shell=True on windows as this seems to fail some of the time for tls_edit.exe

Fix issue with test_build.py emitting forward slashes that breaks nacl gyp build on windows.

Add a new msvs_warnings item for 4244, which seems to be implicit in our raw msvs_settings, but which the ninja generator doesn't seem to automatically convert.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3933
BUG=https://code.google.com/p/chromium/issues/detail?id=390764
TEST=trybots
R=ncbray@chromium.org, mseaborn@chromium.org

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

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

10 days agobuild_nexe: Tolerate variants of Release and Debug in build config names
dschuff@chromium.org [Thu, 11 Sep 2014 16:48:10 +0000 (16:48 +0000)]
build_nexe: Tolerate variants of Release and Debug in build config names

On Windows, 64-bit builds have build type names like 'Release_x64', so
treat them the same as if they were just 'Release'

R=thakis@chromium.org, bradnelson@chromium.org
BUG= https://code.google.com/p/chromium/issues/detail?id=413266

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

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

10 days agoNon-SFI mode: Add prototype declaration for recv() and send().
hidehiko@chromium.org [Thu, 11 Sep 2014 02:11:34 +0000 (02:11 +0000)]
Non-SFI mode: Add prototype declaration for recv() and send().

These are needed to build libevent by PNaCl toolchain.
Their implementation is stub, which is done by
https://src.chromium.org/viewvc/native_client?view=rev&revision=13706.
This is a preparation to build nonsfi_helper by PNaCl toolchain.

BUG=https://code.google.com/p/chromium/issues/detail?id=358465
TEST=Ran trybots. Built libevent locally by patching this CL.
R=mseaborn@chromium.org, uekawa@chromium.org

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

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

10 days agoAdded support for passing arguments to MinSFI's entry function
dbrazdil@google.com [Thu, 11 Sep 2014 01:37:04 +0000 (01:37 +0000)]
Added support for passing arguments to MinSFI's entry function

This patch modifies the MinSFI invocation interface to accept arguments
in the standard UNIX argc,argv format. The runtime copies these onto
the untrusted stack and invokes the _start_minsfi function with a pointer
to the beginning of the data structure. The sandboxed code will use it
to access the arguments but also to initialize its stack pointer.

The CL also introduces the untrusted support library and functions for
converting between native and untrusted pointers.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

10 days agoUpdate revision for PNaCl r13714->r13726
jvoung@chromium.org [Thu, 11 Sep 2014 00:27:50 +0000 (00:27 +0000)]
Update revision for PNaCl r13714->r13726

Pull the following PNaCl changes into NaCl:
  r13719: (dschuff@chromium.org) Build host libc++ and host tools with clang on Linux and Mac
  r13726: (dschuff@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 2987f60: (dbrazdil@chromium.org) Initialize untrusted stack pointer in MinSFI's entry function
    | ab62d53: (dbrazdil@chromium.org) Report invalid function references in MinSFI's SandboxIndirectCalls pass
    | 5b2c4e3: (dbrazdil@chromium.org) Report missing entry function in MinSFI's ExpandAllocas
    | 969f37d: (dschuff@chromium.org) Add -malign-double llc flag to use NaCl datalayout on linux
    | 9f9c351: (dbrazdil@chromium.org) Added flag to the PNaCl ABI verifier which whitelists MinSFI syscalls

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
R= jvoung@chromium.org, dbrazdil@chromium.org, dschuff@chromium.org, jfb@chromuim.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

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

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

11 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
dschuff@chromium.org [Wed, 10 Sep 2014 18:42:54 +0000 (18:42 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

2987f60: (dbrazdil@chromium.org) Initialize untrusted stack pointer in MinSFI's entry function
ab62d53: (dbrazdil@chromium.org) Report invalid function references in MinSFI's SandboxIndirectCalls pass
5b2c4e3: (dbrazdil@chromium.org) Report missing entry function in MinSFI's ExpandAllocas
969f37d: (dschuff@chromium.org) Add -malign-double llc flag to use NaCl datalayout on linux
9f9c351: (dbrazdil@chromium.org) Added flag to the PNaCl ABI verifier which whitelists MinSFI syscalls

TBR=dbrazdil@chromium.org

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

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

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

11 days agoNon-SFI mode: Support CMSG family for nonsfi_helper.
hidehiko@chromium.org [Wed, 10 Sep 2014 04:02:19 +0000 (04:02 +0000)]
Non-SFI mode: Support CMSG family for nonsfi_helper.

This CL starts to support CMSG, which is used in Chrome's
unix_domain_socket_linux.cc and ipc_channel_posix.cc.

BUG=https://code.google.com/p/chromium/issues/detail?id=358465
TEST=Ran trybots. Make sure this works with the working demo of nonsfi_helper built by PNaCl toolchain.
R=hamaji@chromium.org, mseaborn@chromium.org, uekawa@chromium.org

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

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

11 days agoUpdate signature of MinSFI's entry point
dbrazdil@google.com [Wed, 10 Sep 2014 02:14:31 +0000 (02:14 +0000)]
Update signature of MinSFI's entry point

This patch changes the signature of the entry function of MinSFI to
satisfy checks in latest changes to the LLVM passes. The actual algorithm
for passing arguments to the sandbox will be submitted in a separate CL
in order to avoid a circular dependency between commits to the NaCl and
PNaCl LLVM trees.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

11 days agoVary build settings on fastbuild + configuration + buildtype (reland).
bradnelson@google.com [Wed, 10 Sep 2014 00:55:17 +0000 (00:55 +0000)]
Vary build settings on fastbuild + configuration + buildtype (reland).

Official builds will continue to have -g + -O2 / -O0 for Release/Debug.

Otherwise, disabled all optimization + debug info for fastbuild!=0.

-O2 still used for pnacl, until toolchain issue fixed.

Otherwise, decide (-g -O0) vs -O2 based on Debug/Release.

Speedup for release + fastbuild=1:
nacl_irt_core: ~8 sec to ~5 sec
all nacl toolchain built stuff: ~15 sec to ~8 sec
overall nacl (including toolchain extract): ~26 sec to ~22 sec
chrome irt: ~133 sec to ~87 sec

BUG=https://code.google.com/p/chromium/issues/detail?id=388035
TEST=None
R=dschuff@chromium.org, jam@chromium.org, noelallen@chromium.org, binji@chromium.org

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

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

11 days agoAdd MinSFI loader
dbrazdil@google.com [Tue, 9 Sep 2014 23:23:55 +0000 (23:23 +0000)]
Add MinSFI loader

This patch implements a memory initialization routine as part of MinSFI's
trusted runtime. The code reads the manifest of the sandbox it was compiled
against, mmaps a sufficiently large memory region and jumps into the
sandbox's entry function. There is no support for multiple simultaneously
active sandboxes or multithreading.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= ./scons bitcode=1 minsfi=1 minsfi_tests
NOTRY=true

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

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

11 days agoIn IRT Extension API, added file stat support and tests.
dyen@chromium.org [Tue, 9 Sep 2014 23:21:55 +0000 (23:21 +0000)]
In IRT Extension API, added file stat support and tests.

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

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

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

11 days agoSwitching pnacl download script to use gsutil for download too.
bradnelson@google.com [Tue, 9 Sep 2014 23:21:50 +0000 (23:21 +0000)]
Switching pnacl download script to use gsutil for download too.

Curl seems to sometimes return zero size objects.
Switching to gsutil for greater robustness.

BUG=None
TEST=trybots
R=dschuff@chromium.org

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

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

11 days agoBuild host libc++ and host tools with clang on Linux and Mac
dschuff@chromium.org [Tue, 9 Sep 2014 21:57:26 +0000 (21:57 +0000)]
Build host libc++ and host tools with clang on Linux and Mac

Use Chrome's clang binary to build binutils and LLVM, with
a local build of libc++ as the C++ standard library. This
will allow building LLVM 3.5, which requires a more modern
compiler than the one installed on Ubuntu Precise.

Also updates libcxx to 5062add8:
  Use OSX 10.6 SDK rules for libcxx host build

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

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

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

11 days agoUpdate revision for PNaCl r13696->r13714
dschuff@chromium.org [Tue, 9 Sep 2014 20:32:08 +0000 (20:32 +0000)]
Update revision for PNaCl r13696->r13714

Pull the following PNaCl changes into NaCl:
  r13701: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | ba310bb: (jvoung@chromium.org) Tweak GlobalizeConstantVectors so it doesn't replace ops of consts with non-consts.
  r13704: (jvoung@google.com) Combine PNaCl ABI simplification linker passes into one run.
  r13708: (hidehiko@chromium.org) Non-SFI mode: Reduce ArchMerge() strictness for NONSFI architecture.
  r13712: (dbrazdil@google.com) Fixed signatures of _Unwind_* stubs in PNaCl support library
  r13714: (dschuff@chromium.org) Move REV file to metadata package and include all repos

BUG= <none>
BUG= http://code.google.com/p/chromium/issues/detail?id=358465
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3940
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3609
R= uekawa@chromium.org, jvoung@chromium.org, hidehiko@chromium.org, dschuff@chromium.org, jvoung@google.com, mseaborn@chromium.org, dbrazdil@google.com
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

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

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

12 days agoAsserts used by irt_ext are now done through error_report.c.
dyen@chromium.org [Tue, 9 Sep 2014 19:44:13 +0000 (19:44 +0000)]
Asserts used by irt_ext are now done through error_report.c.

This CL implements its own assert macro for IRT extensions tests, this
is so asserts actually print out errors properly since irt_ext tests
override the standard library streams print functions.

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

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

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

12 days agoUnify the way irt_ext libc how tests are declared and defined.
dyen@chromium.org [Tue, 9 Sep 2014 19:38:21 +0000 (19:38 +0000)]
Unify the way irt_ext libc how tests are declared and defined.

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

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

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

12 days agoRemove the old "SecureRandom" service, formerly used by get_random_bytes()
mseaborn@chromium.org [Tue, 9 Sep 2014 18:04:07 +0000 (18:04 +0000)]
Remove the old "SecureRandom" service, formerly used by get_random_bytes()

"SecureRandom" is no longer used, since it was replaced by a new
get_random_bytes() syscall.

 * Remove the RNG NaClDesc type.  Remove DescWrapper's constructor for
   this descriptor type.

 * Remove the code that registers an RNG NaClDesc with the name
   service as "SecureRandom".  Since this turns
   NaClDefaultNameServiceInit() into a no-op, remove that too.

 * Update a test that was checking SecureRandom as an example of a
   service.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST= compile + run_nameservice_test

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

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

12 days agoMove REV file to metadata package and include all repos
dschuff@chromium.org [Tue, 9 Sep 2014 01:12:16 +0000 (01:12 +0000)]
Move REV file to metadata package and include all repos

This moves the REV file from bin/ to the root of the toolchain (along with
the README and FEATURE_VERSION), and makes it include repo information
on all the components, so it changes every time any component changes.

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

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

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

12 days agoMinor consistency style fixes.
uekawa@chromium.org [Mon, 8 Sep 2014 23:50:16 +0000 (23:50 +0000)]
Minor consistency style fixes.

For those files that I've been looking at recently.

test_file instead of test-file, because most files are named with _.

"type *variable" instead of "type* variable"

BUG=N/A

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

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

12 days agoFixed signatures of _Unwind_* stubs in PNaCl support library
dbrazdil@google.com [Mon, 8 Sep 2014 22:58:49 +0000 (22:58 +0000)]
Fixed signatures of _Unwind_* stubs in PNaCl support library

PNaCl provides stubs for _Unwind_* functions when C++ exceptions
are disabled. To simplify the source code, these were generated
by a macro that defined functions of the right name but with wrong
signatures, and therefore risking introduction of undefined
behaviour. Even though the code works, it complicates analysis and
transformation of the code, such as application of control-flow
integrity enforcement.

TEST= compiled and invoked manually, PNaCl toolchain trybots
NOTRY=true

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

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

12 days agoMove syscall definitions to pure C code, replacing nacl_syscall_handlers_gen.py
mseaborn@chromium.org [Mon, 8 Sep 2014 22:12:30 +0000 (22:12 +0000)]
Move syscall definitions to pure C code, replacing nacl_syscall_handlers_gen.py

This will make it easier to add custom syscalls in the future
(e.g. for Mojo), because it won't be necessary to add build-system
logic for invoking a Python generator script.

This will also make it easier to conditionalise the registration of
syscalls.

This replaces the Python generator script with:

 * nacl_syscall_register.h: Provides macros for defining and
   registering syscalls.
 * nacl_syscall_list.c: Registers the standard set of syscalls.

Add a declaration for NaClSysClock().  Previously it wasn't needed,
because the generated code was concatenated onto
{posix,win}/nacl_syscall_impl.c, where NaClSysClock() is defined.

Remove the Scons/Gyp/GN logic for invoking
nacl_syscall_handlers_gen.py.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST=run_hello_world_test + trybots

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

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

13 days agoNon-SFI mode: Convert signal numbers for signal() on nonsfi pnacl newlib.
uekawa@chromium.org [Mon, 8 Sep 2014 17:24:30 +0000 (17:24 +0000)]
Non-SFI mode: Convert signal numbers for signal() on nonsfi pnacl newlib.

newlib signal.h defines signal numbers similar to mips, and not what
x86 or arm linux expects.
For example, signal numbers for SIGBUS and SIGSYS are different.

This change does not yet address the fact that signal handler
receives raw linux signal numbers and not the one that code expects.

In production the only users are Chrome which expects (SIGPIPE, SIG_IGN)
(SIGSEGV,SIG_DFL) to work.

TEST=./scons run_signal_sigbus_test --mode=dbg-host,nacl_irt_test bitcode=1 nonsfi_nacl=1
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3699

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

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

13 days agoRevert r13692: "Build x86-32 IRT with PNaCl"
mseaborn@chromium.org [Mon, 8 Sep 2014 16:52:44 +0000 (16:52 +0000)]
Revert r13692: "Build x86-32 IRT with PNaCl"

When rolled into Chromium, this change produced failures in the NaCl
SDK tests (on x86-32, on Mac), in particular in the nacl_io tests.  We
believe that is because nacl-glibc's x86-32 stack alignment issue
causes PPAPI structs like PP_Var to be allocated on the stack with
misaligned addresses.

> Build x86-32 IRT with PNaCl
>
> This builds the IRT with PNaCl instead of nacl-gcc on x86-32.
> This uses the same flags and build style that we use on x86-64,
> and will allow use of C++11 language features in the Chromium
> code that goes into the IRT. Some notes:
>  * the x86-64 IRT already uses PNaCl.
>  * the ARM IRT uses arm-nacl-gcc which is gcc 4.8 and so
>  has C++11 support. We plan to switch ARM to PNaCl as
>  well anyway for consistency, and to simplify the GYP.
>  * PNaCl still uses libstdc++ instead of libc++ for the
>  IRT. This was done for consistency with the gcc builds,
>  but we will switch to libc++ soon. This will allow C++11
>  library features as well (and will allow us to drop
>  libstdc++ from PNaCl entirely).
>
> This is a reland of r13687, with the exception that we still
> build with nacl-gcc in scons on Windows.
>
> BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910
> BUG= https://code.google.com/p/nativeclient/issues/detail?id=3935
> BUG= https://code.google.com/p/nativeclient/issues/detail?id=3936
> R=mseaborn@chromium.org
>
> Review URL: https://codereview.chromium.org/538783002

TBR=dschuff@chromium.org

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

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

13 days agoNon-SFI mode: Reduce ArchMerge() strictness for NONSFI architecture.
hidehiko@chromium.org [Mon, 8 Sep 2014 03:38:14 +0000 (03:38 +0000)]
Non-SFI mode: Reduce ArchMerge() strictness for NONSFI architecture.

_NONSFI binary format is compatible with the one for SFI.
Currently, pnacl-ld.py raises an error for the following commands:

pnacl-clang -c hellow.c -arch x86-32-nonsfi --pnacl-allow-translate
pnacl-clang hellow.o -arch x86-32-nonsfi --pnacl-allow-native

This CL allows it.

BUG=http://code.google.com/p/chromium/issues/detail?id=358465
TEST=Ran trybots. Also ran driver_tools_tests.py locally.
R=dschuff@chromium.org, mseaborn@chromium.org, uekawa@chromium.org

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

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

13 days agoNon-SFI mode: Set PROT_EXEC by mprotect separately from mmap2 syscall in mmap().
hidehiko@chromium.org [Mon, 8 Sep 2014 03:32:47 +0000 (03:32 +0000)]
Non-SFI mode: Set PROT_EXEC by mprotect separately from mmap2 syscall in mmap().

mmap syscall is prohibited in Chrome OS, as well as on Chrome's seccomp
sandbox configuration. So, set it separately by mprotect().

This is preparation of building nonsfi_helper by PNaCl toolchain.

BUG=https://code.google.com/p/chromium/issues/detail?id=358465
TEST=Ran trybots.
R=mseaborn@chromium.org

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

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

13 days agoAdd recv and send stub functions.
hidehiko@chromium.org [Mon, 8 Sep 2014 03:31:18 +0000 (03:31 +0000)]
Add recv and send stub functions.

These functions are refered from libevent third party library
in chromium. Add them as a stub functions so that libevent can be
build by PNaCl toolchain.

BUG=https://code.google.com/p/chromium/issues/detail?id=358465
TEST=Ran trybots.
R=mseaborn@chromium.org

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

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

2 weeks agoAdded support extending getpid, clock_getres, clock_gettime in newlib.
dyen@chromium.org [Sat, 6 Sep 2014 03:09:32 +0000 (03:09 +0000)]
Added support extending getpid, clock_getres, clock_gettime in newlib.

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

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

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

2 weeks agoCombine PNaCl ABI simplification linker passes into one run.
jvoung@google.com [Fri, 5 Sep 2014 21:32:57 +0000 (21:32 +0000)]
Combine PNaCl ABI simplification linker passes into one run.

Instead of several invocations of opt in pnacl-ld.
Save a tiny bit of time while doing bitcode "linking".
You can revert to the old behavior with the flag:
--pnacl-run-passes-separately

=====

Measurement of link-and-then-opt for the ARM pnacl-llc.pexe:

Before:
real 1m10.492s
user 1m9.764s
sys 0m0.578s

After:
real 1m16.916s
user 1m15.910s
sys 0m0.849s

A bit disappointing the amount of savings, but seemed
easy enough to make work. IR parsing is measured to be
about 2.2 seconds out of a 59 second opt run, so the amount
of savings makes some sense. It also saves on the
module verification passes that run each time you run
"opt" and that is about 0.6 seconds each.

test-x86-32 time (before)
real    3m20.786s
user    21m45.933s
sys     2m33.566s

test-x86-32 time (after)
real    3m1.382s
user    19m49.556s
sys     2m13.839s

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

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

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

2 weeks agoClean up tests/pagesize/ to use the nacl_secure_random() wrapper function
mseaborn@chromium.org [Fri, 5 Sep 2014 20:52:08 +0000 (20:52 +0000)]
Clean up tests/pagesize/ to use the nacl_secure_random() wrapper function

Previously it open-coded the SRPC-based implementation of
nacl_secure_random().

Also clean up so that nacl_secure_random() can easily be linked in,
for both the IRT-using and non-IRT-using cases:

 * Add a RANDOM_LIBS definition in SConstruct.

 * Conditionalise NACL_GC_WRAP_SYSCALL() so that irt_random.c doesn't
   reference GC hooks functions (IRT_{pre/post}_irtcall_hook) when
   built against glibc, since we don't link in irt_blockhook.c in this
   case.

   This allows us to remove a special case from
   tests/random/nacl.scons, and saves us from having to copy the
   special case to tests/pagesize/pagesize_test.c.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST= run_random_test{,_irt} run_pagesize_test{,_irt}

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

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

2 weeks agoUpdate revision for PNaCl r13673->r13696
jvoung@google.com [Fri, 5 Sep 2014 15:58:23 +0000 (15:58 +0000)]
Update revision for PNaCl r13673->r13696

Pull the following PNaCl changes into NaCl:
  r13677: (hidehiko@chromium.org) Support NONSFI translation on pnacl-ld.py.
  r13686: (jfb@chromium.org) LLVM 3.5 merge: add missing dependencies to PNaCl build
  r13694: (dbrazdil@google.com) Added new 'pnacl-llc' driver
  r13695: (dbrazdil@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | e8591ab: (mseaborn@chromium.org) ExpandByVal: Increase the memcpy call's alignment, for Emscripten's benefit
    | fbe77fa: (kschimpf@google.com) Build test structure for unit testing pnacl-bcdis.
    | 066820b: (kschimpf@google.com) Add missing unittest file NaClObjDumpTypesTest.cpp to CMakeLists.txt
    | 0f40a48: (dbrazdil@chromium.org) Added SubstituteUndefs MinSFI LLVM pass
    | 8ec77e9: (dbrazdil@chromium.org) Revert of Added SubstituteUndefs MinSFI LLVM pass (patchset #2 id:40001 of https://codereview.chromium.org/522123002/)
    | a905614: (stichnot@chromium.org) Add "pnacl-llc -external" to force all symbols to be externalized.
    | de4d1a8: (kschimpf@google.com) Fix link components for unittests/Bitcode to be consistent.
    | 4860655: (dbrazdil@chromium.org) Added SubstituteUndefs MinSFI LLVM pass
    | a09787c: (dbrazdil@chromium.org) Fixed signed integer overflow in MinSFI's SandboxMemoryAccesses pass.
    | 06f1509: (dbrazdil@chromium.org) Added a MinSFI meta-pass which invokes all the necessary passes in the correct order.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
BUG= http://code.google.com/p/chromium/issues/detail?id=358465
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3798
R=mseaborn@chromium.org, dbrazdil@google.com, dschuff@chromium.org, hidehiko@chromium.org, jfb@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

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

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

2 weeks agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Fri, 5 Sep 2014 15:47:05 +0000 (15:47 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM change:

ba310bb: (jvoung@chromium.org) Tweak GlobalizeConstantVectors so it doesn't replace ops of consts with non-consts.

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

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

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

2 weeks agoFix build on Fedora 21.
costan@gmail.com [Fri, 5 Sep 2014 15:13:00 +0000 (15:13 +0000)]
Fix build on Fedora 21.

This change defines _DEFAULT_SOURCE wherever _BSD_SOURCE is defined. This removes the "#pragma warning"s emitted by the source code of the glibc included in Fedora 21.

BUG= http://code.google.com/p/chromium/issues/detail?id=411114
TEST=tried building Chromium on Fedora 21

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

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

2 weeks ago[MIPS] Switch from eglibc 2.19 to glibc 2.19
petarj@mips.com [Fri, 5 Sep 2014 05:32:04 +0000 (05:32 +0000)]
[MIPS] Switch from eglibc 2.19 to glibc 2.19

Switch from eglibc 2.19 to glibc 2.19. This reduces the number of build
steps as well.

BUG= linux-pnacl-x86_32-tests-mips was failing
TEST= run the script, build nacl_sdk, run smoke tests

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

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

2 weeks agoAdded irt extension support for supplying the nacl_irt_basic interface.
dyen@chromium.org [Thu, 4 Sep 2014 22:29:27 +0000 (22:29 +0000)]
Added irt extension support for supplying the nacl_irt_basic interface.

The nacl_irt_basic interface can now be supplied through the irt
extension API. Unit tests have also been added to test if the C
standard library correctly use the supplied interfaces correctly.

Currently this is only works with newlib

R=mcgrathr@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3918
TESTS = trybots, scons test "run_irt_ext_libc_test_irt" under newlib

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

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

2 weeks agoSyncing packages no longer always writes a json file.
dyen@chromium.org [Thu, 4 Sep 2014 20:50:07 +0000 (20:50 +0000)]
Syncing packages no longer always writes a json file.

Running "gclient runhooks" previously always made the "untar_toolchain"
step become out of date, this is because the package json file was
being used as a stamp file and it was always being written whether
archives were being updated or not.

Old stale toolchain cleanup code has also been removed.

R=bradnelson@google.com
BUG=None
TEST=build "untar_toolchains", "gclient runhooks", "untar_toolchains"

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

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

2 weeks agoAdd a get_random_bytes() syscall to replace the SRPC-based implementation
mseaborn@chromium.org [Thu, 4 Sep 2014 18:20:19 +0000 (18:20 +0000)]
Add a get_random_bytes() syscall to replace the SRPC-based implementation

This will let us remove one remaining use of SRPC.

This allows us to simplify tests/random/, since it no longer needs to
link in a copy of libsrpc.

Note that this doesn't remove "SecureRandom" from the name service or
remove nacl_desc_rng.c.  I'll do that in a follow-on change in order
to keep this change smaller and easier to review.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST= run_random_test run_random_test_irt

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

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

2 weeks agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
dbrazdil@google.com [Thu, 4 Sep 2014 16:46:02 +0000 (16:46 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

e8591ab: (mseaborn@chromium.org) ExpandByVal: Increase the memcpy call's alignment, for Emscripten's benefit
fbe77fa: (kschimpf@google.com) Build test structure for unit testing pnacl-bcdis.
066820b: (kschimpf@google.com) Add missing unittest file NaClObjDumpTypesTest.cpp to CMakeLists.txt
0f40a48: (dbrazdil@chromium.org) Added SubstituteUndefs MinSFI LLVM pass
8ec77e9: (dbrazdil@chromium.org) Revert of Added SubstituteUndefs MinSFI LLVM pass (patchset #2 id:40001 of https://codereview.chromium.org/522123002/)
a905614: (stichnot@chromium.org) Add "pnacl-llc -external" to force all symbols to be externalized.
de4d1a8: (kschimpf@google.com) Fix link components for unittests/Bitcode to be consistent.
4860655: (dbrazdil@chromium.org) Added SubstituteUndefs MinSFI LLVM pass
a09787c: (dbrazdil@chromium.org) Fixed signed integer overflow in MinSFI's SandboxMemoryAccesses pass.
06f1509: (dbrazdil@chromium.org) Added a MinSFI meta-pass which invokes all the necessary passes in the correct order.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3798
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3890
TEST= PNaCl toolchain trybots
NOTRY=true

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

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

2 weeks agoAdded new 'pnacl-llc' driver
dbrazdil@google.com [Thu, 4 Sep 2014 16:30:51 +0000 (16:30 +0000)]
Added new 'pnacl-llc' driver

This adds a new driver into the SDK's bin directory, which invokes the native
LLVM static compiler needed to compile MinSFI binaries. The existing
'pnacl-translate' driver could be used but it is mainly intended to target NaCl,
which complicates native compilation of code that is not PNaCl ABI-compliant.

NOTRY=true
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= manual check that it is installed and that it passes args correctly

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

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

2 weeks agoAdd parameters to the stable interface with Chrome.
ncbray@chromium.org [Thu, 4 Sep 2014 14:48:44 +0000 (14:48 +0000)]
Add parameters to the stable interface with Chrome.

imc_bootstrap_handle - make optional
irt_desc - allows IRT to be passed as a NaClDesc
skip_qualification - allows embedder control over qualification tests
argc and argv - allows embedder to specify arguments passed to nexe's main()

BUG=https://code.google.com/p/chromium/issues/detail?id=401761

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

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

2 weeks agoBuild x86-32 IRT with PNaCl
dschuff@chromium.org [Thu, 4 Sep 2014 02:31:37 +0000 (02:31 +0000)]
Build x86-32 IRT with PNaCl

This builds the IRT with PNaCl instead of nacl-gcc on x86-32.
This uses the same flags and build style that we use on x86-64,
and will allow use of C++11 language features in the Chromium
code that goes into the IRT. Some notes:
 * the x86-64 IRT already uses PNaCl.
 * the ARM IRT uses arm-nacl-gcc which is gcc 4.8 and so
 has C++11 support. We plan to switch ARM to PNaCl as
 well anyway for consistency, and to simplify the GYP.
 * PNaCl still uses libstdc++ instead of libc++ for the
 IRT. This was done for consistency with the gcc builds,
 but we will switch to libc++ soon. This will allow C++11
 library features as well (and will allow us to drop
 libstdc++ from PNaCl entirely).

This is a reland of r13687, with the exception that we still
build with nacl-gcc in scons on Windows.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3935
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3936
R=mseaborn@chromium.org

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

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

2 weeks agoAdded file IO functions and tests to the irt_extension tests.
dyen@chromium.org [Thu, 4 Sep 2014 00:47:00 +0000 (00:47 +0000)]
Added file IO functions and tests to the irt_extension tests.

R=mcgrathr@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3918
TESTS = trybots, scons test "run_irt_ext_libc_test_irt" under newlib

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

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

2 weeks ago__asm__ instead of asm.
uekawa@chromium.org [Thu, 4 Sep 2014 00:46:56 +0000 (00:46 +0000)]
__asm__ instead of asm.

pnacl-clang doesn't like asm with:
tests/exception_test/exception_crash_test.c:192:1: error: extension used [-Werror,-Wlanguage-extension-token]

Use __asm__ instead.

This is in preparation to enable compiling with pnacl-clang for NonSFI NaCl.

BUG=https://code.google.com/p/chromium/issues/detail?id=408879

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

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

2 weeks agoCleanup: Remove unused NaClXlateSysRetAddr() function
mseaborn@chromium.org [Wed, 3 Sep 2014 21:12:21 +0000 (21:12 +0000)]
Cleanup: Remove unused NaClXlateSysRetAddr() function

BUG=none
TEST=build

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

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

2 weeks agoRevert "Build x86-32 IRT with PNaCl"
dschuff@chromium.org [Wed, 3 Sep 2014 20:36:50 +0000 (20:36 +0000)]
Revert "Build x86-32 IRT with PNaCl"

This reverts r13687, commit 32f8c257d2868f43c40bf464cd739bd79d12def7.

This change is failing to build the IRT on the Windows XP buildbots.

TBR=sehr@chromium.org

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

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

2 weeks agoBuild x86-32 IRT with PNaCl
dschuff@chromium.org [Wed, 3 Sep 2014 17:43:26 +0000 (17:43 +0000)]
Build x86-32 IRT with PNaCl

This builds the IRT with PNaCl instead of nacl-gcc on x86-32.
This uses the same flags and build style that we use on x86-64,
and will allow use of C++11 language features in the Chromium
code that goes into the IRT. Some notes:
 * the x86-64 IRT already uses PNaCl.
 * the ARM IRT uses arm-nacl-gcc which is gcc 4.8 and so
   has C++11 support. We plan to switch ARM to PNaCl as
   well anyway for consistency, and to simplify the GYP.
 * PNaCl still uses libstdc++ instead of libc++ for the
   IRT. This was done for consistency with the gcc builds,
   but we will switch to libc++ soon. This will allow C++11
   library features as well (and will allow us to drop
   libstdc++ from PNaCl entirely).

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

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

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

2 weeks agoLLVM 3.5 merge: add missing dependencies to PNaCl build
jfb@chromium.org [Tue, 2 Sep 2014 18:34:37 +0000 (18:34 +0000)]
LLVM 3.5 merge: add missing dependencies to PNaCl build

compiler-rt depends on the newlib_portable build, and needs to find its system headers. This currently works but starts failing after the LLVM 3.5 merge.

R= dschuff@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
TEST= LLVM 3.5 build

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

3 weeks agoUse uint32_t for untrusted pointer args: mmap() and munmap() syscalls
mseaborn@chromium.org [Sat, 30 Aug 2014 01:19:08 +0000 (01:19 +0000)]
Use uint32_t for untrusted pointer args: mmap() and munmap() syscalls

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

Also remove a duplicated declaration of NaClSysMmap().

I'll leave changing NaClSysMmapIntern()'s pointer arg to a separate
change, because that requires updating more call sites.

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

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

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

3 weeks agoservice_runtime_x86_64.gyp: pass /nologo to ml64.exe
hans@chromium.org [Sat, 30 Aug 2014 00:00:47 +0000 (00:00 +0000)]
service_runtime_x86_64.gyp: pass /nologo to ml64.exe

This removes some noise from the build.

BUG=none

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

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

3 weeks agoDisabling flaky test under asan.
bradnelson@google.com [Fri, 29 Aug 2014 23:12:40 +0000 (23:12 +0000)]
Disabling flaky test under asan.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3906
TEST=None
R=binji@chromium.org, mseaborn@chromium.org

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

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

3 weeks agoAdded irt extension support for supplying the nacl_irt_memory interface.
dyen@chromium.org [Fri, 29 Aug 2014 21:21:10 +0000 (21:21 +0000)]
Added irt extension support for supplying the nacl_irt_memory interface.

Memory calls such as mmap and munmap can now be supplied through the
irt extension API to newlib. Unit tests have also been added to test
if the supplied extension is being used properly.

R=mcgrathr@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3918
TESTS = trybots, scons test "run_irt_ext_libc_test_irt" under newlib

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

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

3 weeks agoUpdate .DEPS.git
chrome-admin@google.com [Fri, 29 Aug 2014 19:40:13 +0000 (19:40 +0000)]
Update .DEPS.git

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

3 weeks agoAdd back in android_tools, but in the right location.
bradnelson@google.com [Fri, 29 Aug 2014 19:39:30 +0000 (19:39 +0000)]
Add back in android_tools, but in the right location.

We had previously removed android_tools from our DEPS due to infrastructure
issues. This change re-adds them, however, in a slightly different location in
order to match the structure of a chromium checkout.

Old: <gclient_dir>/src/third_party/android_tools
New: <gclient_dir>/third_party/android_tools
(ie a sibbling of <gclient_dir>/native_client, rather than add another
third_party directory).

Kind of reverts: revert (r13598) of android_tools dependency
https://codereview.chromium.org/451243002/.

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

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

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

3 weeks agoUpdate revision for PNaCl r13658->r13673
dschuff@chromium.org [Fri, 29 Aug 2014 15:51:00 +0000 (15:51 +0000)]
Update revision for PNaCl r13658->r13673

Pull the following PNaCl changes into NaCl:
  r13669: (dbrazdil@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | a667d44: (dbrazdil@chromium.org) Add StripTls MinSFI LLVM pass
  r13672: (dschuff@chromium.org) Expose LLC's -force-align-stack flag to pnacl-translate
  r13673: (dschuff@chromium.org) PNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS
    | 67bc7e5: (dschuff@chromium.org) Include libcxxabi in build for Darwin
    | 9650253: (dschuff@chromium.org) Add $ORIGIN/../lib to RPATH for gold

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910
R= mseaborn@chromium.org, dbrazdil@google.com, dschuff@chromium.org, jfb@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

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

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

3 weeks agoUse uint32_t for untrusted pointer args: nanosleep() syscall
mseaborn@chromium.org [Fri, 29 Aug 2014 15:50:20 +0000 (15:50 +0000)]
Use uint32_t for untrusted pointer args: nanosleep() syscall

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

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

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

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

3 weeks agoSupport NONSFI translation on pnacl-ld.py.
hidehiko@chromium.org [Fri, 29 Aug 2014 04:50:03 +0000 (04:50 +0000)]
Support NONSFI translation on pnacl-ld.py.

This is preparation to build nonsfi_helper by PNaCl toolchain.
This CL introduces two (architecture dependent) BCLD_OFORMAT, which needs to be set for translation.
E.g.
pnacl-clang hellow.c -arch x86-32-nonsfi
uses the format.

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

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

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

3 weeks agoConvert to use nacl_exception_* helpers instead of NACL_SYSCALL in tests.
uekawa@chromium.org [Fri, 29 Aug 2014 04:35:30 +0000 (04:35 +0000)]
Convert to use nacl_exception_* helpers instead of NACL_SYSCALL in tests.

NACL_SYSCALL(exception_handler) has the ability of returning the old
handler, so keep the test that excercises that functionality to use
NACL_SYSCALL(exception_handler).

TESTED=./scons -j20 --mode=nacl,opt-host platform=x86-32 exception_tests
BUG=https://code.google.com/p/chromium/issues/detail?id=408879

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

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

3 weeks agoRevert r13667: "Re-enable use of Goma on Windows, except when using the PNaCl toolchain"
mseaborn@chromium.org [Fri, 29 Aug 2014 00:23:26 +0000 (00:23 +0000)]
Revert r13667: "Re-enable use of Goma on Windows, except when using the PNaCl toolchain"

This change failed when rolled into Chromium.  It started producing
the following Python traceback:

Traceback (most recent call last):
  File "../native_client/build/build_nexe.py", line 1118, in <module>
    sys.exit(Main(sys.argv))
  File "../native_client/build/build_nexe.py", line 1061, in CompileThread
    output_queue.put(build.Compile(filename))
  File "../native_client/build/build_nexe.py", line 639, in Compile
    self.CleanOutput(outd)
  File "../native_client/build/build_nexe.py", line 458, in CleanOutput
    RemoveFile(out)
  File "../native_client/build/build_nexe.py", line 63, in RemoveFile
    os.remove(FixPath(path))
WindowsError

Note that the CompileThread() code path is conditional on
"build.gomacc".  Presumably this is trying to remove a file that is
currently open, which usually fails on Windows.

> Re-enable use of Goma on Windows, except when using the PNaCl toolchain
>
> Goma does not work fully for PNaCl on Windows.
>
> Since Goma expects Cygwin-like path is used on Windows,
> it will generate wrong debug information if it is not true.
> To avoid to use wrong debug information, let me disable Goma
> on such a case.
>
> BUG=390764
>
> Review URL: https://codereview.chromium.org/495733003

BUG=https://code.google.com/p/chromium/issues/detail?id=390764
TEST=none
TBR=yyanagisawa@chromium.org

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

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

3 weeks agoUse uint32_t for untrusted pointer args: sysconf() and other syscalls
mseaborn@chromium.org [Thu, 28 Aug 2014 23:48:37 +0000 (23:48 +0000)]
Use uint32_t for untrusted pointer args: sysconf() and other syscalls

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

This converts:
 * imc_makeboundsock()
 * imc_sendmsg()
 * imc_recvmsg()
 * thread_create()
 * cond_timed_wait_abs()
 * sysconf()

Also remove a declaration for NaClSysCondTimedWaitRel(), which is not
defined anywhere.

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

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

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

3 weeks agoPNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS
dschuff@chromium.org [Thu, 28 Aug 2014 23:20:43 +0000 (23:20 +0000)]
PNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS

This pulls in the following libc++ change:

67bc7e5: (dschuff@chromium.org) Include libcxxabi in build for Darwin

and the following binutils change:
9650253: (dschuff@chromium.org) Add $ORIGIN/../lib to RPATH for gold

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

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

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

3 weeks agoExpose LLC's -force-align-stack flag to pnacl-translate
dschuff@chromium.org [Thu, 28 Aug 2014 22:30:41 +0000 (22:30 +0000)]
Expose LLC's -force-align-stack flag to pnacl-translate

x86-32 glibc's ld.so is built to maintain 4-byte stack alignment,
instead of 16 bytes that we use everywhere else. This means the IRT
must be built to tolerate 4-byte alignment when it is called. To build
the IRT with pnacl-clang, we can use LLC's -force-align-stack flag which
causes the stack to be realigned on function entry (it has always
maintained 16 byte stack alignment calling out, but has assumed
that the stack was aligned on entry).

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

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

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

3 weeks agoAdd comment about updating the trybot list in the Commit Queue's code
mseaborn@chromium.org [Thu, 28 Aug 2014 17:21:53 +0000 (17:21 +0000)]
Add comment about updating the trybot list in the Commit Queue's code

This is a follow-up to the CQ change that I committed recently:

   Fix NaCl CQ: Change trybot list to match the list in native_client/PRESUBMIT.py
   ...
   This removes the logic that scraped the trybot list from the JSON API,
   which hasn't been working very well.  It would get out of sync with the
   canonical list in PRESUBMIT.py.  The "validator_opt" bot is very slow
   and was never intended to be run by default.

BUG= https://code.google.com/p/chromium/issues/detail?id=399059
TEST= none
R=bradnelson@google.com

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

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