Refresh x86_64-linux-android-4.8 with sizeof(long double)==16 (darwin-x86)

See prev commit for build instructions

Change-Id: I46d4e0170d30fda30796aa7511f907fea733089b
diff --git a/SOURCES b/SOURCES
index f1451bf..99d6a18 100644
--- a/SOURCES
+++ b/SOURCES
@@ -1,4 +1,4 @@
-toolchain/build.git                    7fea44a379d6700cdfe69bd1f166cad4be955cf7 Replace -march=atom with -march=x86-64 for better host compatibility
+toolchain/build.git                    2f00bce0ef2fe4bd07ade43c4abc0fd4c498bdc4 Change the triplet to aarch64-linux-android for aarch64-gcc.
 toolchain/gmp.git                      e6b9669dafc6a5f83c80b4b4176359b78bccdc90 Add gmp-5.0.5.tar.bz2
 toolchain/mpfr.git                     bfcf1bfa38469208aaad8873cd4c68781061d90f add mpfr-3.1.1.tar.bz2
 toolchain/mpc.git                      835d16e92eed875638a8b5d552034c3b1aae045b add mpc-1.0.1.tar.gz
@@ -6,15 +6,16 @@
 toolchain/isl.git                      b05d4572958c5d497da793f3317084bab90c3033 add isl-0.11.1.tar.bz2 needed by GCC 4.8 with graphite
 toolchain/ppl.git                      8ba1875b4c5341d902321761022a6d2a0b5b19a4 add ppl-1.0.tar.bz2
 toolchain/expat.git                    40172a0ae9d40a068f1e1a48ffcf6a1ccf765ed5 expat package for building gdb-7.3
-toolchain/binutils.git                 9ddab0875454b0b5a8329a63c01b71880170575e [2.23] Use relative relocation for R_X86_64_32 on x32
-toolchain/gcc.git                      79ba8bc76c0534e9f2544af2d1943b1581c84c77 Extend MIPS GCC4.6/4.7/4.8 -mldc1-sdc1 to control ldxc1/sdxc1 too
-toolchain/gdb.git                      2f1caff8ab3e6f7d34c8e58bd199ef518cfd2202 [7.3.x] Add one clue to find prebuilt python for Android platform debugging
-toolchain/python.git                   30bef47fac04bd5e99da7d09c8ed4260e1fbf09c Python 2.7.5: Regen configure and pyconfig.h.in
+toolchain/binutils.git                 4c195079b72a16cb62cb9a6e8010b3dc0202795b [2.22, 2.23] Fix alignment for data segment for 64 bits.
+toolchain/gcc.git                      a108aa5cbab7efe4eedd19f68d7a9bbe021b2168 [4.7, 4.8] Backport of two patches for additional SLM-tuning.
+toolchain/gdb.git                      899a2eec7872cfdcf06e84c49b307c46df64ef69 [7.3.x] Fix build with texinfo-5.0
+toolchain/python.git                   0d4194853e08d3244931523470331c00dfb94863 Fix python build inc_dirs[] and lib_dirs[] for linux/darwin
 toolchain/perl.git                     1121daca35c6c692602621eab28d4de19f0b347d Add -Dcc_as_ld to configure
