diff -ruN rpmbuild-orig/SOURCES/arm_DTV.patch rpmbuild/SOURCES/arm_DTV.patch
--- rpmbuild-orig/SOURCES/arm_DTV.patch	1970-01-01 01:00:00.000000000 +0100
+++ rpmbuild/SOURCES/arm_DTV.patch	2015-09-23 22:53:34.413711226 +0200
@@ -0,0 +1,20 @@
+X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blobdiff_plain;f=sysdeps%2Farm%2Fdl-tls.h;h=694d11d89ddcc214207ba36e04f26fc74a3fedbe;hp=02285a71479578ba58b629259e798757b2d5c4eb;hb=b6dd51368d348cda276032d851633dae32655ff2;hpb=91456166c51940caeecf2f3edc460deb689f82a4
+
+diff --git a/sysdeps/arm/dl-tls.h b/sysdeps/arm/dl-tls.h
+index 02285a7..694d11d 100644
+--- a/sysdeps/arm/dl-tls.h
++++ b/sysdeps/arm/dl-tls.h
+@@ -1,5 +1,5 @@
+ /* Thread-local storage handling in the ELF dynamic linker.  ARM version.
+-   Copyright (C) 2005 Free Software Foundation, Inc.
++   Copyright (C) 2005, 2011 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
+@@ -27,3 +27,6 @@ typedef struct dl_tls_index
+ 
+ 
+ extern void *__tls_get_addr (tls_index *ti);
++
++/* Value used for dtv entries for which the allocation is delayed.  */
++#define TLS_DTV_UNALLOCATED	((void *) -1l)
diff -ruN rpmbuild-orig/SOURCES/arm_mremap.patch rpmbuild/SOURCES/arm_mremap.patch
--- rpmbuild-orig/SOURCES/arm_mremap.patch	1970-01-01 01:00:00.000000000 +0100
+++ rpmbuild/SOURCES/arm_mremap.patch	2015-09-23 22:53:34.413711226 +0200
@@ -0,0 +1,87 @@
+From 2a26ef3a012cc29623423ca52c1cc8001d847d54 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <toscano.pino@tiscali.it>
+Date: Thu, 17 Jan 2013 21:08:12 +0100
+Subject: [PATCH] Add HAVE_MREMAP for mremap usage
+
+Introduce (only on Linux) and use a HAVE_MREMAP symbol to advertize mremap
+availability.
+
+Move the malloc-sysdep.h include from arena.c to malloc.c, since what is
+provided by malloc-sysdep.h is needed earlier in malloc.c, before the inclusion
+of arena.c.
+---
+ ChangeLog                               |  7 +++++++
+ malloc/arena.c                          |  3 ---
+ malloc/malloc.c                         | 12 ++++--------
+ sysdeps/unix/sysv/linux/malloc-sysdep.h |  2 ++
+ 4 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 0c77802..7d51a9d 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -19,9 +19,6 @@
+ 
+ #include <stdbool.h>
+ 
+-/* Get the implementation for check_may_shrink_heap.  */
+-#include <malloc-sysdep.h>
+-
+ /* Compile-time constants.  */
+ 
+ #define HEAP_MIN_SIZE (32*1024)
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 597c7b0..b4753e8 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -176,7 +176,7 @@
+     USE_MEMCPY                 1 if HAVE_MEMCPY is defined
+     HAVE_MMAP                  defined as 1
+     MMAP_CLEARS                1
+-    HAVE_MREMAP                0 unless linux defined
++    HAVE_MREMAP                0
+     USE_ARENAS                 the same as HAVE_MMAP
+     malloc_getpagesize         derived from system #includes, or 4096 if not
+     HAVE_USR_INCLUDE_MALLOC_H  NOT defined
+@@ -250,11 +250,13 @@
+ #if __STD_C
+ #include <stddef.h>   /* for size_t */
+ #include <stdlib.h>   /* for getenv(), abort() */
++#include <unistd.h>   /* for __libc_enable_secure */
+ #else
+ #include <sys/types.h>
+ #endif
+ 
+ #include <malloc-machine.h>
++#include <malloc-sysdep.h>
+ 
+ #ifdef _LIBC
+ #ifdef ATOMIC_FASTBINS
+@@ -744,14 +746,9 @@ extern Void_t*     sbrk();
+ */
+ 
+ #ifndef HAVE_MREMAP
+-#ifdef linux
+-#define HAVE_MREMAP 1
+-#else
+ #define HAVE_MREMAP 0
+ #endif
+ 
+-#endif /* HAVE_MMAP */
+-
+ /* Define USE_ARENAS to enable support for multiple `arenas'.  These
+    are allocated using mmap(), are necessary for threads and
+    occasionally useful to overcome address space limitations affecting
+diff --git a/sysdeps/unix/sysv/linux/malloc-sysdep.h b/sysdeps/unix/sysv/linux/malloc-sysdep.h
+index 0a876df..737ca0e 100644
+--- a/sysdeps/unix/sysv/linux/malloc-sysdep.h
++++ b/sysdeps/unix/sysv/linux/malloc-sysdep.h
+@@ -55,3 +55,5 @@ check_may_shrink_heap (void)
+ 
+   return may_shrink_heap;
+ }
++
++#define HAVE_MREMAP 1
+-- 
+1.9.4
+
diff -ruN rpmbuild-orig/SOURCES/arm_ucontext.patch rpmbuild/SOURCES/arm_ucontext.patch
--- rpmbuild-orig/SOURCES/arm_ucontext.patch	1970-01-01 01:00:00.000000000 +0100
+++ rpmbuild/SOURCES/arm_ucontext.patch	2015-09-23 22:55:40.273475554 +0200
@@ -0,0 +1,126 @@
+From: Peter Green <plugwash@p10link.net>
+Date: Tue, 20 Dec 2011 16:02:29 +0000 (+0000)
+Subject: Reduce ARM sys/ucontext.h namespace polution.
+X-Git-Tag: glibc-2.15~3
+X-Git-Url: https://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=c1e30fd8bffd53aa9849fe410ca8a4204c91f836
+
+Reduce ARM sys/ucontext.h namespace polution.
+---
+
+diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+index 9ecff7b..58f438c 100644
+--- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
++++ b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998, 1999, 2001, 2006 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 1999, 2001, 2006, 2011 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
+@@ -23,7 +23,6 @@
+ 
+ #include <features.h>
+ #include <signal.h>
+-#include <sys/procfs.h>
+ 
+ /* We need the signal context definitions even if they are not used
+    included in <signal.h>.  */
+@@ -35,47 +34,64 @@ typedef int greg_t;
+ #define NGREG	18
+ 
+ /* Container for all general registers.  */
+-typedef elf_gregset_t gregset_t;
++typedef greg_t gregset_t[NGREG];
+ 
+ /* Number of each register is the `gregset_t' array.  */
+ enum
+ {
+-  R0 = 0,
+-#define R0	R0
+-  R1 = 1,
+-#define R1	R1
+-  R2 = 2,
+-#define R2	R2
+-  R3 = 3,
+-#define R3	R3
+-  R4 = 4,
+-#define R4	R4
+-  R5 = 5,
+-#define R5	R5
+-  R6 = 6,
+-#define R6	R6
+-  R7 = 7,
+-#define R7	R7
+-  R8 = 8,
+-#define R8	R8
+-  R9 = 9,
+-#define R9	R9
+-  R10 = 10,
+-#define R10	R10
+-  R11 = 11,
+-#define R11	R11
+-  R12 = 12,
+-#define R12	R12
+-  R13 = 13,
+-#define R13	R13
+-  R14 = 14,
+-#define R14	R14
+-  R15 = 15
+-#define R15	R15
++  REG_R0 = 0,
++#define REG_R0	REG_R0
++  REG_R1 = 1,
++#define REG_R1	REG_R1
++  REG_R2 = 2,
++#define REG_R2	REG_R2
++  REG_R3 = 3,
++#define REG_R3	REG_R3
++  REG_R4 = 4,
++#define REG_R4	REG_R4
++  REG_R5 = 5,
++#define REG_R5	REG_R5
++  REG_R6 = 6,
++#define REG_R6	REG_R6
++  REG_R7 = 7,
++#define REG_R7	REG_R7
++  REG_R8 = 8,
++#define REG_R8	REG_R8
++  REG_R9 = 9,
++#define REG_R9	REG_R9
++  REG_R10 = 10,
++#define REG_R10	REG_R10
++  REG_R11 = 11,
++#define REG_R11	REG_R11
++  REG_R12 = 12,
++#define REG_R12	REG_R12
++  REG_R13 = 13,
++#define REG_R13	REG_R13
++  REG_R14 = 14,
++#define REG_R14	REG_R14
++  REG_R15 = 15
++#define REG_R15	REG_R15
+ };
+ 
++struct _libc_fpstate
++{
++  struct
++  {
++    unsigned int sign1:1;
++    unsigned int unused:15;
++    unsigned int sign2:1;
++    unsigned int exponent:14;
++    unsigned int j:1;
++    unsigned int mantissa1:31;
++    unsigned int mantissa0:32;
++  } fpregs[8];
++  unsigned int fpsr:32;
++  unsigned int fpcr:32;
++  unsigned char ftype[8];
++  unsigned int init_flag;
++};
+ /* Structure to describe FPU registers.  */
+-typedef elf_fpregset_t	fpregset_t;
++typedef struct _libc_fpstate fpregset_t;
+ 
+ /* Context to describe whole processor state.  This only describes
+    the core registers; coprocessor registers get saved elsewhere
Binary files rpmbuild-orig/SOURCES/glibc-ports-2.12-26-gcf64098.tar.xz and rpmbuild/SOURCES/glibc-ports-2.12-26-gcf64098.tar.xz differ
diff -ruN rpmbuild-orig/SOURCES/libresolv_link.patch rpmbuild/SOURCES/libresolv_link.patch
--- rpmbuild-orig/SOURCES/libresolv_link.patch	1970-01-01 01:00:00.000000000 +0100
+++ rpmbuild/SOURCES/libresolv_link.patch	2015-09-23 22:53:34.413711226 +0200
@@ -0,0 +1,32 @@
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Wed, 21 Sep 2011 20:27:50 +0000 (-0700)
+Subject: Link libresolv.so with ld.so for __stack_chk_guard.
+X-Git-Tag: glibc-2.15~281
+X-Git-Url: https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=e057a1b5930ec538c2b8abbba700a436ef2c81d5
+
+Link libresolv.so with ld.so for __stack_chk_guard.
+---
+
+diff --git a/resolv/Makefile b/resolv/Makefile
+index ec3788f..b4287de 100644
+--- a/resolv/Makefile
++++ b/resolv/Makefile
+@@ -1,4 +1,5 @@
+-# Copyright (C) 1994-2001,2003,2004,2007,2008 Free Software Foundation, Inc.
++# Copyright (C) 1994-2001,2003,2004,2007,2008,2011
++#	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
+@@ -88,6 +89,11 @@ CFLAGS-res_hconf.c = -fexceptions
+ # This ensures they will load libc.so for needed symbols if loaded by
+ # a statically-linked program that hasn't already loaded it.
+ $(objpfx)libresolv.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
++# Some hosts need '__stack_chk_guard', so pull in the definition from
++# ld.so if required.
++ifeq (yesyes,$(have-ssp)$(elf))
++LDLIBS-resolv.so += $(as-needed) $(elfobjdir)/ld.so $(no-as-needed)
++endif
+ 
+ # The DNS NSS modules needs the resolver.
+ $(objpfx)libnss_dns.so: $(objpfx)libresolv.so $(common-objpfx)libc.so \
diff -ruN rpmbuild-orig/SOURCES/tzupdate2.patch rpmbuild/SOURCES/tzupdate2.patch
--- rpmbuild-orig/SOURCES/tzupdate2.patch	1970-01-01 01:00:00.000000000 +0100
+++ rpmbuild/SOURCES/tzupdate2.patch	2015-09-23 22:53:34.413711226 +0200
@@ -0,0 +1,52 @@
+diff -up ./releng/tzdata-update.c.orig ./releng/tzdata-update.c
+--- ./releng/tzdata-update.c.orig	2010-11-05 21:04:06.000000000 -0400
++++ ./releng/tzdata-update.c	2010-11-05 21:04:22.000000000 -0400
+@@ -391,6 +391,35 @@ register void *__thread_self __asm ("g7"
+ 	   : inline_syscall_clobbers, "$20", "$21");		\
+ 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
+ }
++#elif defined __arm__ && defined __ARM_EABI__
++# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
++# define INTERNAL_SYSCALL(name, err, nr, args...)             \
++  ({                                                          \
++      register int _r0 __asm__("r0");                         \
++      register int _nr __asm__("r7");                         \
++      LOAD_ARGS_##nr(args)                                    \
++      _nr = __NR_##name;                                      \
++      asm volatile ("swi\t0\t@ syscall " #name "\n\t"         \
++      : "=r" (_r0)                                            \
++      : "r" (_nr) ASM_ARGS_##nr                               \
++      : "memory");                                            \
++      _r0; })
++# define INTERNAL_SYSCALL_ERROR_P(val, err) \
++  ((unsigned int) (val) >= 0xfffff001u)
++# define ASM_ARGS_0
++# define ASM_ARGS_1   , "r" (_r0)
++# define ASM_ARGS_2   , "r" (_r0), "r" (_r1)
++# define ASM_ARGS_3   , "r" (_r0), "r" (_r1), "r" (_r2)
++# define LOAD_ARGS_0()
++# define LOAD_ARGS_1(r0)                                      \
++      _r0 = (int)r0;
++# define LOAD_ARGS_2(r0, r1)                                  \
++      _r0 = (int)r0;                                          \
++      register int _r1 __asm__("r1") = (int)r1;
++# define LOAD_ARGS_3(r0, r1, r2)                              \
++      _r0 = (int)r0;                                          \
++      register int _r1 __asm__("r1") = (int)r1;               \
++      register int _r2 __asm__("r2") = (int)r2;
+ #endif
+ 
+ char buffer[32768], data[32768];
+@@ -563,6 +592,12 @@ void __libc_csu_fini (void) { }
+ pid_t __fork (void) { return -1; }
+ char thr_buf[65536];
+ 
++#if defined __arm__
++/* Prevent pulling in libc-start.o (which also defines
++ * __libc_start_main.)  */
++unsigned int __stack_chk_guard = ~0U;
++#endif
++
+ #ifndef __powerpc__
+ int __libc_start_main (int (*main) (int argc, char **argv),
+ 		       int argc, char **argv,
diff -ruN rpmbuild-orig/SPECS/glibc.spec rpmbuild/SPECS/glibc.spec
--- rpmbuild-orig/SPECS/glibc.spec	2015-08-26 13:03:12.000000000 +0200
+++ rpmbuild/SPECS/glibc.spec	2015-09-23 22:58:55.703114809 +0200
@@ -1,4 +1,5 @@
 %define glibcsrcdir glibc-2.12-2-gc4ccff1
+%define glibcportsdir  glibc-ports-2.12-26-gcf64098
 %define glibcversion 2.12
 %define glibcrelease 1.166%{?dist}.3
 %define run_glibc_tests 1
@@ -25,7 +26,7 @@
 Summary: The GNU libc libraries
 Name: glibc
 Version: %{glibcversion}
-Release: %{glibcrelease}
+Release: %{glibcrelease}.0
 # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
 # Things that are linked directly into dynamically linked programs
 # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@@ -36,6 +37,7 @@
 URL: http://sources.redhat.com/glibc/
 Source0: %{?glibc_release_url}%{glibcsrcdir}.tar.bz2
 Source1: %{glibcsrcdir}-releng.tar.bz2
+Source2: %{glibcportsdir}.tar.xz
 Patch0: %{name}-fedora.patch
 Patch1: %{name}-ia64-lib64.patch
 Patch2: glibc-rh587360.patch
@@ -244,6 +246,12 @@
 Patch211: glibc-rh1256890.patch
 Patch212: glibc-rh1256891.patch
 
+Patch10002: tzupdate2.patch
+Patch10003: libresolv_link.patch
+Patch10004: arm_mremap.patch
+Patch10005: arm_DTV.patch
+Patch10006: arm_ucontext.patch
+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Obsoletes: glibc-profile < 2.4
 Provides: ldconfig
@@ -388,7 +396,7 @@
 Group: System Environment/Daemons
 Requires: libselinux >= 1.17.10-1, audit-libs >= 1.1.3
 Requires: %{name} = %{version}-%{release}
-Requires(pre): /sbin/chkconfig, /usr/sbin/useradd, /usr/sbin/userdel, sh-utils
+Requires(pre): /sbin/chkconfig, /usr/sbin/useradd, /usr/sbin/userdel, coreutils
 
 %description -n nscd
 Nscd caches name service lookups and can dramatically improve
@@ -451,7 +459,8 @@
 %endif
 
 %prep
-%setup -q -n %{glibcsrcdir} -b1
+rm -rf %{glibcportsdir}
+%setup -q -n %{glibcsrcdir} -b1 -b2
 %patch0 -E -p1
 %ifarch ia64
 %if "%{_lib}" == "lib64"
@@ -664,6 +673,17 @@
 %patch211 -p1
 %patch212 -p1
 
+%ifarch %{arm}
+%patch10002 -p1
+%patch10003 -p1
+%patch10004 -p1
+pushd ../%{glibcportsdir}
+%patch10005 -p1
+%patch10006 -p1
+popd
+%endif
+
+
 # A lot of programs still misuse memcpy when they have to use
 # memmove. The memcpy implementation below is not tolerant at
 # all.
@@ -734,7 +754,13 @@
 GXX="g++ -m64"
 %endif
 
+#no-asynchronous-unwind needed for .init/.fini check to pass
+%ifarch %{arm}
+BuildFlags="$BuildFlags -fno-asynchronous-unwind-tables"
+%else
 BuildFlags="$BuildFlags -fasynchronous-unwind-tables"
+%endif
+
 # Add -DNDEBUG unless using a prerelease
 case %{version} in
   *.*.9[0-9]*) ;;
