linux_syscall_support.h: add aarch64 support

Aarch64 support for linux_syscall_support.h. Since Aarch64 is a brand
new architecture, none of the legacy system calls are neccesarily
available. Thus some changes were neccesary affect other architectures
as well:

1) use getdents64 where available and else getdents (for ppc64)

2) other legacy system calls, pipe, waitpid and open replaced by pipe2,
   wait4 and openat where available.

3) use fstatat if stat is not available.

The aarch64 system call interface follows the Aarch64 calling convention
(regs x0-x5 for arguments and x8 system call number - return in x0).
Clone implementation is adapted from glibc.

v2: step back in getdents removal due to ppc64
Add aarch64 defines

With atomic operations and system call support in place, enable
with __aarch64__ defines Aarch64 support in other files around
the google-perftools header files. After these, google-perftools
testsuite (make check) results:

8 of 46 tests failed.

FAIL: sampling_test.sh
FAIL: heap-profiler_unittest.sh
FAIL: heap-checker_unittest.sh
FAIL: heap-checker-death_unittest.sh
FAIL: sampling_debug_test.sh
FAIL: heap-profiler_debug_unittest.sh
FAIL: heap-checker_debug_unittest.sh
FAIL: profiler_unittest.sh

While it indicates that there is still work to do, This is still
better than the result I get on ARMv7:

12 of 46 tests failed.
issue-464: correctly handle realloc after memalign in debugalloc

debug memalign is creating special header block to allow us to find
real allocated block. And previous implementation of data copying
wasn't taking that into account and was copying that "alignment
header" into newly allocated block.
eliminated useless BASE_XXX defines in debugallocation.cc

And closed TODO entry for that.
removed unused "using" in malloc_extension_test.cc
avoid crash in DebugMallocImplementation::GetOwnership

It was possible that if GetOwnership is passed pointer to memory not
owned by tcmalloc, it would crash. Or incorrectly return
owned. I.e. due to indirection in FromRawPointer.

New implementation prevents that, but introduces different bug
instead. New implementation incorrectly returns "not owned" for
memalign chunks with big alignment. But in can be argued that passing
pointer returned from different memalign implementation did not work
previously too.
added debugallocation check for offset_ corruption

It was previously possible (although unlikely) for damaged offset_ field
to lead FromRawPointer implementation into different MallocBlock.

As is usual with any damage, it's best to catch errors at earliest
possible time.
issue-525: only warn if --enable-frame-pointers are not given

This fixes issue when frame pointers warning is given even if frame
pointers are enabled
issue-489: ported chromium windows decommitting code

I tried to do it cleanly with merges but chromium code has so many
relevant commits (with frequent reverts) that makes it near
impossible.

Simpler 2-way emerge-files worked in the end. I've removed chromium's
aggressive 'always decommit' behavior which I want to make optional
later.

Majority of this work is the following commits (but there are more,
particularly against port.cc):

commit 9c92338c5f8770c440799d24387c3733fd6d826b
Author: jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date:   Tue Oct 6 18:33:31 2009 +0000

    Tracks the amount of committed vs uncommitted memory in tcmalloc's page heap's freelists

    Keeps track of the number of reserved but not committed pages in the freelist and uses that to calculate a waste metric, which is the ratio of committed pages vs pages used by the application.  This is exposed in the GetStats() call (which is used for about:tcmalloc) and through GetNumericalProperty() in Malloc

    BUG=none
    TEST=open about:tcmalloc and monitor 'WASTE' columns while using the browser

    Review URL: http://codereview.chromium.org/251065

    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28133 0039d316-1c4b-4281-b951-d872f2087c98

commit aef4f1be3eec2059a7c6e2c106050a5f3d6ccf12
Author: jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date:   Mon Oct 5 17:58:51 2009 +0000

    Revert further back to MBelshe's baseline forking TCMalloc

    This changes to decommitting in all paths through the
    page_heap delete method (which adds spans to the free lists).

    r=mbelshe,jamesr
    Review URL: http://codereview.chromium.org/255067

    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28006 0039d316-1c4b-4281-b951-d872f2087c98

commit e94afbb913b95f512cb8745a2729c73f82b15ae7
Author: jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date:   Thu Oct 1 00:25:41 2009 +0000

    Rollback Scavenge implemetation and rely on existing functionality to free

    This is a landing of a patch provided by antonm.  See:
    http://codereview.chromium.org/235022

    Also included change to browser_about_handler.cc to fix build, and I set
    TCMALLOC_RELEASE_RATE to 1.0 on line 40 of page_heap.cc (I think this
    was an inadvertent rollback element).

    r=antonm
    Review URL: http://codereview.chromium.org/257009

    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27692 0039d316-1c4b-4281-b951-d872f2087c98

commit c585892d2c42a47c95d06a684a6685156c545403
Author: mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date:   Wed Sep 2 17:33:23 2009 +0000

    Landing for Anton Muhin's tcmalloc patch:
    http://codereview.chromium.org/180021/show

    Restore decommitting in IncrementalScavenge and draft Scavenge method to
    be invoked periodically
    to reduce amount of committed pages.

    BUG=none
    TEST=none

    Review URL: http://codereview.chromium.org/187008

    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25188 0039d316-1c4b-4281-b951-d872f2087c98

commit 14239acc00731e94736ac62e80fc6b17c31ea131
Author: mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date:   Wed Aug 12 02:17:14 2009 +0000

    Major changes to the Chrome allocator.

    Changes include:
    * Fix tcmalloc to release memory.  Implements the TCMalloc_SystemCommit()
      mechanism so that tcmalloc can implement SystemRelease() and later
      reuse that memory.
    * Enable dynamic switching of allocators based on an environment variable.
      Users can now switch between tcmalloc, jemalloc, the default windows
      heap, and the windows low-fragmentation heap.
    * Implements set_new_mode() across all allocators so that we can be sure
      that out-of-memory conditions are handled safely.

    BUG=18345
    TEST=none; plan to get all unit tests running through these allocators.

    Review URL: http://codereview.chromium.org/165275

    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23140 0039d316-1c4b-4281-b951-d872f2087c98
issue-489: fixed warning

Computing certain values just for ASSERT raises just warning from
compiler because if NDEBUG is set those are dead code.
issue-489: implemented API to set chromium-style de-committing

Chrome has code to decommit (release back to OS) every span that's
released. I don't want to make it default, but indeed some
applications may want to enable this mode.

The code itself is taken from 2-way-merging of code from Chromium
fork.
issue-489: enable chromium-style decommitting on env variable

TCMALLOC_AGGRESSIVE_DECOMMIT=t now enables aggressive decommitting by
default.
issue-489: made tests pass on enabled chromium-style decommitting
issue-489: added unit test for chromium-style decommitting
issue-489: added tcmalloc test pass with chromium-style decommit
Test for memalign in configure.ac. Disable a test that uses memalign if it is not found.

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
Fix unportable test(1) construct.

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
Look for backtrace() in libexecinfo as well.

Signed-off-by: Aliaksey Kandratsenka <alk@tut.by>
unbreak building with libunwind

Caused by premature merging of previous patch.

When we're searching for backtrace in libexecinfo and don't find it,
we should not reset UNWIND_LIBS to empty value.

Correct fix is to first search for backtrace in libunwind and then to
search for it in libexecinfo.