-toolchain/mclinker.git                 2d1267fa5c4a47355c750a148a923bc09b7e55ad Add an option --enable-shrink-binary-size to configure.
-toolchain/clang.git (release_33)       76c8215dced6fd973b4c25895db736a19dc8db7c Refresh scan-build to svn trunk @189372
-toolchain/llvm.git (release_33)        421be0ea80e7caf88df9694e00505cab49cc1c9b Support new bitcode wrapper in bc2native.
-toolchain/compiler-rt.git (release_33) 066cd5e4615399f4a70b9abaea699f1b62f394b5 Implement __sync_lock_test_and_set_4.
-toolchain/clang.git (release_32)       b5b990a56f1dbe4ddce609f2c9fad97a3274236a Fix le32 linking issue by treating ".bc" as ".o".
-toolchain/llvm.git (release_32)        e5d0175fe2dbdfeb5b6aef11f9c3b1586b5a7b0e Support new bitcode wrapper in bc2native.
-toolchain/compiler-rt.git (release_32) bc84109786d158a454d671566721c2d139c3285c Add atomic helper functions for arm.
+toolchain/mclinker.git                 5e396d9ab10326d57bd50f1331f94a9fa5415d9c Merge "Filter out -ltinfo for device configuration due to lack of the library."
+toolchain/yasm.git                     87c09baff80ca5bbe938392d8f320e621707f317 test commit
+toolchain/clang.git (release_34)       5f679a685b78075c05b3201fd8032e927c8ed214 Backport of clang svn@r200510
+toolchain/llvm.git (release_34)        9101abced9a98aa1b0d398eea3e67bb4bfa32e32 Accept but ignore -rpath-link=
+toolchain/compiler-rt.git (release_34) b065fccd8ab47b4de4610093fb98514fc5df2362 Alias __aeabi_fcmpun to __unordsf2.
+toolchain/clang.git (release_33)       b0909d7631362264e2b2e56044a97e86251d4076 Backport clang svn@r199875
+toolchain/llvm.git (release_33)        6fb529c2e960b46271d34d2baf3df05958f2a430 Merge "Accept but ignore --no-warn-mismatch and -rpath-link=" into release_33
+toolchain/compiler-rt.git (release_33) c880feaaa8829681a025d29a33704c18e21e87e1 Misc fixes for compiler_rt
diff --git a/bin/x86_64-linux-android-cpp b/bin/x86_64-linux-android-cpp
index 1cb51a2..4c99742 100755
--- a/bin/x86_64-linux-android-cpp
+++ b/bin/x86_64-linux-android-cpp
Binary files differ
diff --git a/bin/x86_64-linux-android-g++ b/bin/x86_64-linux-android-g++
index 6cad12e..b4a4766 100755
--- a/bin/x86_64-linux-android-g++
+++ b/bin/x86_64-linux-android-g++
Binary files differ
diff --git a/bin/x86_64-linux-android-gcc b/bin/x86_64-linux-android-gcc
index b220cf0..25ff764 100755
--- a/bin/x86_64-linux-android-gcc
+++ b/bin/x86_64-linux-android-gcc
Binary files differ
diff --git a/bin/x86_64-linux-android-gcc-ar b/bin/x86_64-linux-android-gcc-ar
index 875a401..280576f 100755
--- a/bin/x86_64-linux-android-gcc-ar
+++ b/bin/x86_64-linux-android-gcc-ar
Binary files differ
diff --git a/bin/x86_64-linux-android-gcc-nm b/bin/x86_64-linux-android-gcc-nm
index d8551d8..19d334b 100755
--- a/bin/x86_64-linux-android-gcc-nm
+++ b/bin/x86_64-linux-android-gcc-nm
Binary files differ
diff --git a/bin/x86_64-linux-android-gcc-ranlib b/bin/x86_64-linux-android-gcc-ranlib
index 7e98d66..d0223c9 100755
--- a/bin/x86_64-linux-android-gcc-ranlib
+++ b/bin/x86_64-linux-android-gcc-ranlib
Binary files differ
diff --git a/bin/x86_64-linux-android-gcov b/bin/x86_64-linux-android-gcov
index 9bb4e3e..0b78733 100755
--- a/bin/x86_64-linux-android-gcov
+++ b/bin/x86_64-linux-android-gcov
Binary files differ
diff --git a/bin/x86_64-linux-android-gdb b/bin/x86_64-linux-android-gdb
index c32ca04..f17cfdb 100755
--- a/bin/x86_64-linux-android-gdb
+++ b/bin/x86_64-linux-android-gdb
Binary files differ
diff --git a/bin/x86_64-linux-android-ld.bfd b/bin/x86_64-linux-android-ld.bfd
index e8ff18d..38b892e 100755
--- a/bin/x86_64-linux-android-ld.bfd
+++ b/bin/x86_64-linux-android-ld.bfd
Binary files differ
diff --git a/bin/x86_64-linux-android-ld.mcld b/bin/x86_64-linux-android-ld.mcld
index 11cee7e..c3ba1c3 100755
--- a/bin/x86_64-linux-android-ld.mcld
+++ b/bin/x86_64-linux-android-ld.mcld
Binary files differ
diff --git a/bin/x86_64-linux-android-objcopy b/bin/x86_64-linux-android-objcopy
index b19ec58..dafeb11 100755
--- a/bin/x86_64-linux-android-objcopy
+++ b/bin/x86_64-linux-android-objcopy
Binary files differ
diff --git a/include/gdb/jit-reader.h b/include/gdb/jit-reader.h
new file mode 100644
index 0000000..7cff81a
--- /dev/null
+++ b/include/gdb/jit-reader.h
@@ -0,0 +1,346 @@
+/* JIT declarations for GDB, the GNU Debugger.
+
+   Copyright (C) 2011-2013 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef GDB_JIT_READER_H
+#define GDB_JIT_READER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Versioning information.  See gdb_reader_funcs.  */
+
+#define GDB_READER_INTERFACE_VERSION 1
+
+/* Readers must be released under a GPL compatible license.  To
+   declare that the reader is indeed released under a GPL compatible
+   license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source
+   file.  */
+
+#ifdef __cplusplus
+#define GDB_DECLARE_GPL_COMPATIBLE_READER       \
+  extern "C" {                                  \
+  extern int plugin_is_GPL_compatible (void);   \
+  extern int plugin_is_GPL_compatible (void)    \
+  {                                             \
+    return 0;                                   \
+  }                                             \
+  }
+
+#else
+
+#define GDB_DECLARE_GPL_COMPATIBLE_READER       \
+  extern int plugin_is_GPL_compatible (void);   \
+  extern int plugin_is_GPL_compatible (void)    \
+  {                                             \
+    return 0;                                   \
+  }
+
+#endif
+
+/* Represents an address on the target system.  */
+
+typedef unsigned long GDB_CORE_ADDR;
+
+/* Return status codes.  */
+
+enum gdb_status {
+  GDB_FAIL = 0,
+  GDB_SUCCESS = 1
+};
+
+struct gdb_object;
+struct gdb_symtab;
+struct gdb_block;
+struct gdb_symbol_callbacks;
+
+/* An array of these are used to represent a map from code addresses to line
+   numbers in the source file.  */
+
+struct gdb_line_mapping
+{
+  int line;
+  GDB_CORE_ADDR pc;
+};
+
+/* Create a new GDB code object.  Each code object can have one or
+   more symbol tables, each representing a compiled source file.  */
+
+typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb);
+
+/* The callback used to create new symbol table.  CB is the
+   gdb_symbol_callbacks which the structure is part of.  FILE_NAME is
+   an (optionally NULL) file name to associate with this new symbol
+   table.
+
+   Returns a new instance to gdb_symtab that can later be passed to
+   gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close.  */
+
+typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb,
+                                              struct gdb_object *obj,
+                                              const char *file_name);
+
+/* Creates a new block in a given symbol table.  A symbol table is a
+   forest of blocks, each block representing an code address range and
+   a corresponding (optionally NULL) NAME.  In case the block
+   corresponds to a function, the NAME passed should be the name of
+   the function.
+
+   If the new block to be created is a child of (i.e. is nested in)
+   another block, the parent block can be passed in PARENT.  SYMTAB is
+   the symbol table the new block is to belong in.  BEGIN, END is the
+   code address range the block corresponds to.
+
+   Returns a new instance of gdb_block, which, as of now, has no use.
+   Note that the gdb_block returned must not be freed by the
+   caller.  */
+
+typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb,
+                                            struct gdb_symtab *symtab,
+                                            struct gdb_block *parent,
+                                            GDB_CORE_ADDR begin,
+                                            GDB_CORE_ADDR end,
+                                            const char *name);
+
+/* Adds a PC to line number mapping for the symbol table SYMTAB.
+   NLINES is the number of elements in LINES, each element
+   corresponding to one (PC, line) pair.  */
+
+typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb,
+                                            struct gdb_symtab *symtab,
+                                            int nlines,
+                                            struct gdb_line_mapping *lines);
+
+/* Close the symtab SYMTAB.  This signals to GDB that no more blocks
+   will be opened on this symtab.  */
+
+typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb,
+                                 struct gdb_symtab *symtab);
+
+
+/* Closes the gdb_object OBJ and adds the emitted information into
+   GDB's internal structures.  Once this is done, the debug
+   information will be picked up and used; this will usually be the
+   last operation in gdb_read_debug_info.  */
+
+typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb,
+                                 struct gdb_object *obj);
+
+/* Reads LEN bytes from TARGET_MEM in the target's virtual address
+   space into GDB_BUF.
+
+   Returns GDB_FAIL on failure, and GDB_SUCCESS on success.  */
+
+typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem,
+                                           void *gdb_buf, int len);
+
+/* The list of callbacks that are passed to read.  These callbacks are
+   to be used to construct the symbol table.  The functions have been
+   described above.  */
+
+struct gdb_symbol_callbacks
+{
+  gdb_object_open *object_open;
+  gdb_symtab_open *symtab_open;
+  gdb_block_open *block_open;
+  gdb_symtab_close *symtab_close;
+  gdb_object_close *object_close;
+
+  gdb_symtab_add_line_mapping *line_mapping_add;
+  gdb_target_read *target_read;
+
+  /* For internal use by GDB.  */
+  void *priv_data;
+};
+
+/* Forward declaration.  */
+
+struct gdb_reg_value;
+
+/* A function of this type is used to free a gdb_reg_value.  See the
+   comment on `free' in struct gdb_reg_value.  */
+
+typedef void (gdb_reg_value_free) (struct gdb_reg_value *);
+
+/* Denotes the value of a register.  */
+
+struct gdb_reg_value
+{
+  /* The size of the register in bytes.  The reader need not set this
+     field.  This will be set for (defined) register values being read
+     from GDB using reg_get.  */
+  int size;
+
+  /* Set to non-zero if the value for the register is known.  The
+     registers for which the reader does not call reg_set are also
+     assumed to be undefined */
+  int defined;
+
+  /* Since gdb_reg_value is a variable sized structure, it will
+     usually be allocated on the heap.  This function is expected to
+     contain the corresponding "free" function.
+
+     When a pointer to gdb_reg_value is being sent from GDB to the
+     reader (via gdb_unwind_reg_get), the reader is expected to call
+     this function (with the same gdb_reg_value as argument) once it
+     is done with the value.
+
+     When the function sends the a gdb_reg_value to GDB (via
+     gdb_unwind_reg_set), it is expected to set this field to point to
+     an appropriate cleanup routine (or to NULL if no cleanup is
+     required).  */
+  gdb_reg_value_free *free;
+
+  /* The value of the register.  */
+  unsigned char value[1];
+};
+
+/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id
+   corresponding to the current frame.  The registers corresponding to
+   the current frame can be read using reg_get.  Calling get_frame_id
+   on a particular frame should return the same gdb_frame_id
+   throughout its lifetime (i.e. till before it gets unwound).  One
+   way to do this is by having the CODE_ADDRESS point to the
+   function's first instruction and STACK_ADDRESS point to the value
+   of the stack pointer when entering the function.  */
+
+struct gdb_frame_id
+{
+  GDB_CORE_ADDR code_address;
+  GDB_CORE_ADDR stack_address;
+};
+
+/* Forward declaration.  */
+
+struct gdb_unwind_callbacks;
+
+/* Returns the value of a particular register in the current frame.
+   The current frame is the frame that needs to be unwound into the
+   outer (earlier) frame.
+
+   CB is the struct gdb_unwind_callbacks * the callback belongs to.
+   REGNUM is the DWARF register number of the register that needs to
+   be unwound.
+
+   Returns the gdb_reg_value corresponding to the register requested.
+   In case the value of the register has been optimized away or
+   otherwise unavailable, the defined flag in the returned
+   gdb_reg_value will be zero.  */
+
+typedef struct gdb_reg_value *(gdb_unwind_reg_get)
+                              (struct gdb_unwind_callbacks *cb, int regnum);
+
+/* Sets the previous value of a particular register.  REGNUM is the
+   (DWARF) register number whose value is to be set.  VAL is the value
+   the register is to be set to.
+
+   VAL is *not* copied, so the memory allocated to it cannot be
+   reused.  Once GDB no longer needs the value, it is deallocated
+   using the FREE function (see gdb_reg_value).
+
+   A register can also be "set" to an undefined value by setting the
+   defined in VAL to zero.  */
+
+typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum,
+                                   struct gdb_reg_value *val);
+
+/* This struct is passed to unwind in gdb_reader_funcs, and is to be
+   used to unwind the current frame (current being the frame whose
+   registers can be read using reg_get) into the earlier frame.  The
+   functions have been described above.  */
+
+struct gdb_unwind_callbacks
+{
+  gdb_unwind_reg_get *reg_get;
+  gdb_unwind_reg_set *reg_set;
+  gdb_target_read *target_read;
+
+  /* For internal use by GDB.  */
+  void *priv_data;
+};
+
+/* Forward declaration.  */
+
+struct gdb_reader_funcs;
+
+/* Parse the debug info off a block of memory, pointed to by MEMORY
+   (already copied to GDB's address space) and MEMORY_SZ bytes long.
+   The implementation has to use the functions in CB to actually emit
+   the parsed data into GDB.  SELF is the same structure returned by
+   gdb_init_reader.
+
+   Return GDB_FAIL on failure and GDB_SUCCESS on success.  */
+
+typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self,
+                                               struct gdb_symbol_callbacks *cb,
+                                               void *memory, long memory_sz);
+
+/* Unwind the current frame, CB is the set of unwind callbacks that
+   are to be used to do this.
+
+   Return GDB_FAIL on failure and GDB_SUCCESS on success.  */
+
+typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self,
+                                            struct gdb_unwind_callbacks *cb);
+
+/* Return the frame ID corresponding to the current frame, using C to
+   read the current register values.  See the comment on struct
+   gdb_frame_id.  */
+
+typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self,
+                                                struct gdb_unwind_callbacks *c);
+
+/* Called when a reader is being unloaded.  This function should also
+   free SELF, if required.  */
+
+typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self);
+
+/* Called when the reader is loaded.  Must either return a properly
+   populated gdb_reader_funcs or NULL.  The memory allocated for the
+   gdb_reader_funcs is to be managed by the reader itself (i.e. if it
+   is allocated from the heap, it must also be freed in
+   gdb_destroy_reader).  */
+
+extern struct gdb_reader_funcs *gdb_init_reader (void);
+
+/* Pointer to the functions which implement the reader's
+   functionality.  The individual functions have been documented
+   above.
+
+   None of the fields are optional.  */
+
+struct gdb_reader_funcs
+{
+  /* Must be set to GDB_READER_INTERFACE_VERSION.  */
+  int reader_version;
+
+  /* For use by the reader.  */
+  void *priv_data;
+
+  gdb_read_debug_info *read;
+  gdb_unwind_frame *unwind;
+  gdb_get_frame_id *get_frame_id;
+  gdb_destroy_reader *destroy;
+};
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/lib/gcc/x86_64-linux-android/4.8/32/crtbegin.o b/lib/gcc/x86_64-linux-android/4.8/32/crtbegin.o
index 130b553..64beb29 100644
--- a/lib/gcc/x86_64-linux-android/4.8/32/crtbegin.o
+++ b/lib/gcc/x86_64-linux-android/4.8/32/crtbegin.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/32/crtbeginS.o b/lib/gcc/x86_64-linux-android/4.8/32/crtbeginS.o
index d88ec41..1bf016c 100644
--- a/lib/gcc/x86_64-linux-android/4.8/32/crtbeginS.o
+++ b/lib/gcc/x86_64-linux-android/4.8/32/crtbeginS.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/32/crtbeginT.o b/lib/gcc/x86_64-linux-android/4.8/32/crtbeginT.o
index 130b553..64beb29 100644
--- a/lib/gcc/x86_64-linux-android/4.8/32/crtbeginT.o
+++ b/lib/gcc/x86_64-linux-android/4.8/32/crtbeginT.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/32/libgcc.a b/lib/gcc/x86_64-linux-android/4.8/32/libgcc.a
index ce97b74..a312318 100644
--- a/lib/gcc/x86_64-linux-android/4.8/32/libgcc.a
+++ b/lib/gcc/x86_64-linux-android/4.8/32/libgcc.a
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/32/libgcov.a b/lib/gcc/x86_64-linux-android/4.8/32/libgcov.a
index 2b89b1b..e892932 100644
--- a/lib/gcc/x86_64-linux-android/4.8/32/libgcov.a
+++ b/lib/gcc/x86_64-linux-android/4.8/32/libgcov.a
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/crtbegin.o b/lib/gcc/x86_64-linux-android/4.8/crtbegin.o
index b9890ee..5d85385 100644
--- a/lib/gcc/x86_64-linux-android/4.8/crtbegin.o
+++ b/lib/gcc/x86_64-linux-android/4.8/crtbegin.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/crtbeginS.o b/lib/gcc/x86_64-linux-android/4.8/crtbeginS.o
index 66ca0aa..a616221 100644
--- a/lib/gcc/x86_64-linux-android/4.8/crtbeginS.o
+++ b/lib/gcc/x86_64-linux-android/4.8/crtbeginS.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/crtbeginT.o b/lib/gcc/x86_64-linux-android/4.8/crtbeginT.o
index b9890ee..5d85385 100644
--- a/lib/gcc/x86_64-linux-android/4.8/crtbeginT.o
+++ b/lib/gcc/x86_64-linux-android/4.8/crtbeginT.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/include/bmiintrin.h b/lib/gcc/x86_64-linux-android/4.8/include/bmiintrin.h
index 0087f5c..fc7f2ec 100644
--- a/lib/gcc/x86_64-linux-android/4.8/include/bmiintrin.h
+++ b/lib/gcc/x86_64-linux-android/4.8/include/bmiintrin.h
@@ -38,7 +38,6 @@
   return __builtin_ctzs (__X);
 }
 
-
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __andn_u32 (unsigned int __X, unsigned int __Y)
 {
@@ -52,23 +51,46 @@
 }
 
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_bextr_u32 (unsigned int __X, unsigned int __Y, unsigned __Z)
+{
+  return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsi_u32 (unsigned int __X)
 {
   return __X & -__X;
 }
 
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsi_u32 (unsigned int __X)
+{
+  return __blsi_u32 (__X);
+}
+
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsmsk_u32 (unsigned int __X)
 {
   return __X ^ (__X - 1);
 }
 
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsmsk_u32 (unsigned int __X)
+{
+  return __blsmsk_u32 (__X);
+}
+
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsr_u32 (unsigned int __X)
 {
   return __X & (__X - 1);
 }
 
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsr_u32 (unsigned int __X)
+{
+  return __blsr_u32 (__X);
+}
 
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u32 (unsigned int __X)
@@ -76,6 +98,12 @@
   return __builtin_ctz (__X);
 }
 
+extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_tzcnt_u32 (unsigned int __X)
+{
+  return __builtin_ctz (__X);
+}
+
 
 #ifdef  __x86_64__
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -91,29 +119,59 @@
 }
 
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_bextr_u64 (unsigned long long __X, unsigned int __Y, unsigned int __Z)
+{
+  return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
+}
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsi_u64 (unsigned long long __X)
 {
   return __X & -__X;
 }
 
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsi_u64 (unsigned long long __X)
+{
+  return __blsi_u64 (__X);
+}
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsmsk_u64 (unsigned long long __X)
 {
   return __X ^ (__X - 1);
 }
 
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsmsk_u64 (unsigned long long __X)
+{
+  return __blsmsk_u64 (__X);
+}
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __blsr_u64 (unsigned long long __X)
 {
   return __X & (__X - 1);
 }
 
 extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_blsr_u64 (unsigned long long __X)
+{
+  return __blsr_u64 (__X);
+}
+
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u64 (unsigned long long __X)
 {
   return __builtin_ctzll (__X);
 }
 
+extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_tzcnt_u64 (unsigned long long __X)
+{
+  return __builtin_ctzll (__X);
+}
+
 #endif /* __x86_64__  */
 
 #endif /* _BMIINTRIN_H_INCLUDED */
diff --git a/lib/gcc/x86_64-linux-android/4.8/libgcc.a b/lib/gcc/x86_64-linux-android/4.8/libgcc.a
index 82d840a..e3f3042 100644
--- a/lib/gcc/x86_64-linux-android/4.8/libgcc.a
+++ b/lib/gcc/x86_64-linux-android/4.8/libgcc.a
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/libgcov.a b/lib/gcc/x86_64-linux-android/4.8/libgcov.a
index 010607a..5323f74 100644
--- a/lib/gcc/x86_64-linux-android/4.8/libgcov.a
+++ b/lib/gcc/x86_64-linux-android/4.8/libgcov.a
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/x32/crtbegin.o b/lib/gcc/x86_64-linux-android/4.8/x32/crtbegin.o
index e83ff00..70044f5 100644
--- a/lib/gcc/x86_64-linux-android/4.8/x32/crtbegin.o
+++ b/lib/gcc/x86_64-linux-android/4.8/x32/crtbegin.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginS.o b/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginS.o
index e864082..bde0cbf 100644
--- a/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginS.o
+++ b/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginS.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginT.o b/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginT.o
index e83ff00..70044f5 100644
--- a/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginT.o
+++ b/lib/gcc/x86_64-linux-android/4.8/x32/crtbeginT.o
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/x32/libgcc.a b/lib/gcc/x86_64-linux-android/4.8/x32/libgcc.a
index 63db1c4..54c7ba6 100644
--- a/lib/gcc/x86_64-linux-android/4.8/x32/libgcc.a
+++ b/lib/gcc/x86_64-linux-android/4.8/x32/libgcc.a
Binary files differ
diff --git a/lib/gcc/x86_64-linux-android/4.8/x32/libgcov.a b/lib/gcc/x86_64-linux-android/4.8/x32/libgcov.a
index d72fbba..96f0b67 100644
--- a/lib/gcc/x86_64-linux-android/4.8/x32/libgcov.a
+++ b/lib/gcc/x86_64-linux-android/4.8/x32/libgcov.a
Binary files differ
diff --git a/lib/x86_64/libiberty.a b/lib/x86_64/libiberty.a
index 4078896..c242a6a 100644
--- a/lib/x86_64/libiberty.a
+++ b/lib/x86_64/libiberty.a
Binary files differ
diff --git a/lib32/libbfd.a b/lib32/libbfd.a
index 2168e59..24282b8 100644
--- a/lib32/libbfd.a
+++ b/lib32/libbfd.a
Binary files differ
diff --git a/lib32/libiberty.a b/lib32/libiberty.a
index 564cd28..c576119 100644
--- a/lib32/libiberty.a
+++ b/lib32/libiberty.a
Binary files differ
diff --git a/lib32/libintl.a b/lib32/libintl.a
index 45d0778..3f08ff8 100644
--- a/lib32/libintl.a
+++ b/lib32/libintl.a
Binary files differ
diff --git a/libexec/gcc/x86_64-linux-android/4.8/cc1 b/libexec/gcc/x86_64-linux-android/4.8/cc1
index 1e945f0..da5e806 100755
--- a/libexec/gcc/x86_64-linux-android/4.8/cc1
+++ b/libexec/gcc/x86_64-linux-android/4.8/cc1
Binary files differ
diff --git a/libexec/gcc/x86_64-linux-android/4.8/cc1plus b/libexec/gcc/x86_64-linux-android/4.8/cc1plus
index 69ab305..12b52b4 100755
--- a/libexec/gcc/x86_64-linux-android/4.8/cc1plus
+++ b/libexec/gcc/x86_64-linux-android/4.8/cc1plus
Binary files differ
diff --git a/libexec/gcc/x86_64-linux-android/4.8/collect2 b/libexec/gcc/x86_64-linux-android/4.8/collect2
index 3b51336..ca47772 100755
--- a/libexec/gcc/x86_64-linux-android/4.8/collect2
+++ b/libexec/gcc/x86_64-linux-android/4.8/collect2
Binary files differ
diff --git a/libexec/gcc/x86_64-linux-android/4.8/lto1 b/libexec/gcc/x86_64-linux-android/4.8/lto1
index 6a64b07..7f4c9fb 100755
--- a/libexec/gcc/x86_64-linux-android/4.8/lto1
+++ b/libexec/gcc/x86_64-linux-android/4.8/lto1
Binary files differ
diff --git a/libexec/gcc/x86_64-linux-android/4.8/plugin/gengtype b/libexec/gcc/x86_64-linux-android/4.8/plugin/gengtype
index 6c35f8e..ceacc70 100755
--- a/libexec/gcc/x86_64-linux-android/4.8/plugin/gengtype
+++ b/libexec/gcc/x86_64-linux-android/4.8/plugin/gengtype
Binary files differ
diff --git a/share/gdb/python/gdb/__init__.py b/share/gdb/python/gdb/__init__.py
index 43975c2..6311583 100644
--- a/share/gdb/python/gdb/__init__.py
+++ b/share/gdb/python/gdb/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -13,6 +13,112 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import gdb.command.pretty_printers
+import traceback
+import os
+import sys
+import _gdb
 
