summaryrefslogtreecommitdiff
path: root/meta-linaro-toolchain/recipes-core
diff options
context:
space:
mode:
authorKoen Kooi <koen.kooi@linaro.org>2014-12-09 11:16:51 +0100
committerKoen Kooi <koen.kooi@linaro.org>2014-12-09 12:44:37 +0100
commit1d0fb495cc6c345ecabbdf6745c2080155e20502 (patch)
treede82ce96f28007a38f08e410703ab0f81cc5993e /meta-linaro-toolchain/recipes-core
parent164cf8960ec5a82220ac503a126d4178e480f391 (diff)
downloadmeta-linaro-1d0fb495cc6c345ecabbdf6745c2080155e20502.tar.gz
glibc linaro 2.20: add ILP32 patches
They don't seem to break the regular builds, so add them unconditionally. Change-Id: I26ff9f279b026db84b77672c86dec1f413eb9f53 Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Diffstat (limited to 'meta-linaro-toolchain/recipes-core')
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0002-Fix-utmp-struct-for-compatibility-reasons.patch53
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0003-Allow-sigset-be-an-array-of-a-different-type.patch75
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0004-Add-ability-for-the-IPC-structures-msqid_ds-semid_ds.patch219
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0005-Allow-rusage-work-on-a-big-endian-32bit-on-64bit-tar.patch156
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0006-Allow-fd_mask-type-not-be-an-array-of-long.patch48
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0007-Allow-some-fields-of-siginfo-to-be-different-from-th.patch102
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0008-Allow-generic-stat-and-statfs-not-have-padding-for-3.patch56
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0009-Add-header-guards-to-sysdep.h-headers.patch138
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0010-Add-dynamic-ILP32-AARCH64-relocations-to-elf.h.patch254
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0011-Add-PTR_REG-PTR_LOG_SIZE-and-PTR_SIZE.-Use-it-in-LDS.patch159
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0012-Use-PTR_REG-in-crti.S.patch189
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0013-Use-PTR_REG-PTR_SIZE-PTR_SIZE_LOG-in-dl-tlsesc.S.patch111
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0014-Use-PTR_-macros-in-dl-trampoline.S.patch94
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0015-Use-PTR_-in-start.S.patch75
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0016-Use-PTR_REG-in-getcontext.S.patch30
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0017-Detect-ILP32-in-configure-scripts.patch163
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0018-Syscalls-for-ILP32-are-passed-always-via-64bit-value.patch145
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0019-Reformat-inline-asm-in-elf_machine_load_address.patch57
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0020-Add-ILP32-support-to-elf_machine_load_address.patch61
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0021-Set-up-wordsize-for-ILP32.patch40
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0022-Add-ILP32-to-makefiles.patch59
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0023-Add-support-to-ldconfig-for-ILP32-and-libilp32.patch108
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0024-Add-ILP32-ld.so-to-the-known-interpreter-names.patch29
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0025-Add-ldd-rewrite.sed-so-that-ilp32-ld.so-can-be-found.patch49
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0026-Add-kernel_sigaction.h-for-AARCH64-ILP32.patch78
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0027-Add-sigstack.h-header-for-ILP32-reasons.patch94
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0028-Fix-up-ucontext-for-ILP32.patch40
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0029-Add-typesizes.h-for-ILP32.patch160
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0030-Make-lp64-and-ilp32-directories.patch722
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0031-sysdeps-unix-sysv-linux-aarch64-sysdep.h-Fix-crash-i.patch40
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0032-sysdeps-unix-sysv-linux-aarch64-configure-Reduce-ker.patch26
-rw-r--r--meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb35
32 files changed, 3664 insertions, 1 deletions
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0002-Fix-utmp-struct-for-compatibility-reasons.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0002-Fix-utmp-struct-for-compatibility-reasons.patch
new file mode 100644
index 0000000..5f33135
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0002-Fix-utmp-struct-for-compatibility-reasons.patch
@@ -0,0 +1,53 @@
+From 546464783ad948f4ac2061aff08ec79b9f913f71 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:25 -0700
+Subject: [PATCH 02/32] Fix utmp struct for compatibility reasons.
+
+NOTE This is an ABI change for AARCH64.
+If you have some AARCH32 and AARCH64 applications and they both use
+utmp, one of them will fail due to the use of time_t inside the
+utmp binary format.
+
+This fixes the problem by setting __WORDSIZE_TIME64_COMPAT32.
+
+* sysdeps/aarch64/bits/wordsize.h: New file.
+---
+ sysdeps/aarch64/bits/wordsize.h | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+ create mode 100644 sysdeps/aarch64/bits/wordsize.h
+
+diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
+new file mode 100644
+index 0000000..3ecccaa
+--- /dev/null
++++ b/sysdeps/aarch64/bits/wordsize.h
+@@ -0,0 +1,26 @@
++/* Copyright (C) 2014 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#define __WORDSIZE 64
++
++/* LP64 ABI has a 64bit time_t.
++ This allows aarch32 and AARCH64 applications
++ both access utmp. */
++#define __WORDSIZE_TIME64_COMPAT32 1
++
++/* LP64 use the 64bit system call interface. */
++#define __SYSCALL_WORDSIZE 64
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0003-Allow-sigset-be-an-array-of-a-different-type.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0003-Allow-sigset-be-an-array-of-a-different-type.patch
new file mode 100644
index 0000000..8888dae
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0003-Allow-sigset-be-an-array-of-a-different-type.patch
@@ -0,0 +1,75 @@
+From cbcc5f6eb5225df0c6931aae5afaf24d3a3681cb Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:26 -0700
+Subject: [PATCH 03/32] Allow sigset be an array of a different type
+
+For AARCH64 ILP32, sigset needs to be an array of unsigned long long as
+it needs to be 64bit to match AARCH64 lP64.
+
+* sysdeps/unix/sysv/linux/bits/sigset.h: Include bits/types.h.
+(__sigset_inner_t): New typedef.
+(_SIGSET_NWORDS): Use __sigset_inner_t instead of unsigned long.
+(__sigset_t): Likewise.
+(__sigmask): Likewise.
+(__sigword): Likewise.
+(__SIGSETFN): Likewise.
+---
+ sysdeps/unix/sysv/linux/bits/sigset.h | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/bits/sigset.h b/sysdeps/unix/sysv/linux/bits/sigset.h
+index af4ae83..4648e7b 100644
+--- a/sysdeps/unix/sysv/linux/bits/sigset.h
++++ b/sysdeps/unix/sysv/linux/bits/sigset.h
+@@ -19,14 +19,22 @@
+ #ifndef _SIGSET_H_types
+ # define _SIGSET_H_types 1
+
++#include <bits/types.h>
++
+ typedef int __sig_atomic_t;
+
++#ifndef __SIGSET_INNER_T
++typedef unsigned long __sigset_inner_t;
++#else
++typedef __SIGSET_INNER_T __sigset_inner_t;
++#endif
++
+ /* A `sigset_t' has a bit for each signal. */
+
+-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
++# define _SIGSET_NWORDS (1024 / (8 * sizeof (__sigset_inner_t)))
+ typedef struct
+ {
+- unsigned long int __val[_SIGSET_NWORDS];
++ __sigset_inner_t __val[_SIGSET_NWORDS];
+ } __sigset_t;
+
+ #endif
+@@ -47,10 +55,10 @@ typedef struct
+
+ /* Return a mask that includes the bit for SIG only. */
+ # define __sigmask(sig) \
+- (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
++ (((__sigset_inner_t) 1) << (((sig) - 1) % (8 * sizeof (__sigset_inner_t))))
+
+ /* Return the word index for SIG. */
+-# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int)))
++# define __sigword(sig) (((sig) - 1) / (8 * sizeof (__sigset_inner_t)))
+
+ # if defined __GNUC__ && __GNUC__ >= 2
+ # define __sigemptyset(set) \
+@@ -108,8 +116,8 @@ extern int __sigdelset (__sigset_t *, int);
+ _EXTERN_INLINE int \
+ NAME (CONST __sigset_t *__set, int __sig) \
+ { \
+- unsigned long int __mask = __sigmask (__sig); \
+- unsigned long int __word = __sigword (__sig); \
++ __sigset_inner_t __mask = __sigmask (__sig); \
++ __sigset_inner_t __word = __sigword (__sig); \
+ return BODY; \
+ }
+
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0004-Add-ability-for-the-IPC-structures-msqid_ds-semid_ds.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0004-Add-ability-for-the-IPC-structures-msqid_ds-semid_ds.patch
new file mode 100644
index 0000000..8e45284
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0004-Add-ability-for-the-IPC-structures-msqid_ds-semid_ds.patch
@@ -0,0 +1,219 @@
+From 2ad4fd571dd039a756d2a7b6c5fbf6aad19721ec Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:27 -0700
+Subject: [PATCH 04/32] Add ability for the IPC structures (msqid_ds, semid_ds,
+ shmid_ds, etc.) to have time_t being 64bit
+
+The generic headers for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.)
+already have the ability to already take account time_t being 64bit but only
+if WORDSIZE is set 64. Also for AARCH64:ILP32, we want these structures to
+match up with the LP64 size, so we add change the all of the unsigned long
+types in these headers to be __syscall_ulong_t. Also there is one size_t
+field which we need to be changed for AARCH64:ILP32 so we add
+a macro which can be changed but defaulting to size_t.
+
+* sysdeps/unix/sysv/linux/generic/bits/msq.h (msgqnum_t): Change to
+__syscall_ulong_t.
+(msglen_t): Likewise.
+(__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE
+is 64.
+(struct msqid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
+Also change some unsigned long fields to __syscall_ulong_t.
+* sysdeps/unix/sysv/linux/generic/bits/sem.h (__IPC_TIME_T_64_BITS):
+Define if not defined already and WORDSIZE is 64.
+(struct semid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
+Also change some unsigned long fields to __syscall_ulong_t.
+* sysdeps/unix/sysv/linux/generic/bits/shm.h (__IPC_TIME_T_64_BITS):
+Define if not defined already and WORDSIZE is 64.
+(__SHMID_DS_SIZE_TYPE): Define if not already defined.
+(struct shmid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS.
+Change shm_segsz definition to be based on __SHMID_DS_SIZE_TYPE.
+Also change some unsigned long fields to __syscall_ulong_t.
+(struct shminfo): change some unsigned long fields to __syscall_ulong_t.
+(struct shm_info): Likewise.
+---
+ sysdeps/unix/sysv/linux/generic/bits/msq.h | 21 ++++++++-----
+ sysdeps/unix/sysv/linux/generic/bits/sem.h | 14 ++++++---
+ sysdeps/unix/sysv/linux/generic/bits/shm.h | 50 +++++++++++++++++-------------
+ 3 files changed, 51 insertions(+), 34 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/generic/bits/msq.h b/sysdeps/unix/sysv/linux/generic/bits/msq.h
+index f3fcd8d..df5128e 100644
+--- a/sysdeps/unix/sysv/linux/generic/bits/msq.h
++++ b/sysdeps/unix/sysv/linux/generic/bits/msq.h
+@@ -31,8 +31,13 @@
+ #endif
+
+ /* Types used in the structure definition. */
+-typedef unsigned long int msgqnum_t;
+-typedef unsigned long int msglen_t;
++typedef __syscall_ulong_t msgqnum_t;
++typedef __syscall_ulong_t msglen_t;
++
++#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
++#define __IPC_TIME_T_64_BITS
++#endif
++
+
+ /* Structure of record for one message inside the kernel.
+ The type `struct msg' is opaque. */
+@@ -40,24 +45,24 @@ struct msqid_ds
+ {
+ struct ipc_perm msg_perm; /* structure describing operation permission */
+ __time_t msg_stime; /* time of last msgsnd command */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved1;
+ #endif
+ __time_t msg_rtime; /* time of last msgrcv command */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved2;
+ #endif
+ __time_t msg_ctime; /* time of last change */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved3;
+ #endif
+- unsigned long int __msg_cbytes; /* current number of bytes on queue */
++ __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */
+ msgqnum_t msg_qnum; /* number of messages currently on queue */
+ msglen_t msg_qbytes; /* max number of bytes allowed on queue */
+ __pid_t msg_lspid; /* pid of last msgsnd() */
+ __pid_t msg_lrpid; /* pid of last msgrcv() */
+- unsigned long int __glibc_reserved4;
+- unsigned long int __glibc_reserved5;
++ __syscall_ulong_t __glibc_reserved4;
++ __syscall_ulong_t __glibc_reserved5;
+ };
+
+ #ifdef __USE_MISC
+diff --git a/sysdeps/unix/sysv/linux/generic/bits/sem.h b/sysdeps/unix/sysv/linux/generic/bits/sem.h
+index 3c9aea8..a0a5d47 100644
+--- a/sysdeps/unix/sysv/linux/generic/bits/sem.h
++++ b/sysdeps/unix/sysv/linux/generic/bits/sem.h
+@@ -36,21 +36,25 @@
+ #define SETALL 17 /* set all semval's */
+
+
++#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
++#define __IPC_TIME_T_64_BITS
++#endif
++
+ /* Data structure describing a set of semaphores. */
+ struct semid_ds
+ {
+ struct ipc_perm sem_perm; /* operation permission struct */
+ __time_t sem_otime; /* last semop() time */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved1;
+ #endif
+ __time_t sem_ctime; /* last time changed by semctl() */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved2;
+ #endif
+- unsigned long int sem_nsems; /* number of semaphores in set */
+- unsigned long int __glibc_reserved3;
+- unsigned long int __glibc_reserved4;
++ __syscall_ulong_t sem_nsems; /* number of semaphores in set */
++ __syscall_ulong_t __glibc_reserved3;
++ __syscall_ulong_t __glibc_reserved4;
+ };
+
+ /* The user should define a union like the following to use it for arguments
+diff --git a/sysdeps/unix/sysv/linux/generic/bits/shm.h b/sysdeps/unix/sysv/linux/generic/bits/shm.h
+index 0dbed61..78ff79d 100644
+--- a/sysdeps/unix/sysv/linux/generic/bits/shm.h
++++ b/sysdeps/unix/sysv/linux/generic/bits/shm.h
+@@ -44,31 +44,39 @@ __BEGIN_DECLS
+ extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
++#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64
++#define __IPC_TIME_T_64_BITS
++#endif
++
+ /* Type to count number of attaches. */
+-typedef unsigned long int shmatt_t;
++typedef __syscall_ulong_t shmatt_t;
++
++#ifndef __SHMID_DS_SIZE_TYPE
++#define __SHMID_DS_SIZE_TYPE(field) size_t field
++#endif
+
+ /* Data structure describing a shared memory segment. */
+ struct shmid_ds
+ {
+ struct ipc_perm shm_perm; /* operation permission struct */
+- size_t shm_segsz; /* size of segment in bytes */
++ __SHMID_DS_SIZE_TYPE(shm_segsz); /* size of segment in bytes */
+ __time_t shm_atime; /* time of last shmat() */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved1;
+ #endif
+ __time_t shm_dtime; /* time of last shmdt() */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved2;
+ #endif
+ __time_t shm_ctime; /* time of last change by shmctl() */
+-#if __WORDSIZE == 32
++#ifndef __IPC_TIME_T_64_BITS
+ unsigned long int __glibc_reserved3;
+ #endif
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ shmatt_t shm_nattch; /* number of current attaches */
+- unsigned long int __glibc_reserved4;
+- unsigned long int __glibc_reserved5;
++ __syscall_ulong_t __glibc_reserved4;
++ __syscall_ulong_t __glibc_reserved5;
+ };
+
+ #ifdef __USE_MISC
+@@ -85,25 +93,25 @@ struct shmid_ds
+
+ struct shminfo
+ {
+- unsigned long int shmmax;
+- unsigned long int shmmin;
+- unsigned long int shmmni;
+- unsigned long int shmseg;
+- unsigned long int shmall;
+- unsigned long int __glibc_reserved1;
+- unsigned long int __glibc_reserved2;
+- unsigned long int __glibc_reserved3;
+- unsigned long int __glibc_reserved4;
++ __syscall_ulong_t shmmax;
++ __syscall_ulong_t shmmin;
++ __syscall_ulong_t shmmni;
++ __syscall_ulong_t shmseg;
++ __syscall_ulong_t shmall;
++ __syscall_ulong_t __glibc_reserved1;
++ __syscall_ulong_t __glibc_reserved2;
++ __syscall_ulong_t __glibc_reserved3;
++ __syscall_ulong_t __glibc_reserved4;
+ };
+
+ struct shm_info
+ {
+ int used_ids;
+- unsigned long int shm_tot; /* total allocated shm */
+- unsigned long int shm_rss; /* total resident shm */
+- unsigned long int shm_swp; /* total swapped shm */
+- unsigned long int swap_attempts;
+- unsigned long int swap_successes;
++ __syscall_ulong_t shm_tot; /* total allocated shm */
++ __syscall_ulong_t shm_rss; /* total resident shm */
++ __syscall_ulong_t shm_swp; /* total swapped shm */
++ __syscall_ulong_t swap_attempts;
++ __syscall_ulong_t swap_successes;
+ };
+
+ #endif /* __USE_MISC */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0005-Allow-rusage-work-on-a-big-endian-32bit-on-64bit-tar.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0005-Allow-rusage-work-on-a-big-endian-32bit-on-64bit-tar.patch
new file mode 100644
index 0000000..8b72820
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0005-Allow-rusage-work-on-a-big-endian-32bit-on-64bit-tar.patch
@@ -0,0 +1,156 @@
+From 45a3fed52fcce87afb3688e518a33f5e1a3ca2bf Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:28 -0700
+Subject: [PATCH 05/32] Allow rusage work on a big-endian 32bit-on-64bit target
+
+Right now rusage works for x32 like ABIs but only for little-endian.
+Since AARCH64:ILP32 is a big-endian ABI also. We need to invent a
+new way to handle big-endian ABIs also. This adds __RUSAGE_LONG
+which is used for this purpose.
+
+* sysdeps/unix/sysv/linux/bits/resource.h (__RUSAGE_LONG): New define.
+(struct rusage): Use __RUSAGE_LONG instead of unions.
+---
+ sysdeps/unix/sysv/linux/bits/resource.h | 99 +++++++++------------------------
+ 1 file changed, 27 insertions(+), 72 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
+index 95c1702..698069d 100644
+--- a/sysdeps/unix/sysv/linux/bits/resource.h
++++ b/sysdeps/unix/sysv/linux/bits/resource.h
+@@ -182,8 +182,19 @@ enum __rusage_who
+
+ /* The purpose of all the unions is to have the kernel-compatible layout
+ while keeping the API type as 'long int', and among machines where
+- __syscall_slong_t is not 'long int', this only does the right thing
+- for little-endian ones, like x32. */
++ __syscall_slong_t is not 'long int'. */
++
++#ifndef __RUSAGE_LONG
++/* This definition works where __syscall_slong_t is the same as 'long int'
++ and on little-endian when __syscall_slong_t is not 'long int' like x32. */
++# define __RUSAGE_LONG(__field) \
++ __extension__ union \
++ { \
++ long int __field; \
++ __syscall_slong_t __##__field##_word; \
++ }
++#endif
++
+ struct rusage
+ {
+ /* Total amount of user time used. */
+@@ -191,96 +202,40 @@ struct rusage
+ /* Total amount of system time used. */
+ struct timeval ru_stime;
+ /* Maximum resident set size (in kilobytes). */
+- __extension__ union
+- {
+- long int ru_maxrss;
+- __syscall_slong_t __ru_maxrss_word;
+- };
++ __RUSAGE_LONG(ru_maxrss);
+ /* Amount of sharing of text segment memory
+ with other processes (kilobyte-seconds). */
+ /* Maximum resident set size (in kilobytes). */
+- __extension__ union
+- {
+- long int ru_ixrss;
+- __syscall_slong_t __ru_ixrss_word;
+- };
++ __RUSAGE_LONG(ru_ixrss);
+ /* Amount of data segment memory used (kilobyte-seconds). */
+- __extension__ union
+- {
+- long int ru_idrss;
+- __syscall_slong_t __ru_idrss_word;
+- };
++ __RUSAGE_LONG(ru_idrss);
+ /* Amount of stack memory used (kilobyte-seconds). */
+- __extension__ union
+- {
+- long int ru_isrss;
+- __syscall_slong_t __ru_isrss_word;
+- };
++ __RUSAGE_LONG(ru_isrss);
+ /* Number of soft page faults (i.e. those serviced by reclaiming
+ a page from the list of pages awaiting reallocation. */
+- __extension__ union
+- {
+- long int ru_minflt;
+- __syscall_slong_t __ru_minflt_word;
+- };
++ __RUSAGE_LONG(ru_minflt);
+ /* Number of hard page faults (i.e. those that required I/O). */
+- __extension__ union
+- {
+- long int ru_majflt;
+- __syscall_slong_t __ru_majflt_word;
+- };
++ __RUSAGE_LONG(ru_majflt);
+ /* Number of times a process was swapped out of physical memory. */
+- __extension__ union
+- {
+- long int ru_nswap;
+- __syscall_slong_t __ru_nswap_word;
+- };
++ __RUSAGE_LONG(ru_nswap);
+ /* Number of input operations via the file system. Note: This
+ and `ru_oublock' do not include operations with the cache. */
+- __extension__ union
+- {
+- long int ru_inblock;
+- __syscall_slong_t __ru_inblock_word;
+- };
++ __RUSAGE_LONG(ru_inblock);
+ /* Number of output operations via the file system. */
+- __extension__ union
+- {
+- long int ru_oublock;
+- __syscall_slong_t __ru_oublock_word;
+- };
++ __RUSAGE_LONG(ru_oublock);
+ /* Number of IPC messages sent. */
+- __extension__ union
+- {
+- long int ru_msgsnd;
+- __syscall_slong_t __ru_msgsnd_word;
+- };
++ __RUSAGE_LONG(ru_msgsnd);
+ /* Number of IPC messages received. */
+- __extension__ union
+- {
+- long int ru_msgrcv;
+- __syscall_slong_t __ru_msgrcv_word;
+- };
++ __RUSAGE_LONG(ru_msgrcv);
+ /* Number of signals delivered. */
+- __extension__ union
+- {
+- long int ru_nsignals;
+- __syscall_slong_t __ru_nsignals_word;
+- };
++ __RUSAGE_LONG(ru_nsignals);
+ /* Number of voluntary context switches, i.e. because the process
+ gave up the process before it had to (usually to wait for some
+ resource to be available). */
+- __extension__ union
+- {
+- long int ru_nvcsw;
+- __syscall_slong_t __ru_nvcsw_word;
+- };
++ __RUSAGE_LONG(ru_nvcsw);
+ /* Number of involuntary context switches, i.e. a higher priority process
+ became runnable or the current process used up its time slice. */
+- __extension__ union
+- {
+- long int ru_nivcsw;
+- __syscall_slong_t __ru_nivcsw_word;
+- };
++ __RUSAGE_LONG(ru_nivcsw);
+ };
+
+ /* Priority limits. */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0006-Allow-fd_mask-type-not-be-an-array-of-long.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0006-Allow-fd_mask-type-not-be-an-array-of-long.patch
new file mode 100644
index 0000000..6766c31
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0006-Allow-fd_mask-type-not-be-an-array-of-long.patch
@@ -0,0 +1,48 @@
+From 7205aca835ba7fca285644d1c9145a39742ef94f Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:29 -0700
+Subject: [PATCH 06/32] Allow fd_mask type not be an array of long.
+
+Even though XPG4.2 requires fd_set member be a long, AARCH64:ILP32
+needs it to be the same size as AARCH64:LP64 for big-endian so we
+need it to be long long.
+
+* misc/sys/select.h (__FD_MASK_TYPE): Define.
+(__FD_MASK_CONST): Define.
+(__fd_mask): Change to base on __FD_MASK_TYPE.
+(__FD_MASK): Use __FD_MASK_CONST.
+---
+ misc/sys/select.h | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/misc/sys/select.h b/misc/sys/select.h
+index 941588d..0ca660e 100644
+--- a/misc/sys/select.h
++++ b/misc/sys/select.h
+@@ -49,16 +49,20 @@ typedef __suseconds_t suseconds_t;
+ # define __suseconds_t_defined
+ #endif
+
++/* The fd_set member is required to be an array of longs by XPG4.2. */
++#ifndef __FD_MASK_TYPE
++#define __FD_MASK_TYPE long
++#define __FD_MASK_CONST(a) a##ul
++#endif
+
+-/* The fd_set member is required to be an array of longs. */
+-typedef long int __fd_mask;
++typedef __FD_MASK_TYPE __fd_mask;
+
+ /* Some versions of <linux/posix_types.h> define this macros. */
+ #undef __NFDBITS
+ /* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
+ #define __NFDBITS (8 * (int) sizeof (__fd_mask))
+ #define __FD_ELT(d) ((d) / __NFDBITS)
+-#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS)))
++#define __FD_MASK(d) ((__fd_mask) (__FD_MASK_CONST(1) << ((d) % __NFDBITS)))
+
+ /* fd_set for select and pselect. */
+ typedef struct
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0007-Allow-some-fields-of-siginfo-to-be-different-from-th.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0007-Allow-some-fields-of-siginfo-to-be-different-from-th.patch
new file mode 100644
index 0000000..b5c7ee2
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0007-Allow-some-fields-of-siginfo-to-be-different-from-th.patch
@@ -0,0 +1,102 @@
+From b10436b76a65def68aec16dfbdb6617d17dba2a0 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:30 -0700
+Subject: [PATCH 07/32] Allow some fields of siginfo to be different from the
+ generic one
+
+In AARCH64:ILP32, we want to use the layout for siginfo as AARCH64:LP64,
+so we need to add a few hooks into siginfo.h to support this.
+
+* sysdeps/unix/sysv/linux/bits/siginfo.h (__SIGINFO_VOIDPTR): New define.
+(__SIGINFO_BAND): New define.
+(union sigval): Use __SIGINFO_VOIDPTR for the pointer.
+(__SI_PAD_SIZE): Don't define if it is already defined.
+(struct siginfo): Use __SIGINFO_VOIDPTR for the pointer types.
+Use __SIGINFO_BAND for the si_band field.
+(struct sigevent): Add a comment on why the remaining fields
+don't need special handling.
+---
+ sysdeps/unix/sysv/linux/bits/siginfo.h | 26 +++++++++++++++++++-------
+ 1 file changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
+index ae603e8..f319d44 100644
+--- a/sysdeps/unix/sysv/linux/bits/siginfo.h
++++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
+@@ -23,6 +23,14 @@
+
+ #include <bits/wordsize.h>
+
++#ifndef __SIGINFO_VOIDPTR
++#define __SIGINFO_VOIDPTR(field) void *field
++#endif
++
++#ifndef __SIGINFO_BAND
++#define __SIGINFO_BAND(field) long field
++#endif
++
+ #if (!defined __have_sigval_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t \
+ || defined __need_sigevent_t))
+@@ -32,7 +40,7 @@
+ typedef union sigval
+ {
+ int sival_int;
+- void *sival_ptr;
++ __SIGINFO_VOIDPTR (sival_ptr);
+ } sigval_t;
+ #endif
+
+@@ -41,10 +49,13 @@ typedef union sigval
+ # define __have_siginfo_t 1
+
+ # define __SI_MAX_SIZE 128
+-# if __WORDSIZE == 64
+-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
++
++# ifndef __SI_PAD_SIZE
++# if __WORDSIZE == 64
++# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
+ # else
+-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
++# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
++# endif
+ # endif
+
+ typedef struct
+@@ -94,21 +105,21 @@ typedef struct
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
+ struct
+ {
+- void *si_addr; /* Faulting insn/memory ref. */
++ __SIGINFO_VOIDPTR (si_addr); /* Faulting insn/memory ref. */
+ short int si_addr_lsb; /* Valid LSB of the reported address. */
+ } _sigfault;
+
+ /* SIGPOLL. */
+ struct
+ {
+- long int si_band; /* Band event for SIGPOLL. */
++ __SIGINFO_BAND (si_band); /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
+
+ /* SIGSYS. */
+ struct
+ {
+- void *_call_addr; /* Calling user insn. */
++ __SIGINFO_VOIDPTR (_call_addr); /* Calling user insn. */
+ int _syscall; /* Triggering system call number. */
+ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
+ } _sigsys;
+@@ -312,6 +323,7 @@ typedef struct sigevent
+ thread to receive the signal. */
+ __pid_t _tid;
+
++ /* Note these two are handled only in userspace. */
+ struct
+ {
+ void (*_function) (sigval_t); /* Function to start. */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0008-Allow-generic-stat-and-statfs-not-have-padding-for-3.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0008-Allow-generic-stat-and-statfs-not-have-padding-for-3.patch
new file mode 100644
index 0000000..848aad0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0008-Allow-generic-stat-and-statfs-not-have-padding-for-3.patch
@@ -0,0 +1,56 @@
+From aad845880291f1e6af7c9721f1c53ed36abd10e6 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:31 -0700
+Subject: [PATCH 08/32] Allow generic stat and statfs not have padding for
+ 32bit targets
+
+With ILP32, off_t, ino_t, blkcnt_t, fsbcnt_t, fsbfilcnt_t are all
+64bit types, this allows us to use the same layout for the
+structure stat and statfs as LP64. So we need to remove
+the padding which is added for non 64bit targets.
+
+* sysdeps/unix/sysv/linux/generic/bits/stat.h (__field64): Use
+the 64bit version when off_t, ino_t and blkcnt_t match their 64bit
+version.
+* sysdeps/unix/sysv/linux/generic/bits/statfs.h (__field64): Use
+the 64bit version when fsblkcnt_t and fsfilcnt_t match their 64bit
+version.
+---
+ sysdeps/unix/sysv/linux/generic/bits/stat.h | 5 ++++-
+ sysdeps/unix/sysv/linux/generic/bits/statfs.h | 4 +++-
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
+index faa2800..3c92184 100644
+--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
++++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
+@@ -42,7 +42,10 @@
+
+ #if defined __USE_FILE_OFFSET64
+ # define __field64(type, type64, name) type64 name
+-#elif __WORDSIZE == 64
++#elif __WORDSIZE == 64 \
++ || (defined(__OFF_T_MATCHES_OFF64_T) \
++ && defined(__INO_T_MATCHES_INO64_T) \
++ && defined (__BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE))
+ # define __field64(type, type64, name) type name
+ #elif __BYTE_ORDER == __LITTLE_ENDIAN
+ # define __field64(type, type64, name) \
+diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
+index e32cf76..d3bfb50 100644
+--- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h
++++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
+@@ -34,7 +34,9 @@
+
+ #if defined __USE_FILE_OFFSET64
+ # define __field64(type, type64, name) type64 name
+-#elif __WORDSIZE == 64
++#elif __WORDSIZE == 64 \
++ || (defined (__FSBLKCNT_T_TYPE_MATCHES_FSBLKCNT64_T_TYPE) \
++ && defined (__FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE))
+ # define __field64(type, type64, name) type name
+ #elif __BYTE_ORDER == __LITTLE_ENDIAN
+ # define __field64(type, type64, name) \
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0009-Add-header-guards-to-sysdep.h-headers.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0009-Add-header-guards-to-sysdep.h-headers.patch
new file mode 100644
index 0000000..276fbb6
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0009-Add-header-guards-to-sysdep.h-headers.patch
@@ -0,0 +1,138 @@
+From 6d7277631963cebbb8d437cb1525643ade63e883 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:32 -0700
+Subject: [PATCH 09/32] Add header guards to sysdep.h headers.
+
+* sysdeps/aarch64/sysdep.h: Add header guards.
+
+[AARCH64] Remove 64 from some relocation names as they have been renamed in later versions of the spec.
+
+The AARCH64 elf ABI spec renamed some relocations removing 64 from the TLS
+relocation names to make them constaint with the ILP32 named ones.
+
+* elf/elf.h (R_AARCH64_TLS_DTPMOD64): Rename to ..
+(R_AARCH64_TLS_DTPMOD): This.
+(R_AARCH64_TLS_DTPREL64): Rename to ...
+(R_AARCH64_TLS_DTPREL): This.
+(R_AARCH64_TLS_TPREL64): Rename to ...
+(R_AARCH64_TLS_TPREL): This.
+* sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
+R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and R_AARCH64_TLS_TPREL64.
+(elf_machine_rela): Likewise.
+
+[AARCH64] Fix pltenter and pltexit for ILP32.
+
+* sysdeps/aarch64/bits/link.h (la_aarch64_gnu_pltenter): Use
+ElfW macro instead of hardcoded Elf64 types.
+---
+ elf/elf.h | 6 +++---
+ sysdeps/aarch64/bits/link.h | 6 +++---
+ sysdeps/aarch64/dl-machine.h | 12 ++++++------
+ sysdeps/aarch64/sysdep.h | 5 +++++
+ 4 files changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/elf/elf.h b/elf/elf.h
+index 78815e8..0dbf52b 100644
+--- a/elf/elf.h
++++ b/elf/elf.h
+@@ -2479,9 +2479,9 @@ typedef Elf32_Addr Elf32_Conflict;
+ #define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
+ #define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
+ #define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
+-#define R_AARCH64_TLS_DTPMOD64 1028 /* Module number, 64 bit. */
+-#define R_AARCH64_TLS_DTPREL64 1029 /* Module-relative offset, 64 bit. */
+-#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
++#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
++#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
++#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
+ #define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
+ #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
+
+diff --git a/sysdeps/aarch64/bits/link.h b/sysdeps/aarch64/bits/link.h
+index fe06827..3a84a18 100644
+--- a/sysdeps/aarch64/bits/link.h
++++ b/sysdeps/aarch64/bits/link.h
+@@ -40,8 +40,8 @@ typedef struct La_aarch64_retval
+ } La_aarch64_retval;
+ __BEGIN_DECLS
+
+-extern Elf64_Addr
+-la_aarch64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
++extern ElfW(Addr)
++la_aarch64_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ La_aarch64_regs *__regs,
+@@ -50,7 +50,7 @@ la_aarch64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
+ long int *__framesizep);
+
+ extern unsigned int
+-la_aarch64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
++la_aarch64_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ const La_aarch64_regs *__inregs,
+diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
+index 6615b8f..ebac353 100644
+--- a/sysdeps/aarch64/dl-machine.h
++++ b/sysdeps/aarch64/dl-machine.h
+@@ -188,9 +188,9 @@ _dl_start_user: \n\
+
+ #define elf_machine_type_class(type) \
+ ((((type) == R_AARCH64_JUMP_SLOT || \
+- (type) == R_AARCH64_TLS_DTPMOD64 || \
+- (type) == R_AARCH64_TLS_DTPREL64 || \
+- (type) == R_AARCH64_TLS_TPREL64 || \
++ (type) == R_AARCH64_TLS_DTPMOD || \
++ (type) == R_AARCH64_TLS_DTPREL || \
++ (type) == R_AARCH64_TLS_TPREL || \
+ (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
+ | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
+
+@@ -314,7 +314,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ break;
+ }
+
+- case R_AARCH64_TLS_DTPMOD64:
++ case R_AARCH64_TLS_DTPMOD:
+ #ifdef RTLD_BOOTSTRAP
+ *reloc_addr = 1;
+ #else
+@@ -325,12 +325,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ #endif
+ break;
+
+- case R_AARCH64_TLS_DTPREL64:
++ case R_AARCH64_TLS_DTPREL:
+ if (sym)
+ *reloc_addr = sym->st_value + reloc->r_addend;
+ break;
+
+- case R_AARCH64_TLS_TPREL64:
++ case R_AARCH64_TLS_TPREL:
+ if (sym)
+ {
+ CHECK_STATIC_TLS (map, sym_map);
+diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
+index 7169ba7..af196f2 100644
+--- a/sysdeps/aarch64/sysdep.h
++++ b/sysdeps/aarch64/sysdep.h
+@@ -16,6 +16,9 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++#ifndef _AARCH64_SYSDEP_H
++#define _AARCH64_SYSDEP_H
++
+ #include <sysdeps/generic/sysdep.h>
+
+ #ifdef __ASSEMBLER__
+@@ -96,3 +99,5 @@
+ #define mcount _mcount
+
+ #endif /* __ASSEMBLER__ */
++
++#endif /* _AARCH64_SYSDEP_H */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0010-Add-dynamic-ILP32-AARCH64-relocations-to-elf.h.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0010-Add-dynamic-ILP32-AARCH64-relocations-to-elf.h.patch
new file mode 100644
index 0000000..a846033
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0010-Add-dynamic-ILP32-AARCH64-relocations-to-elf.h.patch
@@ -0,0 +1,254 @@
+From de15edafbc188af14eb53aaf2596429daf047b09 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:33 -0700
+Subject: [PATCH 10/32] Add dynamic ILP32 AARCH64 relocations to elf.h
+
+elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
+R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
+R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
+R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
+R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.
+
+[AARCH64] Use ELFW and ElfW macros instead of ELF64 and Elf64 names.
+
+* sysdeps/aarch64/dl-machine.h
+(elf_machine_runtime_setup): Use ElfW(Addr).
+(elf_machine_rela): Use ELFW(R_TYPE).
+(elf_machine_lazy_rel): Likewise.
+
+[AARCH64] Introduce AARCH64_R so we can reuse the reloc code between ILP32 and LP64.
+
+* sysdeps/aarch64/sysdep.h (AARCH64_R): Define.
+* sysdeps/aarch64/dl-irel.h: Include sysdep.h
+(elf_irela): Use reloc names based on AARCH64_R.
+* sysdeps/aarch64/dl-machine.h: Include sysdep.h
+(elf_machine_type_class): Use reloc names based on AARCH64_R.
+(elf_machine_rela): Likewise.
+(elf_machine_lazy_rel): Likewise.
+---
+ elf/elf.h | 14 +++++++++++
+ sysdeps/aarch64/dl-irel.h | 3 ++-
+ sysdeps/aarch64/dl-machine.h | 57 +++++++++++++++++++++++---------------------
+ sysdeps/aarch64/sysdep.h | 6 +++++
+ 4 files changed, 52 insertions(+), 28 deletions(-)
+
+diff --git a/elf/elf.h b/elf/elf.h
+index 0dbf52b..030f398 100644
+--- a/elf/elf.h
++++ b/elf/elf.h
+@@ -2362,6 +2362,20 @@ typedef Elf32_Addr Elf32_Conflict;
+ /* AArch64 relocs. */
+
+ #define R_AARCH64_NONE 0 /* No relocation. */
++
++/* ILP32 AARCH64 relocs. */
++#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
++#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
++#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
++#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
++#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
++#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
++#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
++#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
++#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
++#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
++
++/* LP64 AARCH64 relocs. */
+ #define R_AARCH64_ABS64 257 /* Direct 64 bit. */
+ #define R_AARCH64_ABS32 258 /* Direct 32 bit. */
+ #define R_AARCH64_ABS16 259 /* Direct 16-bit. */
+diff --git a/sysdeps/aarch64/dl-irel.h b/sysdeps/aarch64/dl-irel.h
+index 78395ca..79964c2 100644
+--- a/sysdeps/aarch64/dl-irel.h
++++ b/sysdeps/aarch64/dl-irel.h
+@@ -23,6 +23,7 @@
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <ldsodefs.h>
++#include <sysdep.h>
+
+ #define ELF_MACHINE_IRELA 1
+
+@@ -40,7 +41,7 @@ elf_irela (const ElfW(Rela) *reloc)
+ ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset;
+ const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
+
+- if (__glibc_likely (r_type == R_AARCH64_IRELATIVE))
++ if (__glibc_likely (r_type == AARCH64_R(IRELATIVE)))
+ {
+ ElfW(Addr) value = elf_ifunc_invoke (reloc->r_addend);
+ *reloc_addr = value;
+diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
+index ebac353..4317669 100644
+--- a/sysdeps/aarch64/dl-machine.h
++++ b/sysdeps/aarch64/dl-machine.h
+@@ -21,6 +21,7 @@
+
+ #define ELF_MACHINE_NAME "aarch64"
+
++#include <sysdep.h>
+ #include <tls.h>
+ #include <dl-tlsdesc.h>
+ #include <dl-irel.h>
+@@ -113,8 +114,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+ }
+
+ if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
+- *(Elf64_Addr*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
+- = (Elf64_Addr) &_dl_tlsdesc_resolve_rela;
++ *(ElfW(Addr)*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
++ = (ElfW(Addr)) &_dl_tlsdesc_resolve_rela;
+
+ return lazy;
+ }
+@@ -186,15 +187,15 @@ _dl_start_user: \n\
+ br x21 \n\
+ ");
+
+-#define elf_machine_type_class(type) \
+- ((((type) == R_AARCH64_JUMP_SLOT || \
+- (type) == R_AARCH64_TLS_DTPMOD || \
+- (type) == R_AARCH64_TLS_DTPREL || \
+- (type) == R_AARCH64_TLS_TPREL || \
+- (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT) \
+- | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
++#define elf_machine_type_class(type) \
++ ((((type) == AARCH64_R(JUMP_SLOT) || \
++ (type) == AARCH64_R(TLS_DTPMOD) || \
++ (type) == AARCH64_R(TLS_DTPREL) || \
++ (type) == AARCH64_R(TLS_TPREL) || \
++ (type) == AARCH64_R(TLSDESC)) * ELF_RTYPE_CLASS_PLT) \
++ | (((type) == AARCH64_R(COPY)) * ELF_RTYPE_CLASS_COPY))
+
+-#define ELF_MACHINE_JMP_SLOT R_AARCH64_JUMP_SLOT
++#define ELF_MACHINE_JMP_SLOT AARCH64_R(JUMP_SLOT)
+
+ /* AArch64 uses RELA not REL */
+ #define ELF_MACHINE_NO_REL 1
+@@ -233,9 +234,9 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ void *const reloc_addr_arg, int skip_ifunc)
+ {
+ ElfW(Addr) *const reloc_addr = reloc_addr_arg;
+- const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
++ const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
+
+- if (__builtin_expect (r_type == R_AARCH64_RELATIVE, 0))
++ if (__builtin_expect (r_type == AARCH64_R(RELATIVE), 0))
+ *reloc_addr = map->l_addr + reloc->r_addend;
+ else if (__builtin_expect (r_type == R_AARCH64_NONE, 0))
+ return;
+@@ -253,7 +254,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+
+ switch (r_type)
+ {
+- case R_AARCH64_COPY:
++ case AARCH64_R(COPY):
+ if (sym == NULL)
+ break;
+
+@@ -271,15 +272,17 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ MIN (sym->st_size, refsym->st_size));
+ break;
+
+- case R_AARCH64_RELATIVE:
+- case R_AARCH64_GLOB_DAT:
+- case R_AARCH64_JUMP_SLOT:
+- case R_AARCH64_ABS32:
+- case R_AARCH64_ABS64:
++ case AARCH64_R(RELATIVE):
++ case AARCH64_R(GLOB_DAT):
++ case AARCH64_R(JUMP_SLOT):
++ case AARCH64_R(ABS32):
++#ifdef __LP64__
++ case AARCH64_R(ABS64):
++#endif
+ *reloc_addr = value + reloc->r_addend;
+ break;
+
+- case R_AARCH64_TLSDESC:
++ case AARCH64_R(TLSDESC):
+ {
+ struct tlsdesc volatile *td =
+ (struct tlsdesc volatile *)reloc_addr;
+@@ -314,7 +317,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ break;
+ }
+
+- case R_AARCH64_TLS_DTPMOD:
++ case AARCH64_R(TLS_DTPMOD):
+ #ifdef RTLD_BOOTSTRAP
+ *reloc_addr = 1;
+ #else
+@@ -325,12 +328,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ #endif
+ break;
+
+- case R_AARCH64_TLS_DTPREL:
++ case AARCH64_R(TLS_DTPREL):
+ if (sym)
+ *reloc_addr = sym->st_value + reloc->r_addend;
+ break;
+
+- case R_AARCH64_TLS_TPREL:
++ case AARCH64_R(TLS_TPREL):
+ if (sym)
+ {
+ CHECK_STATIC_TLS (map, sym_map);
+@@ -339,7 +342,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
+ }
+ break;
+
+- case R_AARCH64_IRELATIVE:
++ case AARCH64_R(IRELATIVE):
+ value = map->l_addr + reloc->r_addend;
+ value = elf_ifunc_invoke (value);
+ *reloc_addr = value;
+@@ -370,16 +373,16 @@ elf_machine_lazy_rel (struct link_map *map,
+ int skip_ifunc)
+ {
+ ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+- const unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
++ const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info);
+ /* Check for unexpected PLT reloc type. */
+- if (__builtin_expect (r_type == R_AARCH64_JUMP_SLOT, 1))
++ if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1))
+ {
+ if (__builtin_expect (map->l_mach.plt, 0) == 0)
+ *reloc_addr += l_addr;
+ else
+ *reloc_addr = map->l_mach.plt;
+ }
+- else if (__builtin_expect (r_type == R_AARCH64_TLSDESC, 1))
++ else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1))
+ {
+ struct tlsdesc volatile *td =
+ (struct tlsdesc volatile *)reloc_addr;
+@@ -388,7 +391,7 @@ elf_machine_lazy_rel (struct link_map *map,
+ td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+ + map->l_addr);
+ }
+- else if (__glibc_unlikely (r_type == R_AARCH64_IRELATIVE))
++ else if (__glibc_unlikely (r_type == AARCH64_R(IRELATIVE)))
+ {
+ ElfW(Addr) value = map->l_addr + reloc->r_addend;
+ if (__glibc_likely (!skip_ifunc))
+diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
+index af196f2..55d1759 100644
+--- a/sysdeps/aarch64/sysdep.h
++++ b/sysdeps/aarch64/sysdep.h
+@@ -21,6 +21,12 @@
+
+ #include <sysdeps/generic/sysdep.h>
+
++#ifdef __LP64__
++#define AARCH64_R(NAME) R_AARCH64_ ## NAME
++#else
++#define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
++#endif
++
+ #ifdef __ASSEMBLER__
+
+ /* Syntactic details of assembler. */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0011-Add-PTR_REG-PTR_LOG_SIZE-and-PTR_SIZE.-Use-it-in-LDS.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0011-Add-PTR_REG-PTR_LOG_SIZE-and-PTR_SIZE.-Use-it-in-LDS.patch
new file mode 100644
index 0000000..eede9b9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0011-Add-PTR_REG-PTR_LOG_SIZE-and-PTR_SIZE.-Use-it-in-LDS.patch
@@ -0,0 +1,159 @@
+From 25170f4bf230293bb299052ed57fa51f9c121a64 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:34 -0700
+Subject: [PATCH 11/32] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE. Use it in
+ LDST_PCREL and LDST_GLOBAL.
+
+This patch adds a few extra macros which are useful for ILP32 and updates
+PTR_MANGLE and PTR_DEMANGLE to use the some of the new macros.
+
+* sysdeps/aarch64/sysdep.h (PTR_REG): New macro.
+(PTR_LOG_SIZE): New macro.
+(PTR_SIZE): New macro.
+(LDST_PCREL): Use arguments as register numbers rather register names.
+Use PTR_REG for the register when loading.
+* sysdeps/unix/sysv/linux/aarch64/sysdep.h (PTR_MANGLE): Add a comment
+about that the arguments are register numbers rather register names.
+(PTR_DEMANGLE): Likewise.
+* sysdeps/aarch64/__longjmp.S (__longjmp): Update calls to PTR_DEMANGLE.
+* sysdeps/aarch64/setjmp.S (__sigsetjmp): Update calls to PTR_MANGLE.
+---
+ sysdeps/aarch64/__longjmp.S | 4 ++--
+ sysdeps/aarch64/setjmp.S | 4 ++--
+ sysdeps/aarch64/sysdep.h | 28 ++++++++++++++++++----------
+ sysdeps/unix/sysv/linux/aarch64/sysdep.h | 8 ++++++--
+ 4 files changed, 28 insertions(+), 16 deletions(-)
+
+diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
+index 1bb7be36..e1a1cf2 100644
+--- a/sysdeps/aarch64/__longjmp.S
++++ b/sysdeps/aarch64/__longjmp.S
+@@ -53,7 +53,7 @@ ENTRY (__longjmp)
+ ldp x27, x28, [x0, #JB_X27<<3]
+ #ifdef PTR_DEMANGLE
+ ldp x29, x4, [x0, #JB_X29<<3]
+- PTR_DEMANGLE (x30, x4, x3, x2)
++ PTR_DEMANGLE (30, 4, 3, 2)
+ #else
+ ldp x29, x30, [x0, #JB_X29<<3]
+ #endif
+@@ -98,7 +98,7 @@ ENTRY (__longjmp)
+ cfi_same_value(d15)
+ #ifdef PTR_DEMANGLE
+ ldr x4, [x0, #JB_SP<<3]
+- PTR_DEMANGLE (x5, x4, x3, x2)
++ PTR_DEMANGLE (5, 4, 3, 2)
+ #else
+ ldr x5, [x0, #JB_SP<<3]
+ #endif
+diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
+index d548dd5..41d5321 100644
+--- a/sysdeps/aarch64/setjmp.S
++++ b/sysdeps/aarch64/setjmp.S
+@@ -42,7 +42,7 @@ ENTRY (__sigsetjmp)
+ stp x27, x28, [x0, #JB_X27<<3]
+
+ #ifdef PTR_MANGLE
+- PTR_MANGLE (x4, x30, x3, x2)
++ PTR_MANGLE (4, 30, 3, 2)
+ stp x29, x4, [x0, #JB_X29<<3]
+ #else
+ stp x29, x30, [x0, #JB_X29<<3]
+@@ -57,7 +57,7 @@ ENTRY (__sigsetjmp)
+ stp d14, d15, [x0, #JB_D14<<3]
+ #ifdef PTR_MANGLE
+ mov x4, sp
+- PTR_MANGLE (x5, x4, x3, x2)
++ PTR_MANGLE (5, 4, 3, 2)
+ str x5, [x0, #JB_SP<<3]
+ #else
+ mov x2, sp
+diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
+index 55d1759..ab2ee91 100644
+--- a/sysdeps/aarch64/sysdep.h
++++ b/sysdeps/aarch64/sysdep.h
+@@ -23,10 +23,16 @@
+
+ #ifdef __LP64__
+ #define AARCH64_R(NAME) R_AARCH64_ ## NAME
++#define PTR_REG(n) x##n
++#define PTR_LOG_SIZE 3
+ #else
+ #define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
++#define PTR_REG(n) w##n
++#define PTR_LOG_SIZE 2
+ #endif
+
++#define PTR_SIZE (1<<PTR_LOG_SIZE)
++
+ #ifdef __ASSEMBLER__
+
+ /* Syntactic details of assembler. */
+@@ -87,16 +93,18 @@
+ # define L(name) .L##name
+ #endif
+
+-/* Load or store to/from a pc-relative EXPR into/from R, using T. */
+-#define LDST_PCREL(OP, R, T, EXPR) \
+- adrp T, EXPR; \
+- OP R, [T, #:lo12:EXPR];\
+-
+-/* Load or store to/from a got-relative EXPR into/from R, using T. */
+-#define LDST_GLOBAL(OP, R, T, EXPR) \
+- adrp T, :got:EXPR; \
+- ldr T, [T, #:got_lo12:EXPR];\
+- OP R, [T];
++/* Load or store to/from a pc-relative EXPR into/from R, using T.
++ Note R and T are register numbers and not register names. */
++#define LDST_PCREL(OP, R, T, EXPR) \
++ adrp x##T, EXPR; \
++ OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
++
++/* Load or store to/from a got-relative EXPR into/from R, using T.
++ Note R and T are register numbers and not register names. */
++#define LDST_GLOBAL(OP, R, T, EXPR) \
++ adrp x##T, :got:EXPR; \
++ ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
++ OP x##R, [x##T];
+
+ /* Since C identifiers are not normally prefixed with an underscore
+ on this system, the asm identifier `syscall_error' intrudes on the
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+index 84999f1..fc31661 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
++++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+@@ -313,12 +313,14 @@
+ (!defined SHARED && (!defined NOT_IN_libc \
+ || defined IS_IN_libpthread)))
+ # ifdef __ASSEMBLER__
++/* Note, dst, src, guard, and tmp are all register numbers rather than
++ register names so they will work with both ILP32 and LP64. */
+ # define PTR_MANGLE(dst, src, guard, tmp) \
+ LDST_PCREL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local)); \
+ PTR_MANGLE2 (dst, src, guard)
+ /* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+ # define PTR_MANGLE2(dst, src, guard)\
+- eor dst, src, guard
++ eor x##dst, x##src, x##guard
+ # define PTR_DEMANGLE(dst, src, guard, tmp)\
+ PTR_MANGLE (dst, src, guard, tmp)
+ # define PTR_DEMANGLE2(dst, src, guard)\
+@@ -331,12 +333,14 @@ extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+ # endif
+ #else
+ # ifdef __ASSEMBLER__
++/* Note, dst, src, guard, and tmp are all register numbers rather than
++ register names so they will work with both ILP32 and LP64. */
+ # define PTR_MANGLE(dst, src, guard, tmp) \
+ LDST_GLOBAL (ldr, guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard)); \
+ PTR_MANGLE2 (dst, src, guard)
+ /* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
+ # define PTR_MANGLE2(dst, src, guard)\
+- eor dst, src, guard
++ eor x##dst, x##src, x##guard
+ # define PTR_DEMANGLE(dst, src, guard, tmp)\
+ PTR_MANGLE (dst, src, guard, tmp)
+ # define PTR_DEMANGLE2(dst, src, guard)\
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0012-Use-PTR_REG-in-crti.S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0012-Use-PTR_REG-in-crti.S.patch
new file mode 100644
index 0000000..f66dbae
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0012-Use-PTR_REG-in-crti.S.patch
@@ -0,0 +1,189 @@
+From 94a5e91090a72bf323b0cf9474a92e9e32e67cc1 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:35 -0700
+Subject: [PATCH 12/32] Use PTR_REG in crti.S.
+
+call_weak_fn loads from a pointer, so use PTR_REG so the load
+is 32bits for ILP32.
+
+* sysdeps/aarch64/crti.S: Include sysdep.h
+(call_weak_fn): Use PTR_REG when loading from
+PREINIT_FUNCTION.
+
+AARCH64: Make RTLD_START paramatizable
+
+Make RTLD_START paramatizable for ILP32 and LP64 usage and provides common
+code between ILP32.
+
+* sysdeps/aarch64/dl-machine.h (RTLD_START): Rename to ...
+(RTLD_START_1): This and add PTR, PTR_SIZE_LOG, and PTR_SP arguments.
+(RTLD_START): New macro which uses RTLD_START_1.
+---
+ sysdeps/aarch64/crti.S | 3 +-
+ sysdeps/aarch64/dl-machine.h | 128 ++++++++++++++++++++++---------------------
+ 2 files changed, 69 insertions(+), 62 deletions(-)
+
+diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S
+index 2db7b67..d31bb50 100644
+--- a/sysdeps/aarch64/crti.S
++++ b/sysdeps/aarch64/crti.S
+@@ -39,6 +39,7 @@
+ they can be called as functions. The symbols _init and _fini are
+ magic and cause the linker to emit DT_INIT and DT_FINI. */
+
++#include <sysdep.h>
+ #include <libc-symbols.h>
+
+ #ifndef PREINIT_FUNCTION
+@@ -60,7 +61,7 @@
+ .type call_weak_fn, %function
+ call_weak_fn:
+ adrp x0, :got:PREINIT_FUNCTION
+- ldr x0, [x0, #:got_lo12:PREINIT_FUNCTION]
++ ldr PTR_REG(0), [x0, #:got_lo12:PREINIT_FUNCTION]
+ cbz x0, 1f
+ b PREINIT_FUNCTION
+ 1:
+diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
+index 4317669..6e041b1 100644
+--- a/sysdeps/aarch64/dl-machine.h
++++ b/sysdeps/aarch64/dl-machine.h
+@@ -123,68 +123,74 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+ /* Initial entry point for the dynamic linker. The C function
+ _dl_start is the real entry point, its return value is the user
+ program's entry point */
++#ifdef __LP64__
++#define RTLD_START RTLD_START_1("x", "3", "sp")
++#else
++#define RTLD_START RTLD_START_1("w", "2", "wsp")
++#endif
++
+
+-#define RTLD_START asm ("\
+-.text \n\
+-.globl _start \n\
+-.type _start, %function \n\
+-.globl _dl_start_user \n\
+-.type _dl_start_user, %function \n\
+-_start: \n\
+- mov x0, sp \n\
+- bl _dl_start \n\
+- // returns user entry point in x0 \n\
+- mov x21, x0 \n\
+-_dl_start_user: \n\
+- // get the original arg count \n\
+- ldr x1, [sp] \n\
+- // get the argv address \n\
+- add x2, sp, #8 \n\
+- // get _dl_skip_args to see if we were \n\
+- // invoked as an executable \n\
+- adrp x4, _dl_skip_args \n\
+- ldr w4, [x4, #:lo12:_dl_skip_args] \n\
+- // do we need to adjust argc/argv \n\
+- cmp w4, 0 \n\
+- beq .L_done_stack_adjust \n\
+- // subtract _dl_skip_args from original arg count \n\
+- sub x1, x1, x4 \n\
+- // store adjusted argc back to stack \n\
+- str x1, [sp] \n\
+- // find the first unskipped argument \n\
+- mov x3, x2 \n\
+- add x4, x2, x4, lsl #3 \n\
+- // shuffle argv down \n\
+-1: ldr x5, [x4], #8 \n\
+- str x5, [x3], #8 \n\
+- cmp x5, #0 \n\
+- bne 1b \n\
+- // shuffle envp down \n\
+-1: ldr x5, [x4], #8 \n\
+- str x5, [x3], #8 \n\
+- cmp x5, #0 \n\
+- bne 1b \n\
+- // shuffle auxv down \n\
+-1: ldp x0, x5, [x4, #16]! \n\
+- stp x0, x5, [x3], #16 \n\
+- cmp x0, #0 \n\
+- bne 1b \n\
+- // Update _dl_argv \n\
+- adrp x3, _dl_argv \n\
+- str x2, [x3, #:lo12:_dl_argv] \n\
+-.L_done_stack_adjust: \n\
+- // compute envp \n\
+- add x3, x2, x1, lsl #3 \n\
+- add x3, x3, #8 \n\
+- adrp x16, _rtld_local \n\
+- add x16, x16, #:lo12:_rtld_local \n\
+- ldr x0, [x16] \n\
+- bl _dl_init_internal \n\
+- // load the finalizer function \n\
+- adrp x0, _dl_fini \n\
+- add x0, x0, #:lo12:_dl_fini \n\
+- // jump to the user_s entry point \n\
+- br x21 \n\
++#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\
++.text \n\
++.globl _start \n\
++.type _start, %function \n\
++.globl _dl_start_user \n\
++.type _dl_start_user, %function \n\
++_start: \n\
++ mov " PTR "0, " PTR_SP " \n\
++ bl _dl_start \n\
++ // returns user entry point in x0 \n\
++ mov x21, x0 \n\
++_dl_start_user: \n\
++ // get the original arg count \n\
++ ldr " PTR "1, [sp] \n\
++ // get the argv address \n\
++ add " PTR "2, " PTR_SP ", #(1<<" PTR_SIZE_LOG ") \n\
++ // get _dl_skip_args to see if we were \n\
++ // invoked as an executable \n\
++ adrp x4, _dl_skip_args \n\
++ ldr w4, [x4, #:lo12:_dl_skip_args] \n\
++ // do we need to adjust argc/argv \n\
++ cmp w4, 0 \n\
++ beq .L_done_stack_adjust \n\
++ // subtract _dl_skip_args from original arg count \n\
++ sub " PTR "1, " PTR "1, " PTR "4 \n\
++ // store adjusted argc back to stack \n\
++ str " PTR "1, [sp] \n\
++ // find the first unskipped argument \n\
++ mov " PTR "3, " PTR "2 \n\
++ add " PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG " \n\
++ // shuffle argv down \n\
++1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
++ str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
++ cmp " PTR "5, #0 \n\
++ bne 1b \n\
++ // shuffle envp down \n\
++1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\
++ str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\
++ cmp " PTR "5, #0 \n\
++ bne 1b \n\
++ // shuffle auxv down \n\
++1: ldp " PTR "0, " PTR "5, [x4, #(2<<" PTR_SIZE_LOG ")]! \n\
++ stp " PTR "0, " PTR "5, [x3], #(2<<" PTR_SIZE_LOG ") \n\
++ cmp " PTR "0, #0 \n\
++ bne 1b \n\
++ // Update _dl_argv \n\
++ adrp x3, _dl_argv \n\
++ str " PTR "2, [x3, #:lo12:_dl_argv] \n\
++.L_done_stack_adjust: \n\
++ // compute envp \n\
++ add " PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG " \n\
++ add " PTR "3, " PTR "3, #(1<<" PTR_SIZE_LOG ") \n\
++ adrp x16, _rtld_local \n\
++ add " PTR "16, " PTR "16, #:lo12:_rtld_local \n\
++ ldr " PTR "0, [x16] \n\
++ bl _dl_init_internal \n\
++ // load the finalizer function \n\
++ adrp x0, _dl_fini \n\
++ add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\
++ // jump to the user_s entry point \n\
++ br x21 \n\
+ ");
+
+ #define elf_machine_type_class(type) \
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0013-Use-PTR_REG-PTR_SIZE-PTR_SIZE_LOG-in-dl-tlsesc.S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0013-Use-PTR_REG-PTR_SIZE-PTR_SIZE_LOG-in-dl-tlsesc.S.patch
new file mode 100644
index 0000000..f13edae
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0013-Use-PTR_REG-PTR_SIZE-PTR_SIZE_LOG-in-dl-tlsesc.S.patch
@@ -0,0 +1,111 @@
+From 8d07ca317ccac9d2f40c253c7e10f50abcb35b1d Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:36 -0700
+Subject: [PATCH 13/32] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
+
+This converts dl-tlsdesc.S code over to use the new macros which allows for
+sharing between ILP32 and LP64 code.
+
+* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
+(_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
+(_dl_tlsdesc_dynamic): Likewise.
+(_dl_tlsdesc_resolve_rela): Likewise.
+(_dl_tlsdesc_resolve_hold): Likewise.
+---
+ sysdeps/aarch64/dl-tlsdesc.S | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
+index ded5471..6004115 100644
+--- a/sysdeps/aarch64/dl-tlsdesc.S
++++ b/sysdeps/aarch64/dl-tlsdesc.S
+@@ -74,7 +74,7 @@
+ cfi_startproc
+ .align 2
+ _dl_tlsdesc_return:
+- ldr x0, [x0, #8]
++ ldr PTR_REG (0), [x0, #PTR_SIZE]
+ RET
+ cfi_endproc
+ .size _dl_tlsdesc_return, .-_dl_tlsdesc_return
+@@ -96,9 +96,9 @@ _dl_tlsdesc_return:
+ _dl_tlsdesc_undefweak:
+ str x1, [sp, #-16]!
+ cfi_adjust_cfa_offset(16)
+- ldr x0, [x0, #8]
++ ldr PTR_REG (0), [x0, #PTR_SIZE]
+ mrs x1, tpidr_el0
+- sub x0, x0, x1
++ sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
+ ldr x1, [sp], #16
+ cfi_adjust_cfa_offset(16)
+ RET
+@@ -152,20 +152,20 @@ _dl_tlsdesc_dynamic:
+ stp x3, x4, [sp, #32+16*1]
+
+ mrs x4, tpidr_el0
+- ldr x1, [x0,#8]
+- ldr x0, [x4]
+- ldr x3, [x1,#16]
+- ldr x2, [x0]
+- cmp x3, x2
++ ldr PTR_REG (1), [x0,#PTR_SIZE]
++ ldr PTR_REG (0), [x4]
++ ldr PTR_REG (3), [x1,#(PTR_SIZE * 2)]
++ ldr PTR_REG (2), [x0]
++ cmp PTR_REG (3), PTR_REG (2)
+ b.hi 2f
+- ldr x2, [x1]
+- add x0, x0, x2, lsl #4
+- ldr x0, [x0]
++ ldr PTR_REG (2), [x1]
++ add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
++ ldr PTR_REG (0), [x0]
+ cmn x0, #0x1
+ b.eq 2f
+- ldr x1, [x1,#8]
+- add x0, x0, x1
+- sub x0, x0, x4
++ ldr PTR_REG (1), [x1,#(PTR_SIZE * 2)]
++ add PTR_REG (0), PTR_REG (0), PTR_REG (1)
++ sub PTR_REG (0), PTR_REG (0), PTR_REG (4)
+ 1:
+ ldp x1, x2, [sp, #32+16*0]
+ ldp x3, x4, [sp, #32+16*1]
+@@ -196,7 +196,7 @@ _dl_tlsdesc_dynamic:
+ bl __tls_get_addr
+
+ mrs x1, tpidr_el0
+- sub x0, x0, x1
++ sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
+
+ RESTORE_Q_REGISTERS
+
+@@ -242,13 +242,13 @@ _dl_tlsdesc_resolve_rela:
+
+ SAVE_Q_REGISTERS
+
+- ldr x1, [x3, #8]
++ ldr PTR_REG (1), [x3, #PTR_SIZE]
+ bl _dl_tlsdesc_resolve_rela_fixup
+
+ RESTORE_Q_REGISTERS
+
+ ldr x0, [sp, #32+16*8]
+- ldr x1, [x0]
++ ldr PTR_REG (1), [x0]
+ blr x1
+
+ ldp x1, x4, [sp, #32+16*0]
+@@ -309,7 +309,7 @@ _dl_tlsdesc_resolve_hold:
+ RESTORE_Q_REGISTERS
+
+ ldr x0, [sp, #32+16*9]
+- ldr x1, [x0]
++ ldr PTR_REG (1), [x0]
+ blr x1
+
+ ldp x1, x2, [sp, #32+16*0]
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0014-Use-PTR_-macros-in-dl-trampoline.S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0014-Use-PTR_-macros-in-dl-trampoline.S.patch
new file mode 100644
index 0000000..9cac052
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0014-Use-PTR_-macros-in-dl-trampoline.S.patch
@@ -0,0 +1,94 @@
+From 25ef3412785db87247df900fc80a17d884ced522 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:37 -0700
+Subject: [PATCH 14/32] Use PTR_* macros in dl-trampoline.S
+
+Use the PTR_* macros in dl-trampoline.S so it can be used for
+both ILP32 and LP64. Also add a comment about what was an magic number
+(the size of the rela relocation entries).
+
+* sysdeps/aarch64/dl-trampoline.S (ip0l): New define.
+(RELA_SIZE): New define.
+(_dl_runtime_resolve): Use PTR_REG, PTR_SIZE.
+(_dl_runtime_profile): Likewise. Use RELA_SIZE and ip0l.
+---
+ sysdeps/aarch64/dl-trampoline.S | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S
+index 2037f18..22b28ce 100644
+--- a/sysdeps/aarch64/dl-trampoline.S
++++ b/sysdeps/aarch64/dl-trampoline.S
+@@ -22,9 +22,13 @@
+ #include "dl-link.h"
+
+ #define ip0 x16
++#define ip0l PTR_REG (16)
+ #define ip1 x17
+ #define lr x30
+
++/* RELA relocatons are 3 pointers */
++#define RELA_SIZE (PTR_SIZE * 3)
++
+ .text
+ .globl _dl_runtime_resolve
+ .type _dl_runtime_resolve, #function
+@@ -79,7 +83,7 @@ _dl_runtime_resolve:
+ cfi_rel_offset (q1, 80+7*16)
+
+ /* Get pointer to linker struct. */
+- ldr x0, [ip0, #-8]
++ ldr PTR_REG (0), [ip0, #-PTR_SIZE]
+
+ /* Prepare to call _dl_fixup(). */
+ ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */
+@@ -87,7 +91,7 @@ _dl_runtime_resolve:
+ sub x1, x1, ip0
+ add x1, x1, x1, lsl #1
+ lsl x1, x1, #3
+- sub x1, x1, #192
++ sub x1, x1, #(RELA_SIZE<<3)
+ lsr x1, x1, #3
+
+ /* Call fixup routine. */
+@@ -191,7 +195,7 @@ _dl_runtime_profile:
+ stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP]
+
+ /* Get pointer to linker struct. */
+- ldr x0, [ip0, #-8]
++ ldr PTR_REG (0), [ip0, #-PTR_SIZE]
+
+ /* Prepare to call _dl_profile_fixup(). */
+ ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */
+@@ -199,7 +203,7 @@ _dl_runtime_profile:
+ sub x1, x1, ip0
+ add x1, x1, x1, lsl #1
+ lsl x1, x1, #3
+- sub x1, x1, #192
++ sub x1, x1, #(RELA_SIZE<<3)
+ lsr x1, x1, #3
+
+ stp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
+@@ -210,8 +214,8 @@ _dl_runtime_profile:
+ add x4, x29, #OFFSET_FS /* address of framesize */
+ bl _dl_profile_fixup
+
+- ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */
+- cmp ip0, #0
++ ldr ip0l, [x29, #OFFSET_FS] /* framesize == 0 */
++ cmp ip0l, #0
+ bge 1f
+ cfi_remember_state
+
+@@ -243,7 +247,7 @@ _dl_runtime_profile:
+ 1:
+ /* The new frame size is in ip0. */
+
+- sub x1, x29, ip0
++ sub PTR_REG (1), PTR_REG (29), ip0l
+ and sp, x1, #0xfffffffffffffff0
+
+ str x0, [x29, #OFFSET_T1]
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0015-Use-PTR_-in-start.S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0015-Use-PTR_-in-start.S.patch
new file mode 100644
index 0000000..36e4161
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0015-Use-PTR_-in-start.S.patch
@@ -0,0 +1,75 @@
+From 67c890fd7f5d830a433399df6e033fe866c851d0 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:38 -0700
+Subject: [PATCH 15/32] Use PTR_* in start.S
+
+To support ILP32 without much sources changes, this changes
+sysdeps/aarch64/start.S to use the PTR_* macros which was defined
+earlier.
+
+* sysdeps/aarch64/start.S: Include sysdep.h
+(_start): Use PTR_REG, PTR_SIZE macros.
+---
+ sysdeps/aarch64/start.S | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
+index 35d603a..dfa0622 100644
+--- a/sysdeps/aarch64/start.S
++++ b/sysdeps/aarch64/start.S
+@@ -16,6 +16,8 @@
+ License along with the GNU C Library. If not, see
+ <http://www.gnu.org/licenses/>. */
+
++#include <sysdep.h>
++
+ /* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+@@ -25,7 +27,7 @@
+
+ At this entry point, most registers' values are unspecified, except:
+
+- x0 Contains a function pointer to be registered with `atexit'.
++ x0/w0 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+@@ -53,26 +55,26 @@ _start:
+ mov x5, x0
+
+ /* Load argc and a pointer to argv */
+- ldr x1, [sp, #0]
+- add x2, sp, #8
++ ldr PTR_REG (1), [sp, #0]
++ add x2, sp, #PTR_SIZE
+
+ /* Setup stack limit in argument register */
+ mov x6, sp
+
+ #ifdef SHARED
+ adrp x0, :got:main
+- ldr x0, [x0, #:got_lo12:main]
++ ldr PTR_REG (0), [x0, #:got_lo12:main]
+
+ adrp x3, :got:__libc_csu_init
+- ldr x3, [x3, #:got_lo12:__libc_csu_init]
++ ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
+
+ adrp x4, :got:__libc_csu_fini
+- ldr x4, [x4, #:got_lo12:__libc_csu_fini]
++ ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
+ #else
+ /* Set up the other arguments in registers */
+- ldr x0, =main
+- ldr x3, =__libc_csu_init
+- ldr x4, =__libc_csu_fini
++ ldr PTR_REG (0), =main
++ ldr PTR_REG (3), =__libc_csu_init
++ ldr PTR_REG (4), =__libc_csu_fini
+ #endif
+
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0016-Use-PTR_REG-in-getcontext.S.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0016-Use-PTR_REG-in-getcontext.S.patch
new file mode 100644
index 0000000..0e06033
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0016-Use-PTR_REG-in-getcontext.S.patch
@@ -0,0 +1,30 @@
+From 965def6cd3ff61f27249832c4c0274ab2c3f6244 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:39 -0700
+Subject: [PATCH 16/32] Use PTR_REG in getcontext.S.
+
+Just like the other patches, this patch allows for getcontext.S to be used
+between ILP32 and LP64.
+
+* sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
+doing an add so wrapping of the pointer is correct for ILP32.
+---
+ sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+index 70b2e32..4507040 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
++++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+@@ -90,7 +90,7 @@ ENTRY(__getcontext)
+
+ /* Grab the signal mask */
+ /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
+- add x2, x0, #UCONTEXT_SIGMASK
++ add PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK
+ mov x0, SIG_BLOCK
+ mov x1, 0
+ mov x3, _NSIG8
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0017-Detect-ILP32-in-configure-scripts.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0017-Detect-ILP32-in-configure-scripts.patch
new file mode 100644
index 0000000..cbf67cd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0017-Detect-ILP32-in-configure-scripts.patch
@@ -0,0 +1,163 @@
+From 8205aaac8673d00cbab2d06be36e450a25dcceaa Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:40 -0700
+Subject: [PATCH 17/32] Detect ILP32 in configure scripts.
+
+This adds detecting of ILP32 to the configure scripts.
+Adding to preconfigure detection of ilp32 in preconfigure and then writing out the default-abi in configure.
+
+* sysdeps/aarch64/preconfigure: Detect ILP32 and set aarch64_config_abi
+to ilp32 for ilp32 and lp64 for lp64. Set machine to either
+aarch64/ilp32 or aarch64/lp64 depending on the ABI that is selected.
+* sysdeps/aarch64/configure.ac: Define HAVE_AARCH64_ILP32 if this is ILP32.
+Set the default-abi to either ilp32, lp64, ilp32_be or lp64_be depending
+on the ABI.
+* sysdeps/aarch64/configure: Regenerate.
+* sysdeps/unix/sysv/linux/aarch64/configure.ac: Set arch_minimum_kernel
+to 3.19.0 for ILP32.
+Set LIBC_SLIBDIR_RTLDDIR to libilp32/lib for ilp32.
+* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
+---
+ sysdeps/aarch64/configure | 15 +++++++++++----
+ sysdeps/aarch64/configure.ac | 11 +++++++++--
+ sysdeps/aarch64/preconfigure | 11 ++++++++++-
+ sysdeps/unix/sysv/linux/aarch64/configure | 22 +++++++++++++++++++---
+ sysdeps/unix/sysv/linux/aarch64/configure.ac | 9 +++++++--
+ 5 files changed, 56 insertions(+), 12 deletions(-)
+ mode change 100644 => 100755 sysdeps/aarch64/configure
+ mode change 100644 => 100755 sysdeps/unix/sysv/linux/aarch64/configure
+
+diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
+old mode 100644
+new mode 100755
+index af870b7..6d3b3c7
+--- a/sysdeps/aarch64/configure
++++ b/sysdeps/aarch64/configure
+@@ -163,12 +163,19 @@ rm -f conftest*
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_be" >&5
+ $as_echo "$libc_cv_aarch64_be" >&6; }
++
++if test $aarch64_config_abi = ilp32; then
++ $as_echo "#define HAVE_AARCH64_ILP32 1" >>confdefs.h
++
++fi
++
+ if test $libc_cv_aarch64_be = yes; then
+ $as_echo "#define HAVE_AARCH64_BE 1" >>confdefs.h
+
+- config_vars="$config_vars
+-default-abi = lp64_be"
++ libc_aarch64_be=_be
+ else
+- config_vars="$config_vars
+-default-abi = lp64"
++ libc_aarch64_be=
+ fi
++
++config_vars="$config_vars
++default-abi = ${aarch64_config_abi}${libc_aarch64_be}"
+diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
+index 7851dd4..9069325 100644
+--- a/sysdeps/aarch64/configure.ac
++++ b/sysdeps/aarch64/configure.ac
+@@ -14,9 +14,16 @@ AC_CACHE_CHECK([for big endian],
+ yes
+ #endif
+ ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
++
++if test $aarch64_config_abi = ilp32; then
++ AC_DEFINE(HAVE_AARCH64_ILP32)
++fi
++
+ if test $libc_cv_aarch64_be = yes; then
+ AC_DEFINE(HAVE_AARCH64_BE)
+- LIBC_CONFIG_VAR([default-abi], [lp64_be])
++ libc_aarch64_be=_be
+ else
+- LIBC_CONFIG_VAR([default-abi], [lp64])
++ libc_aarch64_be=
+ fi
++
++LIBC_CONFIG_VAR([default-abi], [${aarch64_config_abi}${libc_aarch64_be}])
+diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
+index d9bd1f8..4bcd8e3 100644
+--- a/sysdeps/aarch64/preconfigure
++++ b/sysdeps/aarch64/preconfigure
+@@ -1,6 +1,15 @@
+ case "$machine" in
+ aarch64*)
+ base_machine=aarch64
+- machine=aarch64
++ case "$CC $CFLAGS $CPPFLAGS " in
++ *" -mabi=ilp32 "*) aarch64_config_abi=ilp32 ;;
++ *" -mabi=lp64 "*) aarch64_config_abi=lp64 ;;
++ *) aarch64_config_abi=default ;;
++ esac
++ case $aarch64_config_abi in
++ default) machine=aarch64/lp64 aarch64_config_abi=lp64 ;;
++ ilp32) machine=aarch64/ilp32 ;;
++ lp64) machine=aarch64/lp64 ;;
++ esac
+ ;;
+ esac
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
+old mode 100644
+new mode 100755
+index 60230a2..59372d2
+--- a/sysdeps/unix/sysv/linux/aarch64/configure
++++ b/sysdeps/unix/sysv/linux/aarch64/configure
+@@ -1,9 +1,23 @@
+ # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
+
+-arch_minimum_kernel=3.7.0
+-
+-test -n "$libc_cv_slibdir" ||
++if test $aarch64_config_abi = ilp32; then
++ arch_minimum_kernel=3.19.0
++ test -n "$libc_cv_slibdir" ||
++case "$prefix" in
++/usr | /usr/)
++ libc_cv_slibdir=/libilp32
++ libc_cv_rtlddir=/lib
++ if test "$libdir" = '${exec_prefix}/lib'; then
++ libdir='${exec_prefix}/libilp32';
++ # Locale data can be shared between 32-bit and 64-bit libraries.
++ libc_cv_localedir='${exec_prefix}/lib/locale'
++ fi
++ ;;
++esac
++else
++ arch_minimum_kernel=3.7.0
++ test -n "$libc_cv_slibdir" ||
+ case "$prefix" in
+ /usr | /usr/)
+ libc_cv_slibdir=/lib64
+@@ -15,3 +29,5 @@ case "$prefix" in
+ fi
+ ;;
+ esac
++fi
++
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+index 211fa9c..6526816 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
++++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+@@ -1,6 +1,11 @@
+ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
+
+-arch_minimum_kernel=3.7.0
++if test $aarch64_config_abi = ilp32; then
++ arch_minimum_kernel=3.19.0
++ LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
++else
++ arch_minimum_kernel=3.7.0
++ LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
++fi
+
+-LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0018-Syscalls-for-ILP32-are-passed-always-via-64bit-value.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0018-Syscalls-for-ILP32-are-passed-always-via-64bit-value.patch
new file mode 100644
index 0000000..f74d051
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0018-Syscalls-for-ILP32-are-passed-always-via-64bit-value.patch
@@ -0,0 +1,145 @@
+From e35f6fedc7b6e5a63be82b645c7810c0e7c95d26 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:41 -0700
+Subject: [PATCH 18/32] Syscalls for ILP32 are passed always via 64bit values.
+
+This patch adds support for ILP32 syscalls, sign and zero extending
+where needed. Unlike LP64, pointers are 32bit and need to be zero
+extended rather than the standard sign extend that the code would do.
+We take advatage of ssize_t being long rather than int for ILP32,
+to get this correct.
+
+* sysdeps/unix/sysv/linux/aarch64/sysdep.h
+(INLINE_VSYSCALL): Use long long instead of long.
+(INTERNAL_VSYSCALL): Likewise.
+(INLINE_SYSCALL): Likewise.
+(INTERNAL_SYSCALL_RAW): Likewise.
+(ARGIFY): New macro.
+(LOAD_ARGS_0): Use long long instead of long.
+(LOAD_ARGS_1): Use long long instead of long
+and use ARGIFY.
+(LOAD_ARGS_2): Likewise.
+(LOAD_ARGS_3): Likewise.
+(LOAD_ARGS_4): Likewise.
+(LOAD_ARGS_5): Likewise.
+(LOAD_ARGS_6): Likewise.
+(LOAD_ARGS_7): Likewise.
+---
+ sysdeps/unix/sysv/linux/aarch64/sysdep.h | 52 ++++++++++++++++++++------------
+ 1 file changed, 32 insertions(+), 20 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+index fc31661..0d9fa8a 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
++++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+@@ -156,7 +156,7 @@
+ ({ \
+ __label__ out; \
+ __label__ iserr; \
+- long sc_ret; \
++ long long sc_ret; \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ \
+ if (__vdso_##name != NULL) \
+@@ -187,7 +187,7 @@
+ # define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ ({ \
+ __label__ out; \
+- long v_ret; \
++ long long v_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+@@ -224,11 +224,11 @@
+ call. */
+ # undef INLINE_SYSCALL
+ # define INLINE_SYSCALL(name, nr, args...) \
+- ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
++ ({ unsigned long long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
+- _sys_result = (unsigned long) -1; \
++ _sys_result = (unsigned long long) -1; \
+ } \
+ (long) _sys_result; })
+
+@@ -237,10 +237,10 @@
+
+ # undef INTERNAL_SYSCALL_RAW
+ # define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
+- ({ long _sys_result; \
++ ({ long long _sys_result; \
+ { \
+ LOAD_ARGS_##nr (args) \
+- register long _x8 asm ("x8") = (name); \
++ register long long _x8 asm ("x8") = (name); \
+ asm volatile ("svc 0 // syscall " # name \
+ : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory"); \
+ _sys_result = _x0; \
+@@ -262,36 +262,48 @@
+ # undef INTERNAL_SYSCALL_ERRNO
+ # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+
++/* Convert X to a long long, without losing any bits if it is one
++ already or warning if it is a 32-bit pointer. This zero extends
++ 32-bit pointers and sign extends other signed types. Note this only
++ works because ssize_t is long and short-short is promoted to int. */
++#define ARGIFY(X) \
++ ((unsigned long long) \
++ __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(X), __typeof__((X) - (X))), \
++ (X), \
++ __builtin_choose_expr(__builtin_types_compatible_p(int, __typeof__((X) - (X))), \
++ (X), \
++ (unsigned long)(X))))
++
+ # define LOAD_ARGS_0() \
+- register long _x0 asm ("x0");
++ register long long _x0 asm ("x0");
+ # define LOAD_ARGS_1(x0) \
+- long _x0tmp = (long) (x0); \
++ long long _x0tmp = ARGIFY (x0); \
+ LOAD_ARGS_0 () \
+ _x0 = _x0tmp;
+ # define LOAD_ARGS_2(x0, x1) \
+- long _x1tmp = (long) (x1); \
++ long long _x1tmp = ARGIFY (x1); \
+ LOAD_ARGS_1 (x0) \
+- register long _x1 asm ("x1") = _x1tmp;
++ register long long _x1 asm ("x1") = _x1tmp;
+ # define LOAD_ARGS_3(x0, x1, x2) \
+- long _x2tmp = (long) (x2); \
++ long long _x2tmp = ARGIFY (x2); \
+ LOAD_ARGS_2 (x0, x1) \
+- register long _x2 asm ("x2") = _x2tmp;
++ register long long _x2 asm ("x2") = _x2tmp;
+ # define LOAD_ARGS_4(x0, x1, x2, x3) \
+- long _x3tmp = (long) (x3); \
++ long long _x3tmp = ARGIFY (x3); \
+ LOAD_ARGS_3 (x0, x1, x2) \
+- register long _x3 asm ("x3") = _x3tmp;
++ register long long _x3 asm ("x3") = _x3tmp;
+ # define LOAD_ARGS_5(x0, x1, x2, x3, x4) \
+- long _x4tmp = (long) (x4); \
++ long long _x4tmp = ARGIFY (x4); \
+ LOAD_ARGS_4 (x0, x1, x2, x3) \
+- register long _x4 asm ("x4") = _x4tmp;
++ register long long _x4 asm ("x4") = _x4tmp;
+ # define LOAD_ARGS_6(x0, x1, x2, x3, x4, x5) \
+- long _x5tmp = (long) (x5); \
++ long long _x5tmp = ARGIFY (x5); \
+ LOAD_ARGS_5 (x0, x1, x2, x3, x4) \
+- register long _x5 asm ("x5") = _x5tmp;
++ register long long _x5 asm ("x5") = _x5tmp;
+ # define LOAD_ARGS_7(x0, x1, x2, x3, x4, x5, x6)\
+- long _x6tmp = (long) (x6); \
++ long long _x6tmp = ARGIFY (x6); \
+ LOAD_ARGS_6 (x0, x1, x2, x3, x4, x5) \
+- register long _x6 asm ("x6") = _x6tmp;
++ register long long _x6 asm ("x6") = _x6tmp;
+
+ # define ASM_ARGS_0
+ # define ASM_ARGS_1 , "r" (_x0)
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0019-Reformat-inline-asm-in-elf_machine_load_address.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0019-Reformat-inline-asm-in-elf_machine_load_address.patch
new file mode 100644
index 0000000..d5d8af4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0019-Reformat-inline-asm-in-elf_machine_load_address.patch
@@ -0,0 +1,57 @@
+From 598187ec16f424b7548e8f049436c0c9c43d7795 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:42 -0700
+Subject: [PATCH 19/32] Reformat inline-asm in elf_machine_load_address.
+
+This patch reformats the inline-asm in elf_machine_load_address so it is
+easier to change only part of the inline-asm. That is using string
+concating instead of string continueing.
+
+Also document on why this inline-asm works, it depends on the 32bit
+relocation being resolved at link time.
+
+* sysdeps/aarch64/dl-machine.h (elf_machine_load_address):
+Refactor inline-asm. Also add comment.
+---
+ sysdeps/aarch64/dl-machine.h | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
+index 6e041b1..121b178 100644
+--- a/sysdeps/aarch64/dl-machine.h
++++ b/sysdeps/aarch64/dl-machine.h
+@@ -53,19 +53,22 @@ elf_machine_load_address (void)
+ The choice of symbol is arbitrary. The static address we obtain
+ by constructing a non GOT reference to the symbol, the dynamic
+ address of the symbol we compute using adrp/add to compute the
+- symbol's address relative to the PC. */
++ symbol's address relative to the PC.
++ This depends on 32bit relocations being resolved at link time
++ and that the static address fits in the 32bits. */
+
+ ElfW(Addr) static_addr;
+ ElfW(Addr) dynamic_addr;
+
+- asm (" \n\
+- adrp %1, _dl_start; \n\
+- add %1, %1, #:lo12:_dl_start \n\
+- ldr %w0, 1f \n\
+- b 2f \n\
+-1: .word _dl_start \n\
+-2: \n\
+- " : "=r" (static_addr), "=r" (dynamic_addr));
++ asm (" \n"
++" adrp %1, _dl_start; \n"
++" add %1, %1, #:lo12:_dl_start \n"
++" ldr %w0, 1f \n"
++" b 2f \n"
++"1: \n"
++" .word _dl_start \n"
++"2: \n"
++ : "=r" (static_addr), "=r" (dynamic_addr));
+ return dynamic_addr - static_addr;
+ }
+
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0020-Add-ILP32-support-to-elf_machine_load_address.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0020-Add-ILP32-support-to-elf_machine_load_address.patch
new file mode 100644
index 0000000..e9c728f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0020-Add-ILP32-support-to-elf_machine_load_address.patch
@@ -0,0 +1,61 @@
+From 2225cd23a15c1e398188cb9bb17fb6aebbfca617 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:43 -0700
+Subject: [PATCH 20/32] Add ILP32 support to elf_machine_load_address.
+
+This adds ILP32 support to elf_machine_load_address.
+Since elf_machine_load_address depends on the static address being
+found without relocations, we need to use 16bit relocation which gets
+resolved at link time for ILP32. This is just like how the 32bit
+relocation gets resolved at link time for LP64.
+
+* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
+for ILP32.
+---
+ sysdeps/aarch64/dl-machine.h | 20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
+index 121b178..f3bcad1 100644
+--- a/sysdeps/aarch64/dl-machine.h
++++ b/sysdeps/aarch64/dl-machine.h
+@@ -54,19 +54,33 @@ elf_machine_load_address (void)
+ by constructing a non GOT reference to the symbol, the dynamic
+ address of the symbol we compute using adrp/add to compute the
+ symbol's address relative to the PC.
+- This depends on 32bit relocations being resolved at link time
+- and that the static address fits in the 32bits. */
++ This depends on 32/16bit relocations being resolved at link time
++ and that the static address fits in the 32/16 bits. */
+
+ ElfW(Addr) static_addr;
+ ElfW(Addr) dynamic_addr;
+
+ asm (" \n"
+ " adrp %1, _dl_start; \n"
++#ifdef __LP64__
+ " add %1, %1, #:lo12:_dl_start \n"
+-" ldr %w0, 1f \n"
++#else
++" add %w1, %w1, #:lo12:_dl_start \n"
++#endif
++" ldr %w0, 1f \n"
+ " b 2f \n"
+ "1: \n"
++#ifdef __LP64__
+ " .word _dl_start \n"
++#else
++# ifdef __AARCH64EB__
++" .short 0 \n"
++# endif
++" .short _dl_start \n"
++# ifndef __AARCH64EB__
++" .short 0 \n"
++# endif
++#endif
+ "2: \n"
+ : "=r" (static_addr), "=r" (dynamic_addr));
+ return dynamic_addr - static_addr;
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0021-Set-up-wordsize-for-ILP32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0021-Set-up-wordsize-for-ILP32.patch
new file mode 100644
index 0000000..cc28d84
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0021-Set-up-wordsize-for-ILP32.patch
@@ -0,0 +1,40 @@
+From b334852fe1bdb7c32b0eb36263d08e14ff797591 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:44 -0700
+Subject: [PATCH 21/32] Set up wordsize for ILP32.
+
+__WORDSIZE needs to be set to 32 for ILP32.
+
+* sysdeps/aarch64/bits/wordsize.h (__WORDSIZE): Set to 32 for ILP32.
+Update comments.
+---
+ sysdeps/aarch64/bits/wordsize.h | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
+index 3ecccaa..3d5a79d 100644
+--- a/sysdeps/aarch64/bits/wordsize.h
++++ b/sysdeps/aarch64/bits/wordsize.h
+@@ -15,12 +15,16 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+-#define __WORDSIZE 64
++#ifdef __LP64__
++# define __WORDSIZE 64
++#else
++# define __WORDSIZE 32
++#endif
+
+-/* LP64 ABI has a 64bit time_t.
++/* LP64 and ILP32s ABI uses a 64bit time_t.
+ This allows aarch32 and AARCH64 applications
+ both access utmp. */
+ #define __WORDSIZE_TIME64_COMPAT32 1
+
+-/* LP64 use the 64bit system call interface. */
++/* LP64 and ILP32 use the 64bit system call interface. */
+ #define __SYSCALL_WORDSIZE 64
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0022-Add-ILP32-to-makefiles.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0022-Add-ILP32-to-makefiles.patch
new file mode 100644
index 0000000..60236f8
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0022-Add-ILP32-to-makefiles.patch
@@ -0,0 +1,59 @@
+From 74ed85ab029e159466af00359e5db697c23f6d5a Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:45 -0700
+Subject: [PATCH 22/32] Add ILP32 to makefiles
+
+This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
+makefile.
+
+* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
+and ilp32_be.
+(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
+(abi-lp64-condition): Check word size macro also.
+(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
+(abi-lp64_be-condition): Check word size macro also.
+(abi-ilp32-options): Define.
+(abi-ilp32-condition): Likewise.
+(abi-ilp32_be-options): Define.
+(abi-ilp32_be-condition): Likewise.
+---
+ sysdeps/unix/sysv/linux/aarch64/Makefile | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile
+index 88250dd..5ce20fe 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
++++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
+@@ -25,15 +25,25 @@ endif
+
+ abi-variants := lp64
+ abi-variants += lp64_be
++abi-variants += ilp32
++abi-variants += ilp32_be
+
+ ifeq (,$(filter $(default-abi),$(abi-variants)))
+ Unknown ABI, must be one of $(abi-variants)
+ endif
+
+-abi-lp64-options := -U__AARCH64EB__
+-abi-lp64-condition := !defined __AARCH64EB__
++abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
++abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
+ abi-lp64-ld-soname := ld-linux-aarch64.so.1
+
+-abi-lp64_be-options := -D__AARCH64EB__
+-abi-lp64_be-condition := defined __AARCH64EB__
++abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
++abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+ abi-lp64_be-ld-soname := ld-linux-aarch64_be.so.1
++
++abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
++abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
++abi-ilp32-ld-soname := ld-linux-aarch64_ilp32.so.1
++
++abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
++abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
++abi-ilp32_be-ld-soname := ld-linux-aarch64_be_ilp32.so.1
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0023-Add-support-to-ldconfig-for-ILP32-and-libilp32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0023-Add-support-to-ldconfig-for-ILP32-and-libilp32.patch
new file mode 100644
index 0000000..9beb361
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0023-Add-support-to-ldconfig-for-ILP32-and-libilp32.patch
@@ -0,0 +1,108 @@
+From 0c96833f64a81f61c8709924fe79bc9f5137a0b8 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:46 -0700
+Subject: [PATCH 23/32] Add support to ldconfig for ILP32 and libilp32
+
+This patch adds support to ldconfig for libilp32 which is used by
+ILP32.
+
+* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
+* elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
+* sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
+Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
+(add_system_dir): Add libilp32 to the list of system directories.
+* sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
+Handle ILP32 elf binaries.
+---
+ elf/cache.c | 2 ++
+ sysdeps/generic/ldconfig.h | 1 +
+ sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 ++++++++++++-
+ sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +++-
+ 4 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/elf/cache.c b/elf/cache.c
+index 4cbf8d9..267214f 100644
+--- a/elf/cache.c
++++ b/elf/cache.c
+@@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int osversion,
+ case FLAG_AARCH64_LIB64:
+ fputs (",AArch64", stdout);
+ break;
++ case FLAG_AARCH64_LIB32:
++ fputs (",ILP32", stdout);
+ /* Uses the ARM soft-float ABI. */
+ case FLAG_ARM_LIBSF:
+ fputs (",soft-float", stdout);
+diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
+index ba1d953..1dd8b4e 100644
+--- a/sysdeps/generic/ldconfig.h
++++ b/sysdeps/generic/ldconfig.h
+@@ -42,6 +42,7 @@
+ #define FLAG_MIPS_LIB32_NAN2008 0x0c00
+ #define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
+ #define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
++#define FLAG_AARCH64_LIB32 0x0f00
+
+ /* Name of auxiliary cache. */
+ #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
+diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+index 32851d0..930aa20 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
++++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+@@ -18,7 +18,11 @@
+
+ #include <ldconfig.h>
+
++#ifdef __LP64__
+ #define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
++#else
++#define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
++#endif
+
+ #define _dl_cache_check_flags(flags) \
+ ((flags) == _DL_CACHE_DEFAULT_ID)
+@@ -27,18 +31,25 @@
+ do \
+ { \
+ size_t len = strlen (dir); \
+- char path[len + 3]; \
++ char path[len + 6]; \
+ memcpy (path, dir, len + 1); \
+ if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \
+ { \
+ len -= 2; \
+ path[len] = '\0'; \
+ } \
++ if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
++ { \
++ len -= 5; \
++ path[len] = '\0'; \
++ } \
+ add_dir (path); \
+ if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \
+ { \
+ memcpy (path + len, "64", 3); \
+ add_dir (path); \
++ memcpy (path + len, "ilp32", 6); \
++ add_dir (path); \
+ } \
+ } while (0)
+
+diff --git a/sysdeps/unix/sysv/linux/arm/readelflib.c b/sysdeps/unix/sysv/linux/arm/readelflib.c
+index a15ebe4..e255fb0 100644
+--- a/sysdeps/unix/sysv/linux/arm/readelflib.c
++++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
+@@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
+ ret = process_elf32_file (file_name, lib, flag, osversion, soname,
+ file_contents, file_length);
+
+- if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
++ if (!ret && elf_header->e_machine == EM_AARCH64)
++ *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
++ else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5)
+ {
+ if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
+ *flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0024-Add-ILP32-ld.so-to-the-known-interpreter-names.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0024-Add-ILP32-ld.so-to-the-known-interpreter-names.patch
new file mode 100644
index 0000000..09805b3
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0024-Add-ILP32-ld.so-to-the-known-interpreter-names.patch
@@ -0,0 +1,29 @@
+From f38ab6dca56eace1dc64c6d804c528b6cf7e8f3b Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:47 -0700
+Subject: [PATCH 24/32] Add ILP32 ld.so to the known interpreter names.
+
+This patch adds ILP32 ld.so names to the known interpreter names.
+
+* sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
+Add ilp32 ld.so names.
+---
+ sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+index b0e6b6a..a70eafc 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
++++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+@@ -21,6 +21,8 @@
+ #define SYSDEP_KNOWN_INTERPRETER_NAMES \
+ { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
++ { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
++ { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
+ #define SYSDEP_KNOWN_LIBRARY_NAMES \
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0025-Add-ldd-rewrite.sed-so-that-ilp32-ld.so-can-be-found.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0025-Add-ldd-rewrite.sed-so-that-ilp32-ld.so-can-be-found.patch
new file mode 100644
index 0000000..468001c
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0025-Add-ldd-rewrite.sed-so-that-ilp32-ld.so-can-be-found.patch
@@ -0,0 +1,49 @@
+From 640294b548da2c45b2e06e7565197cfbfa71ceb4 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:48 -0700
+Subject: [PATCH 25/32] Add ldd-rewrite.sed so that ilp32 ld.so can be found
+
+To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
+to rewrite RTLDLIST to include both ld.so's.
+
+* sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
+Set.
+* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
+* sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.
+---
+ sysdeps/unix/sysv/linux/aarch64/configure | 2 ++
+ sysdeps/unix/sysv/linux/aarch64/configure.ac | 2 ++
+ sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
+ 3 files changed, 5 insertions(+)
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
+index 59372d2..faef1dd 100755
+--- a/sysdeps/unix/sysv/linux/aarch64/configure
++++ b/sysdeps/unix/sysv/linux/aarch64/configure
+@@ -31,3 +31,5 @@ case "$prefix" in
+ esac
+ fi
+
++ldd_rewrite_script=$dir/ldd-rewrite.sed
++
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+index 6526816..3ca8ed1 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
++++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+@@ -9,3 +9,5 @@ else
+ LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
+ fi
+
++ldd_rewrite_script=$dir/ldd-rewrite.sed
++
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
+new file mode 100644
+index 0000000..2f3bbb9
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
+@@ -0,0 +1 @@
++s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7 \2\3-aarch64\5\_ilp32\7"_
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0026-Add-kernel_sigaction.h-for-AARCH64-ILP32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0026-Add-kernel_sigaction.h-for-AARCH64-ILP32.patch
new file mode 100644
index 0000000..69355d0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0026-Add-kernel_sigaction.h-for-AARCH64-ILP32.patch
@@ -0,0 +1,78 @@
+From 5fd5c369cf7ed9fc3640f944aeb848b160a343b2 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:49 -0700
+Subject: [PATCH 26/32] Add kernel_sigaction.h for AARCH64 ILP32
+
+In ILP32, the sigaction struct is the same as AARCH64 so we need
+the header file kernel_sigaction.h. To allow for this to work,
+we use a long long fields and then add extra casts when converting
+between the user exposed struct and the kernel exposed struct.
+
+* sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file.
+* sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction):
+Add cast here it is necessary.
+---
+ sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 ++++++++++++
+ sysdeps/unix/sysv/linux/aarch64/sigaction.c | 10 ++++++----
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
+new file mode 100644
+index 0000000..7b3023b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
+@@ -0,0 +1,12 @@
++
++#define HAVE_SA_RESTORER
++
++/* This is the sigaction structure in aarch64 kernel.
++ Note the ILP32 struct uses the same struct as LP64
++ which is why the fields are 64bit in size. */
++struct kernel_sigaction {
++ unsigned long long k_sa_handler;
++ unsigned long long sa_flags;
++ unsigned long long sa_restorer;
++ sigset_t sa_mask;
++};
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+index ae6c3fd..8adcbba 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c
++++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+@@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+
+ if (act)
+ {
+- kact.k_sa_handler = act->sa_handler;
++ kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
+ memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
+ kact.sa_flags = act->sa_flags;
+ #ifdef HAVE_SA_RESTORER
+ if (kact.sa_flags & SA_RESTORER)
+- kact.sa_restorer = act->sa_restorer;
++ kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer;
+ #endif
+ }
+
++ /* This is needed for ILP32 as the structures are two different sizes due to
++ using the LP64 structure. */
+ result = INLINE_SYSCALL (rt_sigaction, 4, sig,
+ act ? &kact : NULL,
+ oact ? &koact : NULL, _NSIG / 8);
+@@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+ {
+ if (oact && result >= 0)
+ {
+- oact->sa_handler = koact.k_sa_handler;
++ oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
+ memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
+ oact->sa_flags = koact.sa_flags;
+ #ifdef HAVE_SA_RESTORER
+- oact->sa_restorer = koact.sa_restorer;
++ oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
+ #endif
+ }
+ }
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0027-Add-sigstack.h-header-for-ILP32-reasons.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0027-Add-sigstack.h-header-for-ILP32-reasons.patch
new file mode 100644
index 0000000..93d7cf9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0027-Add-sigstack.h-header-for-ILP32-reasons.patch
@@ -0,0 +1,94 @@
+From d010da312e05ef8543f6e176d14bcb68a7c369e0 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:50 -0700
+Subject: [PATCH 27/32] Add sigstack.h header for ILP32 reasons.
+
+ILP32 uses the same structure layout for sigaltstack as
+LP64 so we need a special header file.
+
+* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h: New file.
+---
+ sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h | 71 +++++++++++++++++++++++++
+ 1 file changed, 71 insertions(+)
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
+new file mode 100644
+index 0000000..2dd8f6b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
+@@ -0,0 +1,71 @@
++/* sigstack, sigaltstack definitions.
++ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SIGNAL_H
++# error "Never include this file directly. Use <signal.h> instead"
++#endif
++
++
++/* Structure describing a signal stack (obsolete). */
++struct sigstack
++ {
++ void *ss_sp; /* Signal stack pointer. */
++ int ss_onstack; /* Nonzero if executing on this stack. */
++ };
++
++
++/* Possible values for `ss_flags.'. */
++enum
++{
++ SS_ONSTACK = 1,
++#define SS_ONSTACK SS_ONSTACK
++ SS_DISABLE
++#define SS_DISABLE SS_DISABLE
++};
++
++/* Minimum stack size for a signal handler. */
++#define MINSIGSTKSZ 2048
++
++/* System default stack size. */
++#define SIGSTKSZ 8192
++
++
++/* Alternate, preferred interface.
++ This structure matches the same size and layout
++ for both ILP32 and LP64. */
++typedef struct sigaltstack
++ {
++#if defined(__ILP32__) && defined(__AARCH64EB__)
++ int __pad_ss_sp;
++#endif
++ void *ss_sp;
++#if defined(__ILP32__) && !defined(__AARCH64EB__)
++ int __pad_ss_sp;
++#endif
++ int ss_flags;
++#if defined(__ILP32__)
++ int __pad_after_ss_flags;
++#endif
++#if defined(__ILP32__) && defined(__AARCH64EB__)
++ int __pad_ss_size;
++#endif
++ size_t ss_size;
++#if defined(__ILP32__) && !defined(__AARCH64EB__)
++ int __pad_ss_size;
++#endif
++ } stack_t;
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0028-Fix-up-ucontext-for-ILP32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0028-Fix-up-ucontext-for-ILP32.patch
new file mode 100644
index 0000000..89f1fb9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0028-Fix-up-ucontext-for-ILP32.patch
@@ -0,0 +1,40 @@
+From 7ba098b1d1d518b58e1301fe788b8c32156cec7b Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:51 -0700
+Subject: [PATCH 28/32] Fix up ucontext for ILP32
+
+In ILP32 we want to use the same layout of the structure ucontext as LP64 so
+we need to add a padding for uc_link and change the type of uc_flags to
+be the kernel unsigned long type.
+
+* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext):
+Change the type of uc_flags to __SYSCALL_ULONG_TYPE.
+Add padding for uc_link if ILP32.
+---
+ sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+index 476f5de..5d224fb 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
++++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+@@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
+ /* Userlevel context. */
+ typedef struct ucontext
+ {
+- unsigned long uc_flags;
+- struct ucontext *uc_link;
++ __SYSCALL_ULONG_TYPE uc_flags;
++#if defined(__ILP32__) && defined(__AARCH64EB__)
++ int __pad_uc_link;
++#endif
++ struct ucontext *uc_link;
++#if defined(__ILP32__) && !defined(__AARCH64EB__)
++ int __pad_uc_link;
++#endif
+ stack_t uc_stack;
+ __sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0029-Add-typesizes.h-for-ILP32.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0029-Add-typesizes.h-for-ILP32.patch
new file mode 100644
index 0000000..ccbd431
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0029-Add-typesizes.h-for-ILP32.patch
@@ -0,0 +1,160 @@
+From ee1e9b42d75a61a87b100dab7293668a5127742c Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:52 -0700
+Subject: [PATCH 29/32] Add typesizes.h for ILP32
+
+The generic typesizes does not work for ILP32 as the kernel long type
+needs to be long long (quad). time_t, off_t, clock_t, suseconds_t,
+ino_t, rlim_t are 64bits.
+FDSET bitmask is a 64bit type.
+
+* sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h: New file.
+---
+ sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 135 +++++++++++++++++++++++
+ 1 file changed, 135 insertions(+)
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
+new file mode 100644
+index 0000000..f8e3206
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
+@@ -0,0 +1,135 @@
++/* bits/typesizes.h -- underlying types for *_t. Linux/AARCh64 version.
++ Copyright (C) 2011-2014 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library. If not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _BITS_TYPES_H
++# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
++#endif
++
++#ifndef _BITS_TYPESIZES_H
++#define _BITS_TYPESIZES_H 1
++
++/* See <bits/types.h> for the meaning of these macros. This file exists so
++ that <bits/types.h> need not vary across different GNU platforms. */
++
++/* ILP32 kernel interface is 64-bit. */
++#ifndef __LP64__
++# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE
++# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE
++#else
++# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
++# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
++#endif
++#define __DEV_T_TYPE __UQUAD_TYPE
++#define __UID_T_TYPE __U32_TYPE
++#define __GID_T_TYPE __U32_TYPE
++#define __INO_T_TYPE __SYSCALL_ULONG_TYPE
++#define __INO64_T_TYPE __UQUAD_TYPE
++#define __MODE_T_TYPE __U32_TYPE
++#define __NLINK_T_TYPE __U32_TYPE
++#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE
++#define __OFF64_T_TYPE __SQUAD_TYPE
++#define __PID_T_TYPE __S32_TYPE
++#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE
++#define __RLIM64_T_TYPE __UQUAD_TYPE
++#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE
++#define __BLKCNT64_T_TYPE __SQUAD_TYPE
++#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE
++#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
++#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE
++#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
++#define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE
++#define __ID_T_TYPE __U32_TYPE
++#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE
++#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
++#define __USECONDS_T_TYPE __U32_TYPE
++#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
++#define __DADDR_T_TYPE __S32_TYPE
++#define __SWBLK_T_TYPE __SYSCALL_SLONG_TYPE
++#define __KEY_T_TYPE __S32_TYPE
++#define __CLOCKID_T_TYPE __S32_TYPE
++#define __TIMER_T_TYPE void *
++#define __BLKSIZE_T_TYPE __S32_TYPE
++#define __FSID_T_TYPE struct { int __val[2]; }
++#define __SSIZE_T_TYPE __SLONGWORD_TYPE
++
++/* Number of descriptors that can fit in an `fd_set'. */
++#define __FD_SETSIZE 1024
++
++/* Tell the libc code that off_t and off64_t are actually the same type
++ for all ABI purposes, even if possibly expressed as different base types
++ for C type-checking purposes. */
++#define __OFF_T_MATCHES_OFF64_T 1
++
++/* Same for ino_t and ino64_t. */
++#define __INO_T_MATCHES_INO64_T 1
++
++/* Same for __blkcnt_t and __blkcnt64_t. */
++#define __BLKCNT_T_TYPE_MATCHES_BLKCNT64_T_TYPE 1
++
++/* Same for __fsblkcnt_t and __fsblkcnt64_t. */
++#define __FSBLKCNT_T_TYPE_MATCHES_FSBLKCNT64_T_TYPE 1
++
++/* Same for __fsfilcnt_t and __fsfilcnt64_t. */
++#define __FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE 1
++
++/* LP32 needs some padding in some cases */
++
++#ifndef __LP64__
++
++# undef __SIGINFO_INNER
++# ifdef __AARCH64EB__
++# define __SIGINFO_INNER(type, field) \
++ __extension__ struct { \
++ int __pad_##field; \
++ type field; \
++ } __attribute__((aligned(8) ))
++# else
++# define __SIGINFO_INNER(type, field) \
++ __extension__ struct { \
++ type field; \
++ int __pad_##field; \
++ } __attribute__((aligned(8) ))
++# endif
++
++# define __RUSAGE_LONG(__field) \
++ __SIGINFO_INNER(long, __field)
++
++# define __SHMID_DS_SIZE_TYPE(__field) \
++ __SIGINFO_INNER(size_t, __field)
++
++# undef __SIGINFO_VOIDPTR
++# define __SIGINFO_VOIDPTR(field) \
++ __SIGINFO_INNER(void*, field)
++
++# undef __SIGINFO_BAND
++# define __SIGINFO_BAND(field) \
++ __SIGINFO_INNER(long, field)
++
++#define __SIGSET_INNER_T __SYSCALL_ULONG_TYPE
++#define __FD_MASK_TYPE __SYSCALL_SLONG_TYPE
++#define __FD_MASK_CONST(a) (__extension__ a##ull)
++#endif
++
++
++#define __IPC_TIME_T_64_BITS
++
++#define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
++
++
++#endif /* bits/typesizes.h */
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0030-Make-lp64-and-ilp32-directories.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0030-Make-lp64-and-ilp32-directories.patch
new file mode 100644
index 0000000..01cbfcd
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0030-Make-lp64-and-ilp32-directories.patch
@@ -0,0 +1,722 @@
+From 3df8339b4b902af706f313b7848871b0aecb3088 Mon Sep 17 00:00:00 2001
+From: Andrew Pinski <apinski@cavium.com>
+Date: Mon, 27 Oct 2014 00:59:53 -0700
+Subject: [PATCH 30/32] Make lp64 and ilp32 directories.
+
+The patch makes the ilp32 and lp64 have their own directory under aarch64.
+Since ILP32 uses most of the same system calls as LP64 and has a 64bit
+off_t, we need make the functions that end in 64 the same as the ones without.
+We also need not to special case ioctl or use the already provided mmap.c file.
+
+ChangeLog:
+ * sysdeps/aarch64/ilp32/Implies: New file.
+ * sysdeps/aarch64/Implies: Rename to
+ * sysdeps/aarch64/lp64/Implies: This.
+ * sysdeps/unix/sysv/linux/aarch64/shlib-versions: Rename to ...
+ * sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions: This.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/Implies: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/Versions: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c: New file
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h: New file.
+ * sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c: New file.
+---
+ sysdeps/aarch64/Implies | 6 --
+ sysdeps/aarch64/ilp32/Implies | 6 ++
+ sysdeps/aarch64/lp64/Implies | 7 +++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/Implies | 3 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/Versions | 5 ++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c | 2 +
+ .../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c | 6 ++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/fallocate64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c | 2 +
+ .../unix/sysv/linux/aarch64/ilp32/getrlimit64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/kernel_stat.h | 24 ++++++++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c | 1 +
+ .../sysv/linux/aarch64/ilp32/posix_fadvise64.c | 1 +
+ .../sysv/linux/aarch64/ilp32/posix_fallocate.c | 1 +
+ .../sysv/linux/aarch64/ilp32/posix_fallocate64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c | 66 ++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/setrlimit64.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/shlib-versions | 7 +++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c | 5 ++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c | 1 +
+ .../unix/sysv/linux/aarch64/ilp32/syscalls.list | 21 +++++++
+ sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c | 1 +
+ sysdeps/unix/sysv/linux/aarch64/ioctl.S | 31 ----------
+ sysdeps/unix/sysv/linux/aarch64/lp64/Implies | 4 ++
+ sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S | 31 ++++++++++
+ .../unix/sysv/linux/aarch64/lp64/shlib-versions | 7 +++
+ sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 -----------
+ 46 files changed, 224 insertions(+), 71 deletions(-)
+ delete mode 100644 sysdeps/aarch64/Implies
+ create mode 100644 sysdeps/aarch64/ilp32/Implies
+ create mode 100644 sysdeps/aarch64/lp64/Implies
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
+ delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
+ create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
+ delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
+
+diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies
+deleted file mode 100644
+index e5adf4d..0000000
+--- a/sysdeps/aarch64/Implies
++++ /dev/null
+@@ -1,6 +0,0 @@
+-wordsize-64
+-ieee754/ldbl-128
+-ieee754/dbl-64/wordsize-64
+-ieee754/dbl-64
+-ieee754/flt-32
+-aarch64/soft-fp
+diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
+new file mode 100644
+index 0000000..705bc5b
+--- /dev/null
++++ b/sysdeps/aarch64/ilp32/Implies
+@@ -0,0 +1,6 @@
++aarch64
++wordsize-32
++ieee754/ldbl-128
++ieee754/dbl-64
++ieee754/flt-32
++aarch64/soft-fp
+diff --git a/sysdeps/aarch64/lp64/Implies b/sysdeps/aarch64/lp64/Implies
+new file mode 100644
+index 0000000..d2fbde7
+--- /dev/null
++++ b/sysdeps/aarch64/lp64/Implies
+@@ -0,0 +1,7 @@
++aarch64
++wordsize-64
++ieee754/ldbl-128
++ieee754/dbl-64/wordsize-64
++ieee754/dbl-64
++ieee754/flt-32
++aarch64/soft-fp
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
+new file mode 100644
+index 0000000..a88511b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
+@@ -0,0 +1,3 @@
++aarch64/nptl
++unix/sysv/linux/aarch64
++unix/sysv/linux/generic
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
+new file mode 100644
+index 0000000..58b6bfb
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/Versions
+@@ -0,0 +1,5 @@
++libc {
++ GLIBC_2.21 {
++ fallocate64;
++ }
++}
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
+new file mode 100644
+index 0000000..05feb3d
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/creat.c
+@@ -0,0 +1,2 @@
++#include <sysdeps/unix/sysv/linux/generic/creat.c>
++weak_alias (__libc_creat, creat64)
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
+new file mode 100644
+index 0000000..339e5f4
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
+@@ -0,0 +1,6 @@
++/* In this implementation we do not really care whether the call fails
++ because of missing kernel support since we do not even call the
++ function in this case. */
++#undef __ASSUME_ATFCTS
++#define __ASSUME_ATFCTS 1
++#include "fxstatat.c"
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
+new file mode 100644
+index 0000000..d3b7218
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
+@@ -0,0 +1 @@
++#include <sysdeps/unix/sysv/linux/wordsize-64/fallocate.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
+new file mode 100644
+index 0000000..df33112
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
+@@ -0,0 +1 @@
++/* fallocate64 is in posix_fallocate.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
+new file mode 100644
+index 0000000..2be4e59
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
+@@ -0,0 +1 @@
++/* fstatfs64 is the same as fstatfs. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
+new file mode 100644
+index 0000000..673a8b5
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
+@@ -0,0 +1 @@
++/* ftruncate64 is the same as ftruncate. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
+new file mode 100644
+index 0000000..272b6be
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
+@@ -0,0 +1 @@
++#include <sysdeps/unix/sysv/linux/wordsize-64/fxstat.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
+new file mode 100644
+index 0000000..9eff9eb
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
+@@ -0,0 +1 @@
++/* fxstat64 is in fxstat.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
+new file mode 100644
+index 0000000..689cd57
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
+@@ -0,0 +1 @@
++#include <sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
+new file mode 100644
+index 0000000..05e7f41
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
+@@ -0,0 +1 @@
++/* fxstatat64 is in fxstatat.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
+new file mode 100644
+index 0000000..14dbbc7
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
+@@ -0,0 +1 @@
++/* Defined in getdents64.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
+new file mode 100644
+index 0000000..08987ea
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
+@@ -0,0 +1,2 @@
++#include <sysdeps/unix/sysv/linux/generic/getdents64.c>
++strong_alias (__getdents64, __getdents)
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
+new file mode 100644
+index 0000000..9feab0e
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/getrlimit64.c
+@@ -0,0 +1 @@
++/* getrlimit64 is the same as getrlimit. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
+new file mode 100644
+index 0000000..e542747
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/glob.c
+@@ -0,0 +1 @@
++#include <sysdeps/wordsize-64/glob.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h b/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
+new file mode 100644
+index 0000000..91e01ba
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/kernel_stat.h
+@@ -0,0 +1,24 @@
++/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library. If not, see
++ <http://www.gnu.org/licenses/>. */
++
++#include <sysdeps/unix/sysv/linux/generic/kernel_stat.h>
++
++/* ILP32 has no overflow checks. */
++#ifndef __LP64__
++#define XSTAT_IS_XSTAT64 1
++#endif
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
+new file mode 100644
+index 0000000..24013a8
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
+@@ -0,0 +1 @@
++/* lseek() is 64-bit capable already. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
+new file mode 100644
+index 0000000..bb5dbd0
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat64.c
+@@ -0,0 +1 @@
++/* lxstat64 is in lxstat.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
+new file mode 100644
+index 0000000..8e32bae
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
+@@ -0,0 +1 @@
++/* mmap64 is provided by mmap as they are the same. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
+new file mode 100644
+index 0000000..c9f72c4
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
+@@ -0,0 +1 @@
++/* posix_fadvise64 is in posix_fadvise.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
+new file mode 100644
+index 0000000..b3fe81b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate.c
+@@ -0,0 +1 @@
++#include <sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
+new file mode 100644
+index 0000000..f466f13
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fallocate64.c
+@@ -0,0 +1 @@
++/* posix_fallocate64 is in posix_fallocate.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
+new file mode 100644
+index 0000000..b7f298d
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
+@@ -0,0 +1 @@
++/* Empty since the pread syscall is equivalent. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
+new file mode 100644
+index 0000000..0a20301
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
+@@ -0,0 +1 @@
++/* preadv64 is the same as preadv. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
+new file mode 100644
+index 0000000..b7f298d
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
+@@ -0,0 +1 @@
++/* Empty since the pread syscall is equivalent. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
+new file mode 100644
+index 0000000..e96c6f2
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
+@@ -0,0 +1 @@
++/* pwritev64 is the same as pwritev. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
+new file mode 100644
+index 0000000..0652405
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
+@@ -0,0 +1,66 @@
++/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library. If not, see
++ <http://www.gnu.org/licenses/>. */
++
++#include <errno.h>
++#include <stdarg.h>
++#include <sys/sem.h>
++#include <ipc_priv.h>
++#include <sysdep.h>
++
++/* Define a `union semun' that is for glibc here. */
++union semun
++{
++ int val; /* value for SETVAL */
++ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
++ unsigned short int *array; /* array for GETALL & SETALL */
++ struct seminfo *__buf; /* buffer for IPC_INFO */
++};
++
++union semun_kernel
++{
++ int val; /* value for SETVAL */
++ unsigned long long kern_ptr;
++};
++
++int __semctl (int semid, int semnum, int cmd, ...);
++
++int
++__semctl (int semid, int semnum, int cmd, ...)
++{
++ union semun arg;
++ union semun_kernel arg_real;
++ va_list ap;
++
++ va_start (ap, cmd);
++
++ /* Get the argument. */
++ arg = va_arg (ap, union semun);
++
++ va_end (ap);
++
++ arg_real.kern_ptr = 0;
++ if (cmd == SETVAL)
++ arg_real.val = arg.val;
++ else
++ arg_real.kern_ptr = (unsigned long long)(uintptr_t)arg.array;
++
++ return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd,
++ arg_real.kern_ptr);
++}
++
++#include <shlib-compat.h>
++versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
+new file mode 100644
+index 0000000..4c451bd
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/sendfile64.c
+@@ -0,0 +1 @@
++/* sendfile64 is alias of sendfile syscall. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
+new file mode 100644
+index 0000000..8edcff0
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/setrlimit64.c
+@@ -0,0 +1 @@
++/* setrlimit64 is the same as setrlimit. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
+new file mode 100644
+index 0000000..17db764
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
+@@ -0,0 +1,7 @@
++DEFAULT GLIBC_2.21
++
++%ifdef HAVE_AARCH64_BE
++ld=ld-linux-aarch64_be_ilp32.so.1
++%else
++ld=ld-linux-aarch64_ilp32.so.1
++%endif
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
+new file mode 100644
+index 0000000..06bc688
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
+@@ -0,0 +1 @@
++/* statfs64 is the same as statfs. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
+new file mode 100644
+index 0000000..48a1d6d
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs.c
+@@ -0,0 +1,5 @@
++#define __statvfs64(file, buf) __no_statvfs64(file, buf)
++#define statvfs64(file, buf) no_statvfs64(file, buf)
++#include "sysdeps/unix/sysv/linux/statvfs.c"
++strong_alias (statvfs, __statvfs64)
++weak_alias (statvfs, statvfs64)
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
+new file mode 100644
+index 0000000..510015e
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statvfs64.c
+@@ -0,0 +1 @@
++/* statvfs64 is the same as statvfs. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
+new file mode 100644
+index 0000000..1a3834b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
+@@ -0,0 +1,21 @@
++# File name Caller Syscall name # args Strong name Weak names
++
++truncate - truncate i:si truncate __truncate truncate64
++ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
++preadv - preadv Ci:ipii preadv preadv64
++pwritev - pwritev Ci:ipii pwritev pwritev64
++pread - pread64 Ci:ibni __libc_pread __libc_pread64 __pread pread __pread64 pread64
++pwrite - pwrite64 Ci:ibni __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
++readahead - readahead i:iii __readahead readahead
++getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64
++setrlimit - setrlimit i:ip __setrlimit setrlimit setrlimit64
++prlimit EXTRA prlimit64 i:iipp prlimit
++sendfile - sendfile i:iipi sendfile sendfile64
++lseek - lseek Ci:iii __libc_lseek __lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
++sync_file_range - sync_file_range Ci:iiii sync_file_range
++mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64
++posix_fadvise - fadvise64 Vi:iiii posix_fadvise posix_fadvise64
++fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64
++statfs - statfs i:sp __statfs statfs statfs64 __statfs64
++fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
++
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
+new file mode 100644
+index 0000000..8999768
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c
+@@ -0,0 +1 @@
++/* truncate64 is the same as truncate. */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
+new file mode 100644
+index 0000000..96927fe
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
+@@ -0,0 +1 @@
++#include <sysdeps/unix/sysv/linux/generic/xstat.c>
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
+new file mode 100644
+index 0000000..e7acd3b
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c
+@@ -0,0 +1 @@
++/* xstat64 is in xstat.c */
+diff --git a/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+deleted file mode 100644
+index 8920a20..0000000
+--- a/sysdeps/unix/sysv/linux/aarch64/ioctl.S
++++ /dev/null
+@@ -1,31 +0,0 @@
+-/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
+-
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public License as
+- published by the Free Software Foundation; either version 2.1 of the
+- License, or (at your option) any later version.
+-
+- The GNU C Library 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
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, see
+- <http://www.gnu.org/licenses/>. */
+-
+-#include <sysdep.h>
+-
+- .text
+-ENTRY(__ioctl)
+- mov x8, #__NR_ioctl
+- sxtw x0, w0
+- svc #0x0
+- cmn x0, #4095
+- b.cs .Lsyscall_error
+- ret
+-PSEUDO_END (__ioctl)
+-
+-weak_alias (__ioctl, ioctl)
+diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/Implies b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
+new file mode 100644
+index 0000000..6418211
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/lp64/Implies
+@@ -0,0 +1,4 @@
++aarch64/nptl
++unix/sysv/linux/aarch64
++unix/sysv/linux/generic
++unix/sysv/linux/wordsize-64
+diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
+new file mode 100644
+index 0000000..8920a20
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
++
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public License as
++ published by the Free Software Foundation; either version 2.1 of the
++ License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#include <sysdep.h>
++
++ .text
++ENTRY(__ioctl)
++ mov x8, #__NR_ioctl
++ sxtw x0, w0
++ svc #0x0
++ cmn x0, #4095
++ b.cs .Lsyscall_error
++ ret
++PSEUDO_END (__ioctl)
++
++weak_alias (__ioctl, ioctl)
+diff --git a/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
+new file mode 100644
+index 0000000..e1768a7
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
+@@ -0,0 +1,7 @@
++DEFAULT GLIBC_2.17
++
++%ifdef HAVE_AARCH64_BE
++ld=ld-linux-aarch64_be.so.1
++%else
++ld=ld-linux-aarch64.so.1
++%endif
+diff --git a/sysdeps/unix/sysv/linux/aarch64/mmap.c b/sysdeps/unix/sysv/linux/aarch64/mmap.c
+deleted file mode 100644
+index 54ecc10..0000000
+--- a/sysdeps/unix/sysv/linux/aarch64/mmap.c
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
+-
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public License as
+- published by the Free Software Foundation; either version 2.1 of the
+- License, or (at your option) any later version.
+-
+- The GNU C Library 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
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, see
+- <http://www.gnu.org/licenses/>. */
+-
+-#include <sys/types.h>
+-#include <sys/mman.h>
+-#include <errno.h>
+-#include <sys/syscall.h>
+-#include <sysdep.h>
+-#include <unistd.h>
+-
+-__ptr_t
+-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+-{
+- return (__ptr_t) INLINE_SYSCALL (mmap, 6, addr, len, prot, flags, fd, offset);
+-}
+-
+-weak_alias (__mmap, mmap)
+-weak_alias (__mmap, mmap64)
+-weak_alias (__mmap, __mmap64)
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0031-sysdeps-unix-sysv-linux-aarch64-sysdep.h-Fix-crash-i.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0031-sysdeps-unix-sysv-linux-aarch64-sysdep.h-Fix-crash-i.patch
new file mode 100644
index 0000000..4c045c4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0031-sysdeps-unix-sysv-linux-aarch64-sysdep.h-Fix-crash-i.patch
@@ -0,0 +1,40 @@
+From c0a1a57f70e84b84517366d3862f5771db8fb25c Mon Sep 17 00:00:00 2001
+From: Will Newton <will.newton@linaro.org>
+Date: Wed, 12 Nov 2014 10:25:00 +0000
+Subject: [PATCH 31/32] sysdeps/unix/sysv/linux/aarch64/sysdep.h: Fix crash in
+ syscall_error
+
+---
+ sysdeps/unix/sysv/linux/aarch64/configure.ac | 2 +-
+ sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+index 3ca8ed1..c28ae0c 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
++++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
+@@ -2,7 +2,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
+
+ if test $aarch64_config_abi = ilp32; then
+- arch_minimum_kernel=3.19.0
++ arch_minimum_kernel=3.18.0
+ LIBC_SLIBDIR_RTLDDIR([libilp32], [lib])
+ else
+ arch_minimum_kernel=3.7.0
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+index 0d9fa8a..f5ca503 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
++++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+@@ -108,7 +108,7 @@
+ .Lsyscall_error: \
+ adrp x1, :gottprel:errno; \
+ neg w2, w0; \
+- ldr x1, [x1, :gottprel_lo12:errno]; \
++ ldr PTR_REG(1), [x1, :gottprel_lo12:errno]; \
+ mrs x3, tpidr_el0; \
+ mov x0, -1; \
+ str w2, [x1, x3]; \
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0032-sysdeps-unix-sysv-linux-aarch64-configure-Reduce-ker.patch b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0032-sysdeps-unix-sysv-linux-aarch64-configure-Reduce-ker.patch
new file mode 100644
index 0000000..a87d8c4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc-linaro-2.20/0032-sysdeps-unix-sysv-linux-aarch64-configure-Reduce-ker.patch
@@ -0,0 +1,26 @@
+From 3307dc591b95381b2ba5f3139a05997cc610e48d Mon Sep 17 00:00:00 2001
+From: Will Newton <will.newton@linaro.org>
+Date: Thu, 13 Nov 2014 16:18:06 +0000
+Subject: [PATCH 32/32] sysdeps/unix/sysv/linux/aarch64/configure: Reduce
+ kernel version to 3.18
+
+---
+ sysdeps/unix/sysv/linux/aarch64/configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/configure b/sysdeps/unix/sysv/linux/aarch64/configure
+index faef1dd..a523bfe 100755
+--- a/sysdeps/unix/sysv/linux/aarch64/configure
++++ b/sysdeps/unix/sysv/linux/aarch64/configure
+@@ -2,7 +2,7 @@
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
+
+ if test $aarch64_config_abi = ilp32; then
+- arch_minimum_kernel=3.19.0
++ arch_minimum_kernel=3.18.0
+ test -n "$libc_cv_slibdir" ||
+ case "$prefix" in
+ /usr | /usr/)
+--
+1.9.3
+
diff --git a/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb b/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb
index c80ee8c..c860e0f 100644
--- a/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb
+++ b/meta-linaro-toolchain/recipes-core/glibc/glibc_linaro-2.20.bb
@@ -26,6 +26,7 @@ SRC_URI = "http://releases.linaro.org/${MMYY}/components/toolchain/glibc-linaro/
file://grok_gold.patch \
file://fix_am_rootsbindir.patch \
${EGLIBCPATCHES} \
+ ${ILP32PATCHES} \
"
EGLIBCPATCHES = "\
file://timezone-re-written-tzselect-as-posix-sh.patch \
@@ -38,7 +39,39 @@ EGLIBCPATCHES = "\
file://eglibc-sh4-fpscr_values.patch \
file://eglibc-use-option-groups.patch \
"
-
+ILP32PATCHES = " \
+ file://0002-Fix-utmp-struct-for-compatibility-reasons.patch \
+ file://0003-Allow-sigset-be-an-array-of-a-different-type.patch \
+ file://0004-Add-ability-for-the-IPC-structures-msqid_ds-semid_ds.patch \
+ file://0005-Allow-rusage-work-on-a-big-endian-32bit-on-64bit-tar.patch \
+ file://0006-Allow-fd_mask-type-not-be-an-array-of-long.patch \
+ file://0007-Allow-some-fields-of-siginfo-to-be-different-from-th.patch \
+ file://0008-Allow-generic-stat-and-statfs-not-have-padding-for-3.patch \
+ file://0009-Add-header-guards-to-sysdep.h-headers.patch \
+ file://0010-Add-dynamic-ILP32-AARCH64-relocations-to-elf.h.patch \
+ file://0011-Add-PTR_REG-PTR_LOG_SIZE-and-PTR_SIZE.-Use-it-in-LDS.patch \
+ file://0012-Use-PTR_REG-in-crti.S.patch \
+ file://0013-Use-PTR_REG-PTR_SIZE-PTR_SIZE_LOG-in-dl-tlsesc.S.patch \
+ file://0014-Use-PTR_-macros-in-dl-trampoline.S.patch \
+ file://0015-Use-PTR_-in-start.S.patch \
+ file://0016-Use-PTR_REG-in-getcontext.S.patch \
+ file://0017-Detect-ILP32-in-configure-scripts.patch \
+ file://0018-Syscalls-for-ILP32-are-passed-always-via-64bit-value.patch \
+ file://0019-Reformat-inline-asm-in-elf_machine_load_address.patch \
+ file://0020-Add-ILP32-support-to-elf_machine_load_address.patch \
+ file://0021-Set-up-wordsize-for-ILP32.patch \
+ file://0022-Add-ILP32-to-makefiles.patch \
+ file://0023-Add-support-to-ldconfig-for-ILP32-and-libilp32.patch \
+ file://0024-Add-ILP32-ld.so-to-the-known-interpreter-names.patch \
+ file://0025-Add-ldd-rewrite.sed-so-that-ilp32-ld.so-can-be-found.patch \
+ file://0026-Add-kernel_sigaction.h-for-AARCH64-ILP32.patch \
+ file://0027-Add-sigstack.h-header-for-ILP32-reasons.patch \
+ file://0028-Fix-up-ucontext-for-ILP32.patch \
+ file://0029-Add-typesizes.h-for-ILP32.patch \
+ file://0030-Make-lp64-and-ilp32-directories.patch \
+ file://0031-sysdeps-unix-sysv-linux-aarch64-sysdep.h-Fix-crash-i.patch \
+ file://0032-sysdeps-unix-sysv-linux-aarch64-configure-Reduce-ker.patch \
+ "
SRC_URI[md5sum] = "ca2035b47d86856ffdd201ce2a12e60e"
SRC_URI[sha256sum] = "2db756f9f9281f78443cd04fc544fc2d8bce38037d5f75c8284bd8b0ccf9c9ed"