Provide mprotect syscall

Expose the mprotect syscall which is a part of experimental IRT interface.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=895
TEST= glibc trybots

Review URL: https://codereview.chromium.org/12382030
Align and pad code segments to 64k

Fiddle the linker scripts to ensure that the code segment starts and ends
on a 64k boundary and the end is padded with valid instructions (nop).
This is necessary to permit direct mapping of code segments from files.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3371
TEST= toolchain trybot and inspection of binaries

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/13638011
Linker scripts: Fold .fini into .text

In the previous iteration, a link with no .fini sections in any
of its input files would foul up the page alignment and padding.
The output section must be one with some code sections among its
input sections to ensure that the padding emitted in the output
section is nop instructions rather than zero bytes.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3371
TEST= toolchain trybot and inspection of binaries

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/13954009
Prepare for fast loading through mmap'ing text.

This changes the dynamic text mapping code to attempt PROT_EXEC mapping the text and only if it fails, falling back to read-mapping and using dyncode create.

TEST=newly generated libraries loaded by unmodified sel_ldr.
     dyncode create path is used, code validates, runs fine.
TEST=newly generated libraries loaded by a modified sel_ldr
     that allows PROT_EXEC mmaping if mmap starts and ends
     on a page align. libraries load.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3371

Review URL: https://codereview.chromium.org/13598032
Fill tz in gettimeofday function.

Manual says that this obsolete field should be filled but we ignore it.
Fill it with zero values instead to increase compatibility.

BUG= NONE
TEST= NONE
R=khim@chromium.org

Review URL: https://codereview.chromium.org/14373015
[NOUPSTREAM] Make non-executable stack default for NaCl.

It makes no sense to try to support executable stacks in NaCl.

Disable them at GLibC level.

In the new toolchain we probably don't want to do that and want to change default_execstack instead.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3402
TEST= run cordy with patch applied on top of Chrome 28.0.1486.1
R=halyavin@google.com

Review URL: https://codereview.chromium.org/14494008
nacl-glibc: Provide symbols for .note.gnu.build-id section bounds

This causes the linker to define (if referenced) symbols
__note_gnu_build_id_start and __note_gnu_build_id_end for the bounds
of the .note.gnu.build-id section.  This makes it possible for the
program to discover its own build ID, without having ELF program
headers accessible in the runtime memory image as they are with the
next-generation linkers.

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

Review URL: https://codereview.chromium.org/16427003
Allow use of alternative 'main' symbol.

If the __nacl_main symbol is found at runtime
them use this in place of the normal 'main'.

The idea is that if/when libppapi_simple.a is
linked into an executable __nacl_main will be
called as the startup symbol and then the real
main symbol can be called later on (e.g. on a
separate thread).

BUG=246246
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/16514007
Fix undefined NULL by including stddef.h

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

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