-gdb.command.pretty_printers.register_pretty_printer_commands()
+if sys.version_info[0] > 2:
+    # Python 3 moved "reload"
+    from imp import reload
+
+from _gdb import *
+
+class _GdbFile (object):
+    # These two are needed in Python 3
+    encoding = "UTF-8"
+    errors = "strict"
+    
+    def close(self):
+        # Do nothing.
+        return None
+
+    def isatty(self):
+        return False
+
+    def writelines(self, iterable):
+        for line in iterable:
+            self.write(line)
+
+    def flush(self):
+        flush()
+
+class GdbOutputFile (_GdbFile):
+    def write(self, s):
+        write(s, stream=STDOUT)
+
+sys.stdout = GdbOutputFile()
+
+class GdbOutputErrorFile (_GdbFile):
+    def write(self, s):
+        write(s, stream=STDERR)
+
+sys.stderr = GdbOutputErrorFile()
+
+# Default prompt hook does nothing.
+prompt_hook = None
+
+# Ensure that sys.argv is set to something.
+# We do not use PySys_SetArgvEx because it did not appear until 2.6.6.
+sys.argv = ['']
+
+# Initial pretty printers.
+pretty_printers = []
+
+# Initial type printers.
+type_printers = []
+
+# Convenience variable to GDB's python directory
+PYTHONDIR = os.path.dirname(os.path.dirname(__file__))
+
+# Auto-load all functions/commands.
+
+# Packages to auto-load.
+
+packages = [
+    'function',
+    'command'
+]
+
+# pkgutil.iter_modules is not available prior to Python 2.6.  Instead,
+# manually iterate the list, collating the Python files in each module
+# path.  Construct the module name, and import.
+
+def auto_load_packages():
+    for package in packages:
+        location = os.path.join(os.path.dirname(__file__), package)
+        if os.path.exists(location):
+            py_files = filter(lambda x: x.endswith('.py')
+                                        and x != '__init__.py',
+                              os.listdir(location))
+
+            for py_file in py_files:
+                # Construct from foo.py, gdb.module.foo
+                modname = "%s.%s.%s" % ( __name__, package, py_file[:-3] )
+                try:
+                    if modname in sys.modules:
+                        # reload modules with duplicate names
+                        reload(__import__(modname))
+                    else:
+                        __import__(modname)
+                except:
+                    sys.stderr.write (traceback.format_exc() + "\n")
+
+auto_load_packages()
+
+def GdbSetPythonDirectory(dir):
+    """Update sys.path, reload gdb and auto-load packages."""
+    global PYTHONDIR
+
+    try:
+        sys.path.remove(PYTHONDIR)
+    except ValueError:
+        pass
+    sys.path.insert(0, dir)
+
+    PYTHONDIR = dir
+
+    # note that reload overwrites the gdb module without deleting existing
+    # attributes
+    reload(__import__(__name__))
+    auto_load_packages()
diff --git a/share/gdb/python/gdb/command/__init__.py b/share/gdb/python/gdb/command/__init__.py
index ee2b61f..21eaef8 100644
--- a/share/gdb/python/gdb/command/__init__.py
+++ b/share/gdb/python/gdb/command/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/share/gdb/python/gdb/command/explore.py b/share/gdb/python/gdb/command/explore.py
new file mode 100644
index 0000000..dd77875
--- /dev/null
+++ b/share/gdb/python/gdb/command/explore.py
@@ -0,0 +1,760 @@
+# GDB 'explore' command.
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""Implementation of the GDB 'explore' command using the GDB Python API."""
+
+import gdb
+import sys
+
+if sys.version_info[0] > 2:
+    # Python 3 renamed raw_input to input
+    raw_input = input
+    
+class Explorer(object):
+    """Internal class which invokes other explorers."""
+
+    # This map is filled by the Explorer.init_env() function
+    type_code_to_explorer_map = { }
+
+    _SCALAR_TYPE_LIST = (
+        gdb.TYPE_CODE_CHAR,
+        gdb.TYPE_CODE_INT,
+        gdb.TYPE_CODE_BOOL,
+        gdb.TYPE_CODE_FLT,
+        gdb.TYPE_CODE_VOID,
+        gdb.TYPE_CODE_ENUM,
+    )
+
+    @staticmethod
+    def guard_expr(expr):
+        length = len(expr)
+        guard = False
+
+        if expr[0] == '(' and expr[length-1] == ')':
+            pass
+        else:
+            i = 0
+            while i < length:
+                c = expr[i]
+                if (c == '_' or ('a' <= c and c <= 'z') or
+                    ('A' <= c and c <= 'Z') or ('0' <= c and c <= '9')):
+                    pass
+                else:
+                    guard = True
+                    break
+                i += 1
+
+        if guard:
+            return "(" + expr + ")"
+        else:
+            return expr
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Main function to explore an expression value.
+
+        Arguments:
+            expr: The expression string that is being explored.
+            value: The gdb.Value value of the expression.
+            is_child: Boolean value to indicate if the expression is a child.
+                      An expression is a child if it is derived from the main
+                      expression entered by the user.  For example, if the user
+                      entered an expression which evaluates to a struct, then
+                      when exploring the fields of the struct, is_child is set
+                      to True internally.
+
+        Returns:
+            No return value.
+        """
+        type_code = value.type.code
+        if type_code in Explorer.type_code_to_explorer_map:
+            explorer_class = Explorer.type_code_to_explorer_map[type_code]
+            while explorer_class.explore_expr(expr, value, is_child):
+                pass
+        else:
+            print ("Explorer for type '%s' not yet available.\n" %
+                   str(value.type))
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Main function to explore a data type.
+
+        Arguments:
+            name: The string representing the path to the data type being
+                  explored.
+            datatype: The gdb.Type value of the data type being explored.
+            is_child: Boolean value to indicate if the name is a child.
+                      A name is a child if it is derived from the main name
+                      entered by the user.  For example, if the user entered
+                      the name of struct type, then when exploring the fields
+                      of the struct, is_child is set to True internally.
+
+        Returns:
+            No return value.
+        """
+        type_code = datatype.code
+        if type_code in Explorer.type_code_to_explorer_map:
+            explorer_class = Explorer.type_code_to_explorer_map[type_code]
+            while explorer_class.explore_type(name, datatype, is_child):
+                pass
+        else:
+            print ("Explorer for type '%s' not yet available.\n" %
+                   str(datatype))
+
+    @staticmethod
+    def init_env():
+        """Initializes the Explorer environment.
+        This function should be invoked before starting any exploration.  If
+        invoked before an exploration, it need not be invoked for subsequent
+        explorations.
+        """
+        Explorer.type_code_to_explorer_map = {
+            gdb.TYPE_CODE_CHAR : ScalarExplorer,
+            gdb.TYPE_CODE_INT : ScalarExplorer,
+            gdb.TYPE_CODE_BOOL : ScalarExplorer,
+            gdb.TYPE_CODE_FLT : ScalarExplorer,
+            gdb.TYPE_CODE_VOID : ScalarExplorer,
+            gdb.TYPE_CODE_ENUM : ScalarExplorer,
+            gdb.TYPE_CODE_STRUCT : CompoundExplorer,
+            gdb.TYPE_CODE_UNION : CompoundExplorer,
+            gdb.TYPE_CODE_PTR : PointerExplorer,
+            gdb.TYPE_CODE_REF : ReferenceExplorer,
+            gdb.TYPE_CODE_TYPEDEF : TypedefExplorer,
+            gdb.TYPE_CODE_ARRAY : ArrayExplorer
+        }
+
+    @staticmethod
+    def is_scalar_type(type):
+        """Checks whether a type is a scalar type.
+        A type is a scalar type of its type is
+            gdb.TYPE_CODE_CHAR or
+            gdb.TYPE_CODE_INT or
+            gdb.TYPE_CODE_BOOL or
+            gdb.TYPE_CODE_FLT or
+            gdb.TYPE_CODE_VOID or
+            gdb.TYPE_CODE_ENUM.
+
+        Arguments:
+            type: The type to be checked.
+
+        Returns:
+            'True' if 'type' is a scalar type. 'False' otherwise.
+        """
+        return type.code in Explorer._SCALAR_TYPE_LIST
+
+    @staticmethod
+    def return_to_parent_value():
+        """A utility function which prints that the current exploration session
+        is returning to the parent value. Useful when exploring values.
+        """
+        print ("\nReturning to parent value...\n")
+        
+    @staticmethod
+    def return_to_parent_value_prompt():
+        """A utility function which prompts the user to press the 'enter' key
+        so that the exploration session can shift back to the parent value.
+        Useful when exploring values.
+        """
+        raw_input("\nPress enter to return to parent value: ")
+        
+    @staticmethod
+    def return_to_enclosing_type():
+        """A utility function which prints that the current exploration session
+        is returning to the enclosing type.  Useful when exploring types.
+        """
+        print ("\nReturning to enclosing type...\n")
+        
+    @staticmethod
+    def return_to_enclosing_type_prompt():
+        """A utility function which prompts the user to press the 'enter' key
+        so that the exploration session can shift back to the enclosing type.
+        Useful when exploring types.
+        """
+        raw_input("\nPress enter to return to enclosing type: ")
+
+
+class ScalarExplorer(object):
+    """Internal class used to explore scalar values."""
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore scalar values.
+        See Explorer.explore_expr and Explorer.is_scalar_type for more
+        information.
+        """
+        print ("'%s' is a scalar value of type '%s'." %
+               (expr, value.type))
+        print ("%s = %s" % (expr, str(value)))
+
+        if is_child:
+            Explorer.return_to_parent_value_prompt()
+            Explorer.return_to_parent_value()
+
+        return False
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore scalar types.
+        See Explorer.explore_type and Explorer.is_scalar_type for more
+        information.
+        """
+        if datatype.code == gdb.TYPE_CODE_ENUM:
+            if is_child:
+                print ("%s is of an enumerated type '%s'." %
+                       (name, str(datatype)))
+            else:
+                print ("'%s' is an enumerated type." % name)
+        else:
+            if is_child:
+                print ("%s is of a scalar type '%s'." %
+                       (name, str(datatype)))
+            else:
+                print ("'%s' is a scalar type." % name)
+
+        if is_child:
+            Explorer.return_to_enclosing_type_prompt()
+            Explorer.return_to_enclosing_type()
+
+        return False
+
+
+class PointerExplorer(object):
+    """Internal class used to explore pointer values."""
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore pointer values.
+        See Explorer.explore_expr for more information.
+        """
+        print ("'%s' is a pointer to a value of type '%s'" %
+               (expr, str(value.type.target())))
+        option  = raw_input("Continue exploring it as a pointer to a single "
+                            "value [y/n]: ")
+        if option == "y":
+            deref_value = None
+            try:
+                deref_value = value.dereference()
+                str(deref_value)
+            except gdb.MemoryError:
+                print ("'%s' a pointer pointing to an invalid memory "
+                       "location." % expr)
+                if is_child:
+                    Explorer.return_to_parent_value_prompt()
+                return False
+            Explorer.explore_expr("*%s" % Explorer.guard_expr(expr),
+                                  deref_value, is_child)
+            return False
+        
+        option  = raw_input("Continue exploring it as a pointer to an "
+                            "array [y/n]: ")
+        if option == "y":
+            while True:
+                index = 0
+                try:
+                    index = int(raw_input("Enter the index of the element you "
+                                          "want to explore in '%s': " % expr))
+                except ValueError:
+                    break
+                element_expr = "%s[%d]" % (Explorer.guard_expr(expr), index)
+                element = value[index]
+                try:
+                    str(element)
+                except gdb.MemoryError:
+                    print ("Cannot read value at index %d." % index)
+                    continue
+                Explorer.explore_expr(element_expr, element, True)
+            return False
+
+        if is_child:
+            Explorer.return_to_parent_value()
+        return False
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore pointer types.
+        See Explorer.explore_type for more information.
+        """
+        target_type = datatype.target()
+        print ("\n%s is a pointer to a value of type '%s'." %
+               (name, str(target_type)))
+
+        Explorer.explore_type("the pointee type of %s" % name,
+                              target_type,
+                              is_child)
+        return False
+
+
+class ReferenceExplorer(object):
+    """Internal class used to explore reference (TYPE_CODE_REF) values."""
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore array values.
+        See Explorer.explore_expr for more information.
+        """
+        referenced_value = value.referenced_value()
+        Explorer.explore_expr(expr, referenced_value, is_child)
+        return False
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore pointer types.
+        See Explorer.explore_type for more information.
+        """
+        target_type = datatype.target()
+        Explorer.explore_type(name, target_type, is_child)
+        return False
+
+
+class ArrayExplorer(object):
+    """Internal class used to explore arrays."""
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore array values.
+        See Explorer.explore_expr for more information.
+        """
+        target_type = value.type.target()
+        print ("'%s' is an array of '%s'." % (expr, str(target_type)))
+        index = 0
+        try:
+            index = int(raw_input("Enter the index of the element you want to "
+                                  "explore in '%s': " % expr))
+        except ValueError:
+            if is_child:
+                Explorer.return_to_parent_value()
+            return False
+
+        element = None
+        try:
+            element = value[index]
+            str(element)
+        except gdb.MemoryError:
+            print ("Cannot read value at index %d." % index)
+            raw_input("Press enter to continue... ")
+            return True
+            
+        Explorer.explore_expr("%s[%d]" % (Explorer.guard_expr(expr), index),
+                              element, True)
+        return True
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore array types.
+        See Explorer.explore_type for more information.
+        """
+        target_type = datatype.target()
+        print ("%s is an array of '%s'." % (name, str(target_type)))
+
+        Explorer.explore_type("the array element of %s" % name, target_type,
+                              is_child)
+        return False
+
+
+class CompoundExplorer(object):
+    """Internal class used to explore struct, classes and unions."""
+
+    @staticmethod
+    def _print_fields(print_list):
+        """Internal function which prints the fields of a struct/class/union.
+        """
+        max_field_name_length = 0
+        for pair in print_list:
+            if max_field_name_length < len(pair[0]):
+                max_field_name_length = len(pair[0])
+
+        for pair in print_list:
+            print ("  %*s = %s" % (max_field_name_length, pair[0], pair[1]))
+
+    @staticmethod
+    def _get_real_field_count(fields):
+        real_field_count = 0;
+        for field in fields:
+            if not field.artificial:
+                real_field_count = real_field_count + 1
+
+        return real_field_count
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore structs/classes and union values.
+        See Explorer.explore_expr for more information.
+        """
+        datatype = value.type
+        type_code = datatype.code
+        fields = datatype.fields()
+
+        if type_code == gdb.TYPE_CODE_STRUCT:
+            type_desc = "struct/class"
+        else:
+            type_desc = "union"
+
+        if CompoundExplorer._get_real_field_count(fields) == 0:
+            print ("The value of '%s' is a %s of type '%s' with no fields." %
+                   (expr, type_desc, str(value.type)))
+            if is_child:
+                Explorer.return_to_parent_value_prompt()
+            return False
+
+        print ("The value of '%s' is a %s of type '%s' with the following "
+              "fields:\n" % (expr, type_desc, str(value.type)))
+
+        has_explorable_fields = False
+        choice_to_compound_field_map = { }
+        current_choice = 0
+        print_list = [ ]
+        for field in fields:
+            if field.artificial:
+                continue
+            field_full_name = Explorer.guard_expr(expr) + "." + field.name
+            if field.is_base_class:
+                field_value = value.cast(field.type)
+            else:
+                field_value = value[field.name]
+            literal_value = ""
+            if type_code == gdb.TYPE_CODE_UNION:
+                literal_value = ("<Enter %d to explore this field of type "
+                                 "'%s'>" % (current_choice, str(field.type)))
+                has_explorable_fields = True
+            else:
+                if Explorer.is_scalar_type(field.type):
+                    literal_value = ("%s .. (Value of type '%s')" %
+                                     (str(field_value), str(field.type)))
+                else:
+                    if field.is_base_class:
+                        field_desc = "base class"
+                    else:
+                        field_desc = "field"
+                    literal_value = ("<Enter %d to explore this %s of type "
+                                     "'%s'>" %
+                                     (current_choice, field_desc,
+                                      str(field.type)))
+                    has_explorable_fields = True
+
+            choice_to_compound_field_map[str(current_choice)] = (
+                field_full_name, field_value)
+            current_choice = current_choice + 1
+
+            print_list.append((field.name, literal_value))
+
+        CompoundExplorer._print_fields(print_list)
+        print ("")
+
+        if has_explorable_fields:
+            choice = raw_input("Enter the field number of choice: ")
+            if choice in choice_to_compound_field_map:
+                Explorer.explore_expr(choice_to_compound_field_map[choice][0],
+                                      choice_to_compound_field_map[choice][1],
+                                      True)
+                return True
+            else:
+                if is_child:
+                    Explorer.return_to_parent_value()
+        else:
+            if is_child:
+                Explorer.return_to_parent_value_prompt()
+
+        return False
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore struct/class and union types.
+        See Explorer.explore_type for more information.
+        """
+        type_code = datatype.code
+        type_desc = ""
+        if type_code == gdb.TYPE_CODE_STRUCT:
+            type_desc = "struct/class"
+        else:
+            type_desc = "union"
+
+        fields = datatype.fields()
+        if CompoundExplorer._get_real_field_count(fields) == 0:
+            if is_child:
+                print ("%s is a %s of type '%s' with no fields." %
+                       (name, type_desc, str(datatype)))
+                Explorer.return_to_enclosing_type_prompt()
+            else:
+                print ("'%s' is a %s with no fields." % (name, type_desc))
+            return False
+
+        if is_child:
+            print ("%s is a %s of type '%s' "
+                   "with the following fields:\n" %
+                   (name, type_desc, str(datatype)))
+        else:
+            print ("'%s' is a %s with the following "
+                   "fields:\n" %
+                   (name, type_desc))
+
+        has_explorable_fields = False
+        current_choice = 0
+        choice_to_compound_field_map = { }
+        print_list = [ ]
+        for field in fields:
+            if field.artificial:
+                continue
+            if field.is_base_class:
+                field_desc = "base class"
+            else:
+                field_desc = "field"
+            rhs = ("<Enter %d to explore this %s of type '%s'>" %
+                   (current_choice, field_desc, str(field.type)))
+            print_list.append((field.name, rhs))
+            choice_to_compound_field_map[str(current_choice)] = (
+                field.name, field.type, field_desc)
+            current_choice = current_choice + 1
+
+        CompoundExplorer._print_fields(print_list)
+        print ("")
+
+        if len(choice_to_compound_field_map) > 0:
+            choice = raw_input("Enter the field number of choice: ")
+            if choice in choice_to_compound_field_map:
+                if is_child:
+                    new_name = ("%s '%s' of %s" % 
+                                (choice_to_compound_field_map[choice][2],
+                                 choice_to_compound_field_map[choice][0],
+                                 name))
+                else:
+                    new_name = ("%s '%s' of '%s'" % 
+                                (choice_to_compound_field_map[choice][2],
+                                 choice_to_compound_field_map[choice][0],
+                                 name))
+                Explorer.explore_type(new_name,
+                    choice_to_compound_field_map[choice][1], True)
+                return True
+            else:
+                if is_child:
+                    Explorer.return_to_enclosing_type()
+        else:
+            if is_child:
+                Explorer.return_to_enclosing_type_prompt()
+
+        return False
+           
+
+class TypedefExplorer(object):
+    """Internal class used to explore values whose type is a typedef."""
+
+    @staticmethod
+    def explore_expr(expr, value, is_child):
+        """Function to explore typedef values.
+        See Explorer.explore_expr for more information.
+        """
+        actual_type = value.type.strip_typedefs()
+        print ("The value of '%s' is of type '%s' "
+               "which is a typedef of type '%s'" %
+               (expr, str(value.type), str(actual_type)))
+
+        Explorer.explore_expr(expr, value.cast(actual_type), is_child)
+        return False
+
+    @staticmethod
+    def explore_type(name, datatype, is_child):
+        """Function to explore typedef types.
+        See Explorer.explore_type for more information.
+        """
+        actual_type = datatype.strip_typedefs()
+        if is_child:
+            print ("The type of %s is a typedef of type '%s'." %
+                   (name, str(actual_type)))
+        else:
+            print ("The type '%s' is a typedef of type '%s'." %
+                   (name, str(actual_type)))
+
+        Explorer.explore_type(name, actual_type, is_child)
+        return False
+
+
+class ExploreUtils(object):
+    """Internal class which provides utilities for the main command classes."""
+
+    @staticmethod
+    def check_args(name, arg_str):
+        """Utility to check if adequate number of arguments are passed to an
+        explore command.
+
+        Arguments:
+            name: The name of the explore command.
+            arg_str: The argument string passed to the explore command.
+
+        Returns:
+            True if adequate arguments are passed, false otherwise.
+
+        Raises:
+            gdb.GdbError if adequate arguments are not passed.
+        """
+        if len(arg_str) < 1:
+            raise gdb.GdbError("ERROR: '%s' requires an argument."
+                               % name)
+            return False
+        else:
+            return True
+
+    @staticmethod
+    def get_type_from_str(type_str):
+        """A utility function to deduce the gdb.Type value from a string
+        representing the type.
+
+        Arguments:
+            type_str: The type string from which the gdb.Type value should be
+                      deduced.
+
+        Returns:
+            The deduced gdb.Type value if possible, None otherwise.
+        """
+        try:
+            # Assume the current language to be C/C++ and make a try.
+            return gdb.parse_and_eval("(%s *)0" % type_str).type.target()
+        except RuntimeError:
+            # If assumption of current language to be C/C++ was wrong, then
+            # lookup the type using the API.
+            try:
+                return gdb.lookup_type(type_str)
+            except RuntimeError:
+                return None
+
+    @staticmethod
+    def get_value_from_str(value_str):
+        """A utility function to deduce the gdb.Value value from a string
+        representing the value.
+
+        Arguments:
+            value_str: The value string from which the gdb.Value value should
+                       be deduced.
+
+        Returns:
+            The deduced gdb.Value value if possible, None otherwise.
+        """
+        try:
+            return gdb.parse_and_eval(value_str)
+        except RuntimeError:
+            return None
+
+
+class ExploreCommand(gdb.Command):
+    """Explore a value or a type valid in the current context.
+
+       Usage:
+
+         explore ARG
+
+         - ARG is either a valid expression or a type name.
+         - At any stage of exploration, hit the return key (instead of a
+           choice, if any) to return to the enclosing type or value.
+    """
+
+    def __init__(self):
+        super(ExploreCommand, self).__init__(name = "explore",
+                                             command_class = gdb.COMMAND_DATA,
+                                             prefix = True)
+
+    def invoke(self, arg_str, from_tty):
+        if ExploreUtils.check_args("explore", arg_str) == False:
+            return
+
+        # Check if it is a value
+        value = ExploreUtils.get_value_from_str(arg_str)
+        if value is not None:
+            Explorer.explore_expr(arg_str, value, False)
+            return
+
+        # If it is not a value, check if it is a type
+        datatype = ExploreUtils.get_type_from_str(arg_str)
+        if datatype is not None:
+            Explorer.explore_type(arg_str, datatype, False)
+            return
+
+        # If it is neither a value nor a type, raise an error.
+        raise gdb.GdbError(
+            ("'%s' neither evaluates to a value nor is a type "
+             "in the current context." %
+             arg_str))
+
+
+class ExploreValueCommand(gdb.Command):
+    """Explore value of an expression valid in the current context.
+
+       Usage:
+
+         explore value ARG
+
+         - ARG is a valid expression.
+         - At any stage of exploration, hit the return key (instead of a
+           choice, if any) to return to the enclosing value.
+    """
+ 
+    def __init__(self):
+        super(ExploreValueCommand, self).__init__(
+            name = "explore value", command_class = gdb.COMMAND_DATA)
+
+    def invoke(self, arg_str, from_tty):
+        if ExploreUtils.check_args("explore value", arg_str) == False:
+            return
+
+        value = ExploreUtils.get_value_from_str(arg_str)
+        if value is None:
+            raise gdb.GdbError(
+                (" '%s' does not evaluate to a value in the current "
+                 "context." %
+                 arg_str))
+            return
+
+        Explorer.explore_expr(arg_str, value, False)
+
+
+class ExploreTypeCommand(gdb.Command):            
+    """Explore a type or the type of an expression valid in the current
+       context.
+
+       Usage:
+
+         explore type ARG
+
+         - ARG is a valid expression or a type name.
+         - At any stage of exploration, hit the return key (instead of a
+           choice, if any) to return to the enclosing type.
+    """
+
+    def __init__(self):
+        super(ExploreTypeCommand, self).__init__(
+            name = "explore type", command_class = gdb.COMMAND_DATA)
+
+    def invoke(self, arg_str, from_tty):
+        if ExploreUtils.check_args("explore type", arg_str) == False:
+            return
+
+        datatype = ExploreUtils.get_type_from_str(arg_str)
+        if datatype is not None:
+            Explorer.explore_type(arg_str, datatype, False)
+            return
+
+        value = ExploreUtils.get_value_from_str(arg_str)
+        if value is not None:
+            print ("'%s' is of type '%s'." % (arg_str, str(value.type)))
+            Explorer.explore_type(str(value.type), value.type, False)
+            return
+
+        raise gdb.GdbError(("'%s' is not a type or value in the current "
+                            "context." % arg_str))
+
+
+Explorer.init_env()
+
+ExploreCommand()
+ExploreValueCommand()
+ExploreTypeCommand()
diff --git a/share/gdb/python/gdb/command/pretty_printers.py b/share/gdb/python/gdb/command/pretty_printers.py
index 86923d7..7b03e3a 100644
--- a/share/gdb/python/gdb/command/pretty_printers.py
+++ b/share/gdb/python/gdb/command/pretty_printers.py
@@ -1,5 +1,5 @@
 # Pretty-printer commands.
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -124,21 +124,17 @@
         """Print a list of pretty-printers."""
         # A potential enhancement is to provide an option to list printers in
         # "lookup order" (i.e. unsorted).
-        sorted_pretty_printers = copy.copy(pretty_printers)
-        sorted_pretty_printers.sort(lambda x, y:
-                                        cmp(self.printer_name(x),
-                                            self.printer_name(y)))
+        sorted_pretty_printers = sorted (copy.copy(pretty_printers),
+                                         key = self.printer_name)
         for printer in sorted_pretty_printers:
             name = self.printer_name(printer)
             enabled = self.enabled_string(printer)
             if name_re.match(name):
-                print "  %s%s" % (name, enabled)
+                print ("  %s%s" % (name, enabled))
                 if (hasattr(printer, "subprinters") and
                     printer.subprinters is not None):
-                    sorted_subprinters = copy.copy(printer.subprinters)
-                    sorted_subprinters.sort(lambda x, y:
-                                                cmp(self.printer_name(x),
-                                                    self.printer_name(y)))
+                    sorted_subprinters = sorted (copy.copy(printer.subprinters),
+                                                 key = self.printer_name)
                     for subprinter in sorted_subprinters:
                         if (not subname_re or
                             subname_re.match(subprinter.name)):
@@ -148,9 +144,9 @@
 
     def invoke1(self, title, printer_list,
                 obj_name_to_match, object_re, name_re, subname_re):
-        """"Subroutine of invoke to simplify it."""
+        """Subroutine of invoke to simplify it."""
         if printer_list and object_re.match(obj_name_to_match):