@@ -748,6 +774,15 @@
 %ifarch %{rtkaioarches}
 AddOns=,rtkaio$AddOns
 %endif
+%ifarch %{arm}
+AddOns=,../%{glibcportsdir}$AddOns
+#sed -i 's/-lgcc_eh//' Makeconfig
+%endif
+
+%ifarch %{arm}
+# -static-libgcc does not really work, __stach_chk_guard(libc.a) can not be found
+sed -i "s|libc_cv_gcc_static_libgcc=-static-libgcc|& -W,l:$PWD/build-armv5tel-linuxnptl/libc.a|" configure
+%endif
 
 build_nptl()
 {
@@ -760,8 +795,14 @@
 	--prefix=%{_prefix} \
 	--enable-add-ons=nptl$AddOns --without-cvs $EnableKernel \
 	--with-headers=%{_prefix}/include --enable-bind-now \
-	--with-tls --with-__thread --build %{nptl_target_cpu}-redhat-linux \
+	--with-tls --with-__thread \
+%ifarch %{arm}
+	--build %{nptl_target_cpu}-redhat-linux-gnueabi \
+	--host %{nptl_target_cpu}-redhat-linux-gnueabi \
+%else
+	--build %{nptl_target_cpu}-redhat-linux \
 	--host %{nptl_target_cpu}-redhat-linux \
+%endif
 %ifarch %{multiarcharches}
 	--enable-multi-arch \
 %endif
@@ -1464,6 +1505,15 @@
 %endif
 
 %changelog
+* Wed Sep 23 2015 Jacco Ligthart <jacco@redsleeve.org> - 2.12-1.166.3.0
+- Apply patches for ARM from F13
+- Apply updated tzdata patch (#708452)
+- Apply patch to make libresolv link
+- Spec patch to fix undefined reference to __stack_chk_guard (#726495)
+- Removed -fno-stack-protector from BuildFlags as it no longer needed
+- added two more patches to fix arm build
+- fix ucontext.h to enable building of FF and TB
+
 * Wed Aug 26 2015 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.12-1.166.3
 - Check for NULL arena pointer in _int_pvalloc (#1256890).
 - Don't change no_dyn_threshold on mallopt failure (#1256891).
