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	2014-09-04 01:34:20.602176533 +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	2014-09-04 01:30:50.091218516 +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	2014-08-26 19:04:03.000000000 +0200
+++ rpmbuild/SPECS/glibc.spec	2014-09-04 01:36:21.936965865 +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.132
 ### glibc.spec.in follows:
@@ -26,7 +27,7 @@
 Summary: The GNU libc libraries
 Name: glibc
 Version: %{glibcversion}
-Release: %{glibcrelease}%{?dist}.4
+Release: %{glibcrelease}%{?dist}.4.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
@@ -37,6 +38,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
@@ -193,6 +195,9 @@
 Patch159: glibc-rh1133809-1.patch
 Patch160: glibc-rh1133809-2.patch
 
+Patch10002: tzupdate2.patch
+Patch10003: libresolv_link.patch
+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Obsoletes: glibc-profile < 2.4
 Provides: ldconfig
@@ -337,7 +342,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
@@ -400,7 +405,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"
@@ -560,6 +566,11 @@
 %patch158 -p1
 %patch159 -p1
 %patch160 -p1
+%ifarch %{arm}
+%patch10002 -p1
+%patch10003 -p1
+%endif
+
 
 # A lot of programs still misuse memcpy when they have to use
 # memmove. The memcpy implementation below is not tolerant at
@@ -631,7 +642,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]*) ;;
@@ -645,6 +662,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()
 {
@@ -657,8 +683,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