-            print title
+            print (title)
             self.list_pretty_printers(printer_list, name_re, subname_re)
 
     def invoke(self, arg, from_tty):
@@ -219,7 +215,7 @@
     We count subprinters individually.
     """
     (enabled_count, total_count) = count_all_enabled_printers()
-    print "%d of %d printers enabled" % (enabled_count, total_count)
+    print ("%d of %d printers enabled" % (enabled_count, total_count))
 
 
 def do_enable_pretty_printer_1 (pretty_printers, name_re, subname_re, flag):
@@ -301,7 +297,7 @@
         state = "enabled"
     else:
         state = "disabled"
-    print "%d %s %s" % (total, pluralize("printer", total), state)
+    print ("%d %s %s" % (total, pluralize("printer", total), state))
 
     # Print the total list of printers currently enabled/disabled.
     # This is to further assist the user in determining whether the result
@@ -368,3 +364,5 @@
     InfoPrettyPrinter()
     EnablePrettyPrinter()
     DisablePrettyPrinter()
+
+register_pretty_printer_commands()
diff --git a/share/gdb/python/gdb/command/prompt.py b/share/gdb/python/gdb/command/prompt.py
new file mode 100644
index 0000000..394e40c
--- /dev/null
+++ b/share/gdb/python/gdb/command/prompt.py
@@ -0,0 +1,66 @@
+# Extended prompt.
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""GDB command for working with extended prompts."""
+
+import gdb
+import gdb.prompt
+
+class _ExtendedPrompt(gdb.Parameter):
+
+    """Set the extended prompt.
+
+Usage: set extended-prompt VALUE
+
+Substitutions are applied to VALUE to compute the real prompt.
+
+The currently defined substitutions are:
+
+"""
+    # Add the prompt library's dynamically generated help to the
+    # __doc__ string.
+    __doc__ = __doc__ + gdb.prompt.prompt_help()
+
+    set_doc = "Set the extended prompt."
+    show_doc = "Show the extended prompt."
+
+    def __init__(self):
+        super(_ExtendedPrompt, self).__init__("extended-prompt",
+                                              gdb.COMMAND_SUPPORT,
+                                              gdb.PARAM_STRING_NOESCAPE)
+        self.value = ''
+        self.hook_set = False
+
+    def get_show_string (self, pvalue):
+        if self.value is not '':
+           return "The extended prompt is: " + self.value
+        else:
+           return "The extended prompt is not set."
+
+    def get_set_string (self):
+        if self.hook_set == False:
+           gdb.prompt_hook = self.before_prompt_hook
+           self.hook_set = True
+        return ""
+
+    def before_prompt_hook(self, current):
+        if self.value is not '':
+            newprompt = gdb.prompt.substitute_prompt(self.value)
+            return newprompt.replace('\\', '\\\\')
+        else:
+            return None
+
+_ExtendedPrompt()
diff --git a/share/gdb/python/gdb/command/type_printers.py b/share/gdb/python/gdb/command/type_printers.py
new file mode 100644
index 0000000..81f2ea1
--- /dev/null
+++ b/share/gdb/python/gdb/command/type_printers.py
@@ -0,0 +1,125 @@
+# Type printer commands.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import copy
+import gdb
+
+"""GDB commands for working with type-printers."""
+
+class InfoTypePrinter(gdb.Command):
+    """GDB command to list all registered type-printers.
+
+    Usage: info type-printers
+    """
+
+    def __init__ (self):
+        super(InfoTypePrinter, self).__init__("info type-printers",
+                                              gdb.COMMAND_DATA)
+
+    def list_type_printers(self, type_printers):
+        """Print a list of type printers."""
+        # A potential enhancement is to provide an option to list printers in
+        # "lookup order" (i.e. unsorted).
+        sorted_type_printers = sorted (copy.copy(type_printers),
+                                       key = lambda x: x.name)
+        for printer in sorted_type_printers:
+            if printer.enabled:
+                enabled = ''
+            else:
+                enabled = " [disabled]"
+            print ("  %s%s" % (printer.name, enabled))
+
+    def invoke(self, arg, from_tty):
+        """GDB calls this to perform the command."""
+        sep = ''
+        for objfile in gdb.objfiles():
+            if objfile.type_printers:
+                print ("%sType printers for %s:" % (sep, objfile.name))
+                self.list_type_printers(objfile.type_printers)
+                sep = '\n'
+        if gdb.current_progspace().type_printers:
+            print ("%sType printers for program space:" % sep)
+            self.list_type_printers(gdb.current_progspace().type_printers)
+            sep = '\n'
+        if gdb.type_printers:
+            print ("%sGlobal type printers:" % sep)
+            self.list_type_printers(gdb.type_printers)
+
+class _EnableOrDisableCommand(gdb.Command):
+    def __init__(self, setting, name):
+        super(_EnableOrDisableCommand, self).__init__(name, gdb.COMMAND_DATA)
+        self.setting = setting
+
+    def set_some(self, name, printers):
+        result = False
+        for p in printers:
+            if name == p.name:
+                p.enabled = self.setting
+                result = True
+        return result
+
+    def invoke(self, arg, from_tty):
+        """GDB calls this to perform the command."""
+        for name in arg.split():
+            ok = False
+            for objfile in gdb.objfiles():
+                if self.set_some(name, objfile.type_printers):
+                    ok = True
+            if self.set_some(name, gdb.current_progspace().type_printers):
+                ok = True
+            if self.set_some(name, gdb.type_printers):
+                ok = True
+            if not ok:
+                print ("No type printer named '%s'" % name)
+
+    def add_some(self, result, word, printers):
+        for p in printers:
+            if p.name.startswith(word):
+                result.append(p.name)
+
+    def complete(self, text, word):
+        result = []
+        for objfile in gdb.objfiles():
+            self.add_some(result, word, objfile.type_printers)
+        self.add_some(result, word, gdb.current_progspace().type_printers)
+        self.add_some(result, word, gdb.type_printers)
+        return result
+
+class EnableTypePrinter(_EnableOrDisableCommand):
+    """GDB command to enable the specified type printer.
+
+    Usage: enable type-printer NAME
+
+    NAME is the name of the type-printer.
+    """
+
+    def __init__(self):
+        super(EnableTypePrinter, self).__init__(True, "enable type-printer")
+
+class DisableTypePrinter(_EnableOrDisableCommand):
+    """GDB command to disable the specified type-printer.
+
+    Usage: disable type-printer NAME
+
+    NAME is the name of the type-printer.
+    """
+
+    def __init__(self):
+        super(DisableTypePrinter, self).__init__(False, "disable type-printer")
+
+InfoTypePrinter()
+EnableTypePrinter()
+DisableTypePrinter()
diff --git a/share/gdb/python/gdb/function/__init__.py b/share/gdb/python/gdb/function/__init__.py
new file mode 100644
index 0000000..755bff9
--- /dev/null
+++ b/share/gdb/python/gdb/function/__init__.py
@@ -0,0 +1,14 @@
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/share/gdb/python/gdb/function/strfns.py b/share/gdb/python/gdb/function/strfns.py
new file mode 100644
index 0000000..efdf950
--- /dev/null
+++ b/share/gdb/python/gdb/function/strfns.py
@@ -0,0 +1,108 @@
+# Useful gdb string convenience functions.
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""$_memeq, $_strlen, $_streq, $_regex"""
+
+import gdb
+import re
+
+
+class _MemEq(gdb.Function):
+  """$_memeq - compare bytes of memory
+
+Usage:
+  $_memeq(a, b, len)
+
+Returns:
+  True if len bytes at a and b compare equally.
+"""
+  def __init__(self):
+    super(_MemEq, self).__init__("_memeq")
+
+  def invoke(self, a, b, length):
+    if length < 0:
+      raise ValueError("length must be non-negative")
+    if length == 0:
+      return True
+    # The argument(s) to vector are [low_bound,]high_bound.
+    byte_vector = gdb.lookup_type("char").vector(length - 1)
+    ptr_byte_vector = byte_vector.pointer()
+    a_ptr = a.reinterpret_cast(ptr_byte_vector)
+    b_ptr = b.reinterpret_cast(ptr_byte_vector)
+    return a_ptr.dereference() == b_ptr.dereference()
+
+
+class _StrLen(gdb.Function):
+  """$_strlen - compute string length
+
+Usage:
+  $_strlen(a)
+
+Returns:
+  Length of string a, assumed to be a string in the current language.
+"""
+  def __init__(self):
+    super(_StrLen, self).__init__("_strlen")
+
+  def invoke(self, a):
+    s = a.string()
+    return len(s)
+
+
+class _StrEq(gdb.Function):
+  """$_streq - check string equality
+
+Usage:
+  $_streq(a, b)
+
+Returns:
+  True if a and b are identical strings in the current language.
+
+Example (amd64-linux):
+  catch syscall open
+  cond $bpnum $_streq((char*) $rdi, "foo")
+"""
+  def __init__(self):
+    super(_StrEq, self).__init__("_streq")
+
+  def invoke(self, a, b):
+    return a.string() == b.string()
+
+
+class _RegEx(gdb.Function):
+  """$_regex - check if a string matches a regular expression
+
+Usage:
+  $_regex(string, regex)
+
+Returns:
+  True if string str (in the current language) matches the
+  regular expression regex.
+"""
+  def __init__(self):
+    super(_RegEx, self).__init__("_regex")
+
+  def invoke(self, string, regex):
+    s = string.string()
+    r = re.compile(regex.string())
+    return bool(r.match(s))
+
+
+# GDB will import us automagically via gdb/__init__.py.
+_MemEq()
+_StrLen()
+_StrEq()
+_RegEx()
diff --git a/share/gdb/python/gdb/printing.py b/share/gdb/python/gdb/printing.py
index a030827..785a407 100644
--- a/share/gdb/python/gdb/printing.py
+++ b/share/gdb/python/gdb/printing.py
@@ -1,5 +1,5 @@
 # Pretty-printer utilities.
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,7 +19,12 @@
 import gdb
 import gdb.types
 import re
+import sys
 
+if sys.version_info[0] > 2:
+    # Python 3 removed basestring and long
+    basestring = str
+    long = int
 
 class PrettyPrinter(object):
     """A basic pretty-printer.
@@ -206,3 +211,53 @@
 
         # Cannot find a pretty printer.  Return None.
         return None
+
+# A helper class for printing enum types.  This class is instantiated
+# with a list of enumerators to print a particular Value.
+class _EnumInstance:
+    def __init__(self, enumerators, val):
+        self.enumerators = enumerators
+        self.val = val
+
+    def to_string(self):
+        flag_list = []
+        v = long(self.val)
+        any_found = False
+        for (e_name, e_value) in self.enumerators:
+            if v & e_value != 0:
+                flag_list.append(e_name)
+                v = v & ~e_value
+                any_found = True
+        if not any_found or v != 0:
+            # Leftover value.
+            flag_list.append('<unknown: 0x%x>' % v)
+        return "0x%x [%s]" % (self.val, " | ".join(flag_list))
+
+class FlagEnumerationPrinter(PrettyPrinter):
+    """A pretty-printer which can be used to print a flag-style enumeration.
+    A flag-style enumeration is one where the enumerators are or'd
+    together to create values.  The new printer will print these
+    symbolically using '|' notation.  The printer must be registered
+    manually.  This printer is most useful when an enum is flag-like,
+    but has some overlap.  GDB's built-in printing will not handle
+    this case, but this printer will attempt to."""
+
+    def __init__(self, enum_type):
+        super(FlagEnumerationPrinter, self).__init__(enum_type)
+        self.initialized = False
+
+    def __call__(self, val):
+        if not self.initialized:
+            self.initialized = True
+            flags = gdb.lookup_type(self.name)
+            self.enumerators = []
+            for field in flags.fields():
+                self.enumerators.append((field.name, field.enumval))
+            # Sorting the enumerators by value usually does the right
+            # thing.
+            self.enumerators.sort(key = lambda x: x.enumval)
+
+        if self.enabled:
+            return _EnumInstance(self.enumerators, val)
+        else:
+            return None
diff --git a/share/gdb/python/gdb/prompt.py b/share/gdb/python/gdb/prompt.py
new file mode 100644
index 0000000..bb1975b
--- /dev/null
+++ b/share/gdb/python/gdb/prompt.py
@@ -0,0 +1,148 @@
+# Extended prompt utilities.
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+""" Extended prompt library functions."""
+
+import gdb
+import os
+
+def _prompt_pwd(ignore):
+    "The current working directory."
+    return os.getcwdu()
+
+def _prompt_object_attr(func, what, attr, nattr):
+    """Internal worker for fetching GDB attributes."""
+    if attr is None:
+        attr = nattr
+    try:
+        obj = func()
+    except gdb.error:
+        return '<no %s>' % what
+    if hasattr(obj, attr):
+        result = getattr(obj, attr)
+        if callable(result):
+            result = result()
+        return result
+    else:
+        return '<no attribute %s on current %s>' % (attr, what)
+
+def _prompt_frame(attr):
+    "The selected frame; an argument names a frame parameter."
+    return _prompt_object_attr(gdb.selected_frame, 'frame', attr, 'name')
+
+def _prompt_thread(attr):
+    "The selected thread; an argument names a thread parameter."
+    return _prompt_object_attr(gdb.selected_thread, 'thread', attr, 'num')
+
+def _prompt_version(attr):
+    "The version of GDB."
+    return gdb.VERSION
+
+def _prompt_esc(attr):
+    "The ESC character."
+    return '\033'
+
+def _prompt_bs(attr):
+    "A backslash."
+    return '\\'
+
+def _prompt_n(attr):
+    "A newline."
+    return '\n'
+
+def _prompt_r(attr):
+    "A carriage return."
+    return '\r'
+
+def _prompt_param(attr):
+    "A parameter's value; the argument names the parameter."
+    return gdb.parameter(attr)
+
+def _prompt_noprint_begin(attr):
+    "Begins a sequence of non-printing characters."
+    return '\001'
+
+def _prompt_noprint_end(attr):
+     "Ends a sequence of non-printing characters."
+     return '\002'
+
+prompt_substitutions = {
+    'e': _prompt_esc,
+    '\\': _prompt_bs,
+    'n': _prompt_n,
+    'r': _prompt_r,
+    'v': _prompt_version,
+    'w': _prompt_pwd,
+    'f': _prompt_frame,
+    't': _prompt_thread,
+    'p': _prompt_param,
+    '[': _prompt_noprint_begin,
+    ']': _prompt_noprint_end
+}
+
+def prompt_help():
+    """Generate help dynamically from the __doc__ strings of attribute
+    functions."""
+
+    result = ''
+    keys = sorted (prompt_substitutions.keys())
+    for key in keys:
+        result += '  \\%s\t%s\n' % (key, prompt_substitutions[key].__doc__)
+    result += """
+A substitution can be used in a simple form, like "\\f".
+An argument can also be passed to it, like "\\f{name}".
+The meaning of the argument depends on the particular substitution."""
+    return result
+
+def substitute_prompt(prompt):
+    "Perform substitutions on PROMPT."
+
+    result = ''
+    plen = len(prompt)
+    i = 0
+    while i < plen:
+        if prompt[i] == '\\':
+            i = i + 1
+            if i >= plen:
+                break
+            cmdch = prompt[i]
+
+            if cmdch in prompt_substitutions:
+                cmd = prompt_substitutions[cmdch]
+
+                if i + 1 < plen and prompt[i + 1] == '{':
+                    j = i + 1
+                    while j < plen and prompt[j] != '}':
+                        j = j + 1
+                    # Just ignore formatting errors.
+                    if j >= plen or prompt[j] != '}':
+                        arg = None
+                    else:
+                        arg = prompt[i + 2 : j]
+                        i = j
+                else:
+                    arg = None
+                result += str(cmd(arg))
+            else:
+                # Unrecognized escapes are turned into the escaped
+                # character itself.
+                result += prompt[i]
+        else:
+            result += prompt[i]
+
+        i = i + 1
+
+    return result
diff --git a/share/gdb/python/gdb/types.py b/share/gdb/python/gdb/types.py
index 54fbe3c..ffc817c 100644
--- a/share/gdb/python/gdb/types.py
+++ b/share/gdb/python/gdb/types.py
@@ -1,5 +1,5 @@
 # Type utilities.
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -86,6 +86,91 @@
         raise TypeError("not an enum type")
     enum_dict = {}
     for field in enum_type.fields():
-        # The enum's value is stored in "bitpos".
-        enum_dict[field.name] = field.bitpos
+        # The enum's value is stored in "enumval".
+        enum_dict[field.name] = field.enumval
     return enum_dict
+
+
+def deep_items (type_):
+    """Return an iterator that recursively traverses anonymous fields.
+
+    Arguments:
+        type_: The type to traverse.  It should be one of
+        gdb.TYPE_CODE_STRUCT or gdb.TYPE_CODE_UNION.
+
+    Returns:
+        an iterator similar to gdb.Type.iteritems(), i.e., it returns
+        pairs of key, value, but for any anonymous struct or union
+        field that field is traversed recursively, depth-first.
+    """
+    for k, v in type_.iteritems ():
+        if k:
+            yield k, v
+        else:
+            for i in deep_items (v.type):
+                yield i
+
+class TypePrinter(object):
+    """The base class for type printers.
+
+    Instances of this type can be used to substitute type names during
+    'ptype'.
+
+    A type printer must have at least 'name' and 'enabled' attributes,
+    and supply an 'instantiate' method.
+
+    The 'instantiate' method must either return None, or return an
+    object which has a 'recognize' method.  This method must accept a
+    gdb.Type argument and either return None, meaning that the type
+    was not recognized, or a string naming the type.
+    """
+
+    def __init__(self, name):
+        self.name = name
+        self.enabled = True
+
+    def instantiate(self):
+        return None
+
+# Helper function for computing the list of type recognizers.
+def _get_some_type_recognizers(result, plist):
+    for printer in plist:
+        if printer.enabled:
+            inst = printer.instantiate()
+            if inst is not None:
+                result.append(inst)
+    return None
+
+def get_type_recognizers():
+    "Return a list of the enabled type recognizers for the current context."
+    result = []
+
+    # First try the objfiles.
+    for objfile in gdb.objfiles():
+        _get_some_type_recognizers(result, objfile.type_printers)
+    # Now try the program space.
+    _get_some_type_recognizers(result, gdb.current_progspace().type_printers)
+    # Finally, globals.
+    _get_some_type_recognizers(result, gdb.type_printers)
+
+    return result
+
+def apply_type_recognizers(recognizers, type_obj):
+    """Apply the given list of type recognizers to the type TYPE_OBJ.
+    If any recognizer in the list recognizes TYPE_OBJ, returns the name
+    given by the recognizer.  Otherwise, this returns None."""
+    for r in recognizers:
+        result = r.recognize(type_obj)
+        if result is not None:
+            return result
+    return None
+
+def register_type_printer(locus, printer):
+    """Register a type printer.
+    PRINTER is the type printer instance.
+    LOCUS is either an objfile, a program space, or None, indicating
+    global registration."""
+
+    if locus is None:
+        locus = gdb
+    locus.type_printers.insert(0, printer)
diff --git a/share/gdb/syscalls/amd64-linux.xml b/share/gdb/syscalls/amd64-linux.xml
index ee0ea6d..bf3da5d 100644
--- a/share/gdb/syscalls/amd64-linux.xml
+++ b/share/gdb/syscalls/amd64-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/gdb-syscalls.dtd b/share/gdb/syscalls/gdb-syscalls.dtd
index 0735ecd..05c1ccf 100644
--- a/share/gdb/syscalls/gdb-syscalls.dtd
+++ b/share/gdb/syscalls/gdb-syscalls.dtd
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/i386-linux.xml b/share/gdb/syscalls/i386-linux.xml
index 3cb1251..80512d8 100644
--- a/share/gdb/syscalls/i386-linux.xml
+++ b/share/gdb/syscalls/i386-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/mips-n32-linux.xml b/share/gdb/syscalls/mips-n32-linux.xml
index da4aba2..b4e2181 100644
--- a/share/gdb/syscalls/mips-n32-linux.xml
+++ b/share/gdb/syscalls/mips-n32-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/mips-n64-linux.xml b/share/gdb/syscalls/mips-n64-linux.xml
index fc951c8..896e0c0 100644
--- a/share/gdb/syscalls/mips-n64-linux.xml
+++ b/share/gdb/syscalls/mips-n64-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/mips-o32-linux.xml b/share/gdb/syscalls/mips-o32-linux.xml
index 939ed4e..2b11247 100644
--- a/share/gdb/syscalls/mips-o32-linux.xml
+++ b/share/gdb/syscalls/mips-o32-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/ppc-linux.xml b/share/gdb/syscalls/ppc-linux.xml
index 54728e3..dd4eba6 100644
--- a/share/gdb/syscalls/ppc-linux.xml
+++ b/share/gdb/syscalls/ppc-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/ppc64-linux.xml b/share/gdb/syscalls/ppc64-linux.xml
index 0b0b2ea..ad56db1 100644
--- a/share/gdb/syscalls/ppc64-linux.xml
+++ b/share/gdb/syscalls/ppc64-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/sparc-linux.xml b/share/gdb/syscalls/sparc-linux.xml
index 3820809..7673621 100644
--- a/share/gdb/syscalls/sparc-linux.xml
+++ b/share/gdb/syscalls/sparc-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/share/gdb/syscalls/sparc64-linux.xml b/share/gdb/syscalls/sparc64-linux.xml
index df8118b..4403ca3 100644
--- a/share/gdb/syscalls/sparc64-linux.xml
+++ b/share/gdb/syscalls/sparc64-linux.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+<!-- Copyright (C) 2010-2013 Free Software Foundation, Inc.
 
      Copying and distribution of this file, with or without modification,
      are permitted in any medium without royalty provided the copyright
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.x b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.x
index 786a79b..233c540 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.x
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.x
@@ -71,8 +71,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xbn b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xbn
index 3b506bb..fb1bf69 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xbn
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xbn
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = .;
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xc b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xc
index bb9249b..f426822 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xc
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xc
@@ -72,8 +72,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xd b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xd
index 5895356..e2cabd0 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xd
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xd
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdc b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdc
index 1ba5b1b..74f1096 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdc
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdc
@@ -72,8 +72,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdw b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdw
index 508da0e..c8bbad3 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdw
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xdw
@@ -72,8 +72,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xn b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xn
index 2a43ac9..415adfe 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xn
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xn
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xr b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xr
index f4c46f6..2a4dcb3 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xr
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xr
@@ -62,8 +62,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xs b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xs
index 60e00fc..a946e88 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xs
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xs
@@ -67,8 +67,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsc b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsc
index 24fd79a..bfea890 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsc
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsc
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsw b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsw
index 4a6bd9c..a5fc3f3 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsw
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xsw
@@ -69,8 +69,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xu b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xu
index da48110..25c8cc6 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xu
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xu
@@ -62,8 +62,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xw b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xw
index a492570..ddbde0c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xw
+++ b/x86_64-linux-android/lib/ldscripts/elf32_x86_64.xw
@@ -72,8 +72,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.x b/x86_64-linux-android/lib/ldscripts/elf_i386.x
index feb9aa6..704eba8 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.x
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.x
@@ -68,8 +68,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xbn b/x86_64-linux-android/lib/ldscripts/elf_i386.xbn
index 24a1ba1..f07da5c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xbn
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xbn
@@ -67,8 +67,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = .;
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xc b/x86_64-linux-android/lib/ldscripts/elf_i386.xc
index 74e10d2..6cc6858 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xc
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xc
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xd b/x86_64-linux-android/lib/ldscripts/elf_i386.xd
index f87ec56..b8cf799 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xd
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xd
@@ -67,8 +67,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xdc b/x86_64-linux-android/lib/ldscripts/elf_i386.xdc
index 5033a0b..9985dc8 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xdc
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xdc
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xdw b/x86_64-linux-android/lib/ldscripts/elf_i386.xdw
index 594876d..98b8872 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xdw
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xdw
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xn b/x86_64-linux-android/lib/ldscripts/elf_i386.xn
index af438c1..7060c36 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xn
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xn
@@ -67,8 +67,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xr b/x86_64-linux-android/lib/ldscripts/elf_i386.xr
index cb1b7bc..cf0e960 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xr
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xr
@@ -59,8 +59,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xs b/x86_64-linux-android/lib/ldscripts/elf_i386.xs
index 9ff8409..9d2aca7 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xs
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xs
@@ -64,8 +64,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xsc b/x86_64-linux-android/lib/ldscripts/elf_i386.xsc
index aa4556d..7e29830 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xsc
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xsc
@@ -68,8 +68,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xsw b/x86_64-linux-android/lib/ldscripts/elf_i386.xsw
index f620a24..ec1d0d9 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xsw
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xsw
@@ -67,8 +67,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xu b/x86_64-linux-android/lib/ldscripts/elf_i386.xu
index 35a5c86..23b5f2b 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xu
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xu
@@ -59,8 +59,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_i386.xw b/x86_64-linux-android/lib/ldscripts/elf_i386.xw
index b0418e4..a29e3ed 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_i386.xw
+++ b/x86_64-linux-android/lib/ldscripts/elf_i386.xw
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.x b/x86_64-linux-android/lib/ldscripts/elf_k1om.x
index 7289f18..28691ab 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.x
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.x
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xbn b/x86_64-linux-android/lib/ldscripts/elf_k1om.xbn
index 829e845..6e6c571 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xbn
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xbn
@@ -73,8 +73,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = .;
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xc b/x86_64-linux-android/lib/ldscripts/elf_k1om.xc
index e41054b..24ed4d1 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xc
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xc
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xd b/x86_64-linux-android/lib/ldscripts/elf_k1om.xd
index 384eb8c..2731474 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xd
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xd
@@ -73,9 +73,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xdc b/x86_64-linux-android/lib/ldscripts/elf_k1om.xdc
index 094dbae..af6b8f7 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xdc
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xdc
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xdw b/x86_64-linux-android/lib/ldscripts/elf_k1om.xdw
index 3b64c75..967c35d 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xdw
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xdw
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xn b/x86_64-linux-android/lib/ldscripts/elf_k1om.xn
index f8ed61f..97cbf58 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xn
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xn
@@ -73,9 +73,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xr b/x86_64-linux-android/lib/ldscripts/elf_k1om.xr
index ecf777a..1c5ed87 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xr
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xr
@@ -66,8 +66,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xs b/x86_64-linux-android/lib/ldscripts/elf_k1om.xs
index 3c20a8b..882543f 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xs
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xs
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xsc b/x86_64-linux-android/lib/ldscripts/elf_k1om.xsc
index 1c1a6ea..def7b4c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xsc
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xsc
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xsw b/x86_64-linux-android/lib/ldscripts/elf_k1om.xsw
index b2ca6b8..665791a 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xsw
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xsw
@@ -69,9 +69,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xu b/x86_64-linux-android/lib/ldscripts/elf_k1om.xu
index e61a132..f1bec71 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xu
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xu
@@ -66,8 +66,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_k1om.xw b/x86_64-linux-android/lib/ldscripts/elf_k1om.xw
index 5c601c9..1a5ac83 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_k1om.xw
+++ b/x86_64-linux-android/lib/ldscripts/elf_k1om.xw
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.x b/x86_64-linux-android/lib/ldscripts/elf_l1om.x
index 8af0ef4..fbd910c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.x
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.x
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xbn b/x86_64-linux-android/lib/ldscripts/elf_l1om.xbn
index f3aa8e4..f992977 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xbn
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xbn
@@ -73,8 +73,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = .;
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xc b/x86_64-linux-android/lib/ldscripts/elf_l1om.xc
index 80af518..2bb4610 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xc
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xc
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xd b/x86_64-linux-android/lib/ldscripts/elf_l1om.xd
index 2594b10..4e33ce6 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xd
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xd
@@ -73,9 +73,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xdc b/x86_64-linux-android/lib/ldscripts/elf_l1om.xdc
index 95de49e..6cbcbb4 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xdc
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xdc
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xdw b/x86_64-linux-android/lib/ldscripts/elf_l1om.xdw
index fed5612..59ae35c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xdw
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xdw
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xn b/x86_64-linux-android/lib/ldscripts/elf_l1om.xn
index 29115f2..efad55b 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xn
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xn
@@ -73,9 +73,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xr b/x86_64-linux-android/lib/ldscripts/elf_l1om.xr
index 5f85cde..80d5eab 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xr
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xr
@@ -66,8 +66,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xs b/x86_64-linux-android/lib/ldscripts/elf_l1om.xs
index d5087fc..2155610 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xs
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xs
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xsc b/x86_64-linux-android/lib/ldscripts/elf_l1om.xsc
index bef5878..b653cc4 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xsc
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xsc
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xsw b/x86_64-linux-android/lib/ldscripts/elf_l1om.xsw
index df209ac..17fa1be 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xsw
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xsw
@@ -69,9 +69,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xu b/x86_64-linux-android/lib/ldscripts/elf_l1om.xu
index 16609b2..153dfbe 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xu
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xu
@@ -66,8 +66,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_l1om.xw b/x86_64-linux-android/lib/ldscripts/elf_l1om.xw
index 6714d61..803c513 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_l1om.xw
+++ b/x86_64-linux-android/lib/ldscripts/elf_l1om.xw
@@ -74,9 +74,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.x b/x86_64-linux-android/lib/ldscripts/elf_x86_64.x
index 4399d7e..812475a 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.x
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.x
@@ -71,9 +71,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xbn b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xbn
index 4bc70e6..9b6c657 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xbn
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xbn
@@ -70,8 +70,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   . = .;
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xc b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xc
index 2cff6a9..ae3cf45 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xc
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xc
@@ -72,9 +72,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xd b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xd
index f9ab16a..077b45d 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xd
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xd
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdc b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdc
index 3bbb98b..affc584 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdc
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdc
@@ -72,9 +72,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdw b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdw
index 1e3c905..408b349 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdw
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xdw
@@ -72,9 +72,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xn b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xn
index 62e8f1f..f697fff 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xn
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xn
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xr b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xr
index 1850188..1340853 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xr
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xr
@@ -62,8 +62,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xs b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xs
index dbdf130..fad1d6e 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xs
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xs
@@ -67,9 +67,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsc b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsc
index 0296a5a..b8a828c 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsc
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsc
@@ -70,9 +70,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsw b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsw
index 08663bc..24badbf 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsw
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xsw
@@ -69,9 +69,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xu b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xu
index 4f7aa0a..c452945 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xu
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xu
@@ -62,8 +62,8 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges 0 : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
   /* Exception handling  */
   .eh_frame     0 : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table 0 : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xw b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xw
index 1cc0fd2..96c75c1 100644
--- a/x86_64-linux-android/lib/ldscripts/elf_x86_64.xw
+++ b/x86_64-linux-android/lib/ldscripts/elf_x86_64.xw
@@ -72,9 +72,9 @@
   /* These sections are generated by the Sun/Oracle C++ compiler.  */
   .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
   .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to align at exactly
-     a page boundary to make life easier for apriori. */
-  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Adjust the address for the data segment.  For 32 bits we want to align
+  at exactly a page boundary to make life easier for apriori. */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
   /* Exception handling  */
   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
diff --git a/x86_64-linux-android/lib/libatomic.a b/x86_64-linux-android/lib/libatomic.a
index bda0515..39faa34 100644
--- a/x86_64-linux-android/lib/libatomic.a
+++ b/x86_64-linux-android/lib/libatomic.a
Binary files differ
diff --git a/x86_64-linux-android/lib/libgomp.a b/x86_64-linux-android/lib/libgomp.a
index 33d83a2..6aed775 100644
--- a/x86_64-linux-android/lib/libgomp.a
+++ b/x86_64-linux-android/lib/libgomp.a
Binary files differ
diff --git a/x86_64-linux-android/lib64/libatomic.a b/x86_64-linux-android/lib64/libatomic.a
index 90deaf0..463c8f6 100644
--- a/x86_64-linux-android/lib64/libatomic.a
+++ b/x86_64-linux-android/lib64/libatomic.a
Binary files differ
diff --git a/x86_64-linux-android/lib64/libgomp.a b/x86_64-linux-android/lib64/libgomp.a
index 4a1ff64..a4582c7 100644
--- a/x86_64-linux-android/lib64/libgomp.a
+++ b/x86_64-linux-android/lib64/libgomp.a
Binary files differ
diff --git a/x86_64-linux-android/libx32/libatomic.a b/x86_64-linux-android/libx32/libatomic.a
index 4edb506..73c5949 100644
--- a/x86_64-linux-android/libx32/libatomic.a
+++ b/x86_64-linux-android/libx32/libatomic.a
Binary files differ
diff --git a/x86_64-linux-android/libx32/libgomp.a b/x86_64-linux-android/libx32/libgomp.a
index 58f9c1f..6589a1b 100644
--- a/x86_64-linux-android/libx32/libgomp.a
+++ b/x86_64-linux-android/libx32/libgomp.a
Binary files differ