summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--config/binutils/binutils.in18
-rw-r--r--config/binutils/binutils.in.23
-rw-r--r--config/debug/gdb.in.gdbserver2
-rw-r--r--config/debug/gdb.in.native1
-rw-r--r--config/kernel/linux.in179
-rw-r--r--config/libc/glibc.in68
-rw-r--r--config/libc/glibc.in.249
-rw-r--r--patches/glibc/2.12.1/900-march-i686.patch34
-rw-r--r--patches/glibc/2.12.1/910-typedef-caddr.patch28
-rw-r--r--patches/glibc/2.12.1/920-make-382.patch15
-rw-r--r--patches/glibc/2.12.1/999-new-tools.patch69
-rw-r--r--patches/glibc/2.12.2/900-march-i686.patch34
-rw-r--r--patches/glibc/2.12.2/910-typedef-caddr.patch28
-rw-r--r--patches/glibc/2.12.2/999-new-tools.patch69
-rw-r--r--patches/glibc/2.13/900-march-i686.patch34
-rw-r--r--patches/glibc/2.13/910-typedef-caddr.patch28
-rw-r--r--patches/glibc/2.13/950-initfini-ppc64.patch20
-rw-r--r--patches/glibc/2.13/999-new-tools.patch69
-rw-r--r--patches/glibc/2.14.1/900-cpuid-include.patch628
-rw-r--r--patches/glibc/2.14.1/910-asm-i686.patch50
-rw-r--r--patches/glibc/2.14.1/950-initfini-ppc64.patch20
-rw-r--r--patches/glibc/2.14.1/999-new-tools.patch69
-rw-r--r--patches/glibc/2.14/900-cpuid-include.patch628
-rw-r--r--patches/glibc/2.14/950-initfini-ppc64.patch20
-rw-r--r--patches/glibc/2.14/999-new-tools.patch69
-rw-r--r--patches/glibc/2.15/900-cpuid-include.patch548
-rw-r--r--patches/glibc/2.15/910-asm-i686.patch50
-rw-r--r--patches/glibc/2.15/990-try-link-static.patch171
-rw-r--r--patches/glibc/2.15/991-builtin_expect.patch82
-rw-r--r--patches/glibc/2.15/992-gcc_s-suffix.patch108
-rw-r--r--patches/glibc/2.15/999-new-tools.patch69
-rw-r--r--patches/glibc/2.16.0/500-fix-parsing-of-numeric-hosts-in-gethostbyname_r.patch222
-rw-r--r--patches/glibc/2.16.0/999-new-tools.patch33
-rw-r--r--patches/glibc/2.17/100-Fix-ARM-build-with-GCC-trunk.patch54
-rw-r--r--patches/glibc/2.17/120-support-make4.patch38
-rw-r--r--patches/glibc/ports-2.12.1/090-Fix-ARM-build-with-GCC-trunk.patch72
-rw-r--r--patches/glibc/ports-2.12.1/100-respect-env-CPPFLAGS.patch25
-rw-r--r--patches/glibc/ports-2.12.1/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.12.1/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.12.1/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.12.1/160-manual-no-perl.patch24
-rw-r--r--patches/glibc/ports-2.12.1/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.12.1/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.12.1/190-localedef-mmap.patch39
-rw-r--r--patches/glibc/ports-2.12.1/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.12.1/220-section-comments.patch24
-rw-r--r--patches/glibc/ports-2.12.1/230-no-inline-gmon.patch36
-rw-r--r--patches/glibc/ports-2.12.1/240-check_native-headers.patch17
-rw-r--r--patches/glibc/ports-2.12.1/250-fix-pr631.patch45
-rw-r--r--patches/glibc/ports-2.12.1/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.12.1/270-china.patch32
-rw-r--r--patches/glibc/ports-2.12.1/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.12.1/300-nscd-one-fork.patch40
-rw-r--r--patches/glibc/ports-2.12.1/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.12.1/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.12.1/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.12.1/370-fnmatch.patch62
-rw-r--r--patches/glibc/ports-2.12.1/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.12.1/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.12.1/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.12.1/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.12.1/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.12.1/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.12.1/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.12.1/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.12.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch374
-rw-r--r--patches/glibc/ports-2.12.1/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.12.1/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.12.1/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.12.1/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.12.1/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.12.1/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--patches/glibc/ports-2.13/090-Fix-ARM-build-with-GCC-trunk.patch72
-rw-r--r--patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch14
-rw-r--r--patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.13/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.13/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.13/160-manual-no-perl.patch24
-rw-r--r--patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.13/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.13/190-localedef-mmap.patch39
-rw-r--r--patches/glibc/ports-2.13/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.13/220-section-comments.patch24
-rw-r--r--patches/glibc/ports-2.13/230-no-inline-gmon.patch36
-rw-r--r--patches/glibc/ports-2.13/240-check_native-headers.patch17
-rw-r--r--patches/glibc/ports-2.13/250-fix-pr631.patch45
-rw-r--r--patches/glibc/ports-2.13/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.13/270-china.patch32
-rw-r--r--patches/glibc/ports-2.13/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.13/300-nscd-one-fork.patch40
-rw-r--r--patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.13/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.13/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.13/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch19
-rw-r--r--patches/glibc/ports-2.13/420-alpha-statfs.patch29
-rw-r--r--patches/glibc/ports-2.13/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.13/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch23
-rw-r--r--patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.13/470-alpha-feupdateenv.patch26
-rw-r--r--patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.13/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch374
-rw-r--r--patches/glibc/ports-2.13/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.13/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.13/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.13/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--patches/glibc/ports-2.14.1/090-Fix-ARM-build-with-GCC-trunk.patch72
-rw-r--r--patches/glibc/ports-2.14.1/100-respect-env-CPPFLAGS.patch14
-rw-r--r--patches/glibc/ports-2.14.1/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.14.1/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.14.1/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.14.1/160-manual-no-perl.patch24
-rw-r--r--patches/glibc/ports-2.14.1/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.14.1/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.14.1/190-localedef-mmap.patch39
-rw-r--r--patches/glibc/ports-2.14.1/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.14.1/220-section-comments.patch24
-rw-r--r--patches/glibc/ports-2.14.1/230-no-inline-gmon.patch36
-rw-r--r--patches/glibc/ports-2.14.1/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.14.1/270-china.patch32
-rw-r--r--patches/glibc/ports-2.14.1/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.14.1/300-nscd-one-fork.patch40
-rw-r--r--patches/glibc/ports-2.14.1/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.14.1/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.14.1/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.14.1/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.14.1/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.14.1/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.14.1/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.14.1/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.14.1/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.14.1/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.14.1/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.14.1/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.14.1/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.14.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch374
-rw-r--r--patches/glibc/ports-2.14.1/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.14.1/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.14.1/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.14.1/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.14.1/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.14.1/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--patches/glibc/ports-2.14/090-Fix-ARM-build-with-GCC-trunk.patch72
-rw-r--r--patches/glibc/ports-2.14/100-respect-env-CPPFLAGS.patch14
-rw-r--r--patches/glibc/ports-2.14/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.14/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.14/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.14/160-manual-no-perl.patch24
-rw-r--r--patches/glibc/ports-2.14/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.14/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.14/190-localedef-mmap.patch39
-rw-r--r--patches/glibc/ports-2.14/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.14/220-section-comments.patch24
-rw-r--r--patches/glibc/ports-2.14/230-no-inline-gmon.patch36
-rw-r--r--patches/glibc/ports-2.14/240-check_native-headers.patch17
-rw-r--r--patches/glibc/ports-2.14/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.14/270-china.patch32
-rw-r--r--patches/glibc/ports-2.14/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.14/300-nscd-one-fork.patch40
-rw-r--r--patches/glibc/ports-2.14/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.14/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.14/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.14/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.14/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.14/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.14/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.14/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.14/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.14/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.14/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.14/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.14/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.14/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch374
-rw-r--r--patches/glibc/ports-2.14/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.14/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.14/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.14/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.14/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.14/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--patches/glibc/ports-2.15/090-Fix-ARM-build-with-GCC-trunk.patch72
-rw-r--r--patches/glibc/ports-2.15/091-libmemusage-link-failure.patch19
-rw-r--r--patches/glibc/ports-2.15/100-respect-env-CPPFLAGS.patch14
-rw-r--r--patches/glibc/ports-2.15/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.15/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.15/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.15/160-manual-no-perl.patch24
-rw-r--r--patches/glibc/ports-2.15/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.15/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.15/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.15/220-section-comments.patch24
-rw-r--r--patches/glibc/ports-2.15/230-no-inline-gmon.patch36
-rw-r--r--patches/glibc/ports-2.15/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.15/270-china.patch32
-rw-r--r--patches/glibc/ports-2.15/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.15/300-nscd-one-fork.patch40
-rw-r--r--patches/glibc/ports-2.15/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.15/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.15/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.15/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.15/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.15/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.15/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.15/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.15/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.15/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.15/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.15/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.15/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.15/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch374
-rw-r--r--patches/glibc/ports-2.15/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.15/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.15/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.15/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.15/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.15/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--patches/glibc/ports-2.16.0/090-Fix-ARM-build-with-GCC-trunk.patch54
-rw-r--r--patches/glibc/ports-2.16.0/100-respect-env-CPPFLAGS.patch14
-rw-r--r--patches/glibc/ports-2.16.0/120-i386-x86_64-revert-clone-cfi.patch55
-rw-r--r--patches/glibc/ports-2.16.0/140-disable-ldconfig.patch16
-rw-r--r--patches/glibc/ports-2.16.0/150-queue-header-updates.patch85
-rw-r--r--patches/glibc/ports-2.16.0/170-localedef-fix-trampoline.patch69
-rw-r--r--patches/glibc/ports-2.16.0/180-resolv-dynamic.patch39
-rw-r--r--patches/glibc/ports-2.16.0/200-fadvise64_64.patch28
-rw-r--r--patches/glibc/ports-2.16.0/260-assume-pipe2.patch40
-rw-r--r--patches/glibc/ports-2.16.0/270-china.patch32
-rw-r--r--patches/glibc/ports-2.16.0/280-new-valencian-locale.patch115
-rw-r--r--patches/glibc/ports-2.16.0/300-nscd-one-fork.patch43
-rw-r--r--patches/glibc/ports-2.16.0/310-hppa-nptl-carlos.patch246
-rw-r--r--patches/glibc/ports-2.16.0/330-m68k-sys-user.patch97
-rw-r--r--patches/glibc/ports-2.16.0/340-dl_execstack-PaX-support.patch66
-rw-r--r--patches/glibc/ports-2.16.0/350-pre20040117-pt_pax.patch32
-rw-r--r--patches/glibc/ports-2.16.0/360-tests-sandbox-libdl-paths.patch193
-rw-r--r--patches/glibc/ports-2.16.0/380-dont-build-timezone.patch14
-rw-r--r--patches/glibc/ports-2.16.0/400-alpha-xstat.patch15
-rw-r--r--patches/glibc/ports-2.16.0/430-alpha-creat.patch14
-rw-r--r--patches/glibc/ports-2.16.0/440-alpha-cache-shape.patch13
-rw-r--r--patches/glibc/ports-2.16.0/460-alpha-fix-gcc-4.1-warnings.patch56
-rw-r--r--patches/glibc/ports-2.16.0/490-alpha_alpha-add-fdatasync-support.patch126
-rw-r--r--patches/glibc/ports-2.16.0/530-alpha-fix-rtld-fPIC.patch21
-rw-r--r--patches/glibc/ports-2.16.0/560-ppc-atomic.patch415
-rw-r--r--patches/glibc/ports-2.16.0/580-nptl-lowlevellock.patch23
-rw-r--r--patches/glibc/ports-2.16.0/610-fpu-cw-mips.patch15
-rw-r--r--patches/glibc/ports-2.16.0/630-mips_shn_undef-hack.patch16
-rw-r--r--patches/glibc/ports-2.16.0/640-alpha-atfcts.patch12
-rw-r--r--patches/glibc/ports-2.16.0/650-syslog.patch12
-rw-r--r--patches/glibc/ports-2.16.0/660-debug-readlink_chk-readklinkat_chk.patch24
-rw-r--r--samples/armv6-nommu-linux-uclibcgnueabi/crosstool.config8
-rw-r--r--samples/i686-centos6-linux-gnu/crosstool.config9
-rw-r--r--samples/i686-centos6-linux-gnu/reported.by3
-rw-r--r--samples/i686-centos7-linux-gnu/crosstool.config9
-rw-r--r--samples/i686-centos7-linux-gnu/reported.by3
-rw-r--r--samples/i686-ubuntu12.04-linux-gnu/crosstool.config9
-rw-r--r--samples/i686-ubuntu12.04-linux-gnu/reported.by3
-rw-r--r--samples/i686-ubuntu14.04-linux-gnu/crosstool.config9
-rw-r--r--samples/i686-ubuntu14.04-linux-gnu/reported.by3
-rw-r--r--samples/i686-ubuntu16.04-linux-gnu/crosstool.config9
-rw-r--r--samples/i686-ubuntu16.04-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-centos6-linux-gnu/crosstool.config9
-rw-r--r--samples/x86_64-centos6-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-centos7-linux-gnu/crosstool.config9
-rw-r--r--samples/x86_64-centos7-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-ubuntu12.04-linux-gnu/crosstool.config9
-rw-r--r--samples/x86_64-ubuntu12.04-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-ubuntu14.04-linux-gnu/crosstool.config9
-rw-r--r--samples/x86_64-ubuntu14.04-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-ubuntu16.04-linux-gnu/crosstool.config9
-rw-r--r--samples/x86_64-ubuntu16.04-linux-gnu/reported.by3
-rw-r--r--scripts/build/debug/300-gdb.sh10
-rw-r--r--scripts/build/libc/glibc.sh64
280 files changed, 18609 insertions, 53 deletions
diff --git a/README.md b/README.md
index 778243f..2328672 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ With crosstool-NG, you can learn precisely how each component is configured and
crosstool-NG can build from generic, general purpose toolchains, to very specific and dedicated toolchains. Simply fill in specific values in the adequate options.
-Of course, it doesn't prevent you from doing your home work first. You have to know with some degree of exactitude what your target is (archictecture, processor variant), what it will be used for (embedded, desktop, realtime), what degree of confidence you have with each component (stability, maintainability), and so on…
+Of course, it doesn't prevent you from doing your home work first. You have to know with some degree of exactitude what your target is (architecture, processor variant), what it will be used for (embedded, desktop, realtime), what degree of confidence you have with each component (stability, maintainability), and so on…
## Features
diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in
index e66c972..695256a 100644
--- a/config/binutils/binutils.in
+++ b/config/binutils/binutils.in
@@ -178,10 +178,14 @@ config BINUTILS_HAS_PLUGINS
config BINUTILS_HAS_PKGVERSION_BUGURL
bool
-# Force using the BFD linker if needed
-# This is the case for some C libraries (eg. glibc at least) and affected
-# components can select this
-config BINUTILS_FORCE_LD_BFD
+# Force using the BFD linker if needed. There are two options:
+# - For some C libraries (eg. glibc at least), BFD ld must be
+# built and be selected by default.
+# - For elf2flt, BFD ld must be the only linker built.
+config BINUTILS_FORCE_LD_BFD_DEFAULT
+ bool
+
+config BINUTILS_FORCE_LD_BFD_ONLY
bool
choice
@@ -198,7 +202,7 @@ config BINUTILS_LINKER_GOLD
bool
prompt "gold"
depends on BINUTILS_GOLD_SUPPORT
- depends on ! BINUTILS_FORCE_LD_BFD
+ depends on !BINUTILS_FORCE_LD_BFD_DEFAULT && !BINUTILS_FORCE_LD_BFD_ONLY
select BINUTILS_GOLD_INSTALLED
help
gold is a new, optimised, multi-threaded linker with support
@@ -209,6 +213,7 @@ config BINUTILS_LINKER_GOLD
config BINUTILS_LINKER_LD_GOLD
bool
prompt "ld, gold"
+ depends on !BINUTILS_FORCE_LD_BFD_ONLY
depends on BINUTILS_GOLD_SUPPORT
select BINUTILS_GOLD_INSTALLED
select BINUTILS_LINKER_BOTH
@@ -221,10 +226,11 @@ config BINUTILS_LINKER_LD_GOLD
config BINUTILS_LINKER_GOLD_LD
bool
prompt "gold, ld"
+ depends on !BINUTILS_FORCE_LD_BFD_ONLY
depends on BINUTILS_GOLD_SUPPORT
select BINUTILS_GOLD_INSTALLED
select BINUTILS_LINKER_BOTH
- select BINUTILS_LD_WRAPPER if BINUTILS_FORCE_LD_BFD
+ select BINUTILS_LD_WRAPPER if BINUTILS_FORCE_LD_BFD_DEFAULT
help
Both the historical ld and the new gold linkers will be
installed, with gold being the default linker used.
diff --git a/config/binutils/binutils.in.2 b/config/binutils/binutils.in.2
index 78c2a88..227f3d8 100644
--- a/config/binutils/binutils.in.2
+++ b/config/binutils/binutils.in.2
@@ -2,9 +2,10 @@
if ARCH_BINFMT_FLAT
-config ELF2FLT_REQUIRES_ZLIB
+config ELF2FLT_REQUIRES
def_bool y
select ZLIB
+ select BINUTILS_FORCE_LD_BFD_ONLY
comment "elf2flt"
diff --git a/config/debug/gdb.in.gdbserver b/config/debug/gdb.in.gdbserver
index feb3a0d..2f5576b 100644
--- a/config/debug/gdb.in.gdbserver
+++ b/config/debug/gdb.in.gdbserver
@@ -3,8 +3,8 @@
config GDB_GDBSERVER
bool
prompt "gdbserver"
+ default y
depends on ! BARE_METAL
- depends on CC_LANG_CXX || !GDB_7_12_or_later
help
Build and install a gdbserver for the target, to run on the target.
diff --git a/config/debug/gdb.in.native b/config/debug/gdb.in.native
index 634b13b..915debd 100644
--- a/config/debug/gdb.in.native
+++ b/config/debug/gdb.in.native
@@ -5,7 +5,6 @@ config GDB_NATIVE
prompt "Native gdb"
depends on ! BARE_METAL
depends on ! BACKEND
- depends on CC_LANG_CXX || !GDB_7_12_or_later
select EXPAT_TARGET
select NCURSES_TARGET
help
diff --git a/config/kernel/linux.in b/config/kernel/linux.in
index 940d92e..0886f4c 100644
--- a/config/kernel/linux.in
+++ b/config/kernel/linux.in
@@ -38,6 +38,11 @@ endif # KERNEL_LINUX_CUSTOM
if ! KERNEL_LINUX_CUSTOM
+# GLIBC and kernel are special when it comes to obsoletion. Users
+# of crosstool-ng depend on the ability to build new toolchains matching
+# the kernel/libc versions of a particular target system, and LTS releases
+# are still using quite ancient versions. Please do not retire versions
+# (including versions in between) until the EOL dates indicated below.
choice
bool
prompt "Linux kernel version"
@@ -53,38 +58,184 @@ config KERNEL_V_4_8
prompt "4.8.17 (EOL)"
depends on OBSOLETE
+config KERNEL_V_4_7
+ bool
+ prompt "4.7.10 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_4_6
+ bool
+ prompt "4.6.7 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_4_5
+ bool
+ prompt "4.5.7 (EOL)"
+ depends on OBSOLETE
+
+# EOL 04/2021 [Ubuntu16.04]
config KERNEL_V_4_4
bool
prompt "4.4.47"
+config KERNEL_V_4_3
+ bool
+ prompt "4.3.6 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_4_2
+ bool
+ prompt "4.2.8 (EOL)"
+ depends on OBSOLETE
+
config KERNEL_V_4_1
bool
prompt "4.1.38"
+config KERNEL_V_4_0
+ bool
+ prompt "4.0.9 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_19
+ bool
+ prompt "3.19.8 (EOL)"
+ depends on OBSOLETE
+
config KERNEL_V_3_18
bool
prompt "3.18.47 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_17
+ bool
+ prompt "3.17.8 (EOL)"
+ depends on OBSOLETE
config KERNEL_V_3_16
bool
prompt "3.16.39"
+config KERNEL_V_3_15
+ bool
+ prompt "3.15.10 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_14
+ bool
+ prompt "3.14.79 (EOL)"
+ depends on OBSOLETE
+
+# EOL 04/2019 [Ubuntu14.04]
+config KERNEL_V_3_13
+ bool
+ prompt "3.13.11 (EOL)"
+ depends on OBSOLETE
+
config KERNEL_V_3_12
bool
prompt "3.12.70"
+config KERNEL_V_3_11
+ bool
+ prompt "3.11.10 (EOL)"
+ depends on OBSOLETE
+
+# EOL 06/2024 [CentOS7.x]
config KERNEL_V_3_10
bool
prompt "3.10.104"
+config KERNEL_V_3_9
+ bool
+ prompt "3.9.11 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_8
+ bool
+ prompt "3.8.13 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_7
+ bool
+ prompt "3.7.10 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_6
+ bool
+ prompt "3.6.11 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_5
+ bool
+ prompt "3.5.7 (EOL)"
+ depends on OBSOLETE
+
config KERNEL_V_3_4
bool
prompt "3.4.113"
+config KERNEL_V_3_3
+ bool
+ prompt "3.3.8 (EOL)"
+ depends on OBSOLETE
+
+# EOL 04/2017 [Ubuntu12.04]
config KERNEL_V_3_2
bool
prompt "3.2.84"
+config KERNEL_V_3_1
+ bool
+ prompt "3.1.10 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_3_0
+ bool
+ prompt "3.0.101 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_39
+ bool
+ prompt "2.6.39.4 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_38
+ bool
+ prompt "2.6.38.8 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_37
+ bool
+ prompt "2.6.37.6 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_36
+ bool
+ prompt "2.6.36.4 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_35
+ bool
+ prompt "2.6.35.9 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_34
+ bool
+ prompt "2.6.34.7 (EOL)"
+ depends on OBSOLETE
+
+config KERNEL_V_2_6_33
+ bool
+ prompt "2.6.33.7 (EOL)"
+ depends on OBSOLETE
+
+# EOL 11/2020 [CentOS6.x]
+config KERNEL_V_2_6_32
+ bool
+ prompt "2.6.32.27 (EOL)"
+ depends on OBSOLETE
+
endchoice
config KERNEL_VERSION
@@ -93,13 +244,41 @@ config KERNEL_VERSION
# CT_INSERT_VERSION_STRING_BELOW
default "4.9.8" if KERNEL_V_4_9
default "4.8.17" if KERNEL_V_4_8
+ default "4.7.10" if KERNEL_V_4_7
+ default "4.6.7" if KERNEL_V_4_6
+ default "4.5.7" if KERNEL_V_4_5
default "4.4.47" if KERNEL_V_4_4
+ default "4.3.6" if KERNEL_V_4_3
+ default "4.2.8" if KERNEL_V_4_2
default "4.1.38" if KERNEL_V_4_1
+ default "4.0.9" if KERNEL_V_4_0
+ default "3.19.8" if KERNEL_V_3_19
default "3.18.47" if KERNEL_V_3_18
+ default "3.17.8" if KERNEL_V_3_17
default "3.16.39" if KERNEL_V_3_16
+ default "3.15.10" if KERNEL_V_3_15
+ default "3.14.79" if KERNEL_V_3_14
+ default "3.13.11" if KERNEL_V_3_13
default "3.12.70" if KERNEL_V_3_12
+ default "3.11.10" if KERNEL_V_3_11
default "3.10.104" if KERNEL_V_3_10
+ default "3.9.11" if KERNEL_V_3_9
+ default "3.8.13" if KERNEL_V_3_8
+ default "3.7.10" if KERNEL_V_3_7
+ default "3.6.11" if KERNEL_V_3_6
+ default "3.5.7" if KERNEL_V_3_5
default "3.4.113" if KERNEL_V_3_4
+ default "3.3.8" if KERNEL_V_3_3
default "3.2.84" if KERNEL_V_3_2
+ default "3.1.10" if KERNEL_V_3_1
+ default "3.0.101" if KERNEL_V_3_0
+ default "2.6.39.4" if KERNEL_V_2_6_39
+ default "2.6.38.8" if KERNEL_V_2_6_38
+ default "2.6.37.6" if KERNEL_V_2_6_37
+ default "2.6.36.4" if KERNEL_V_2_6_36
+ default "2.6.35.9" if KERNEL_V_2_6_35
+ default "2.6.34.7" if KERNEL_V_2_6_34
+ default "2.6.33.7" if KERNEL_V_2_6_33
+ default "2.6.32.27" if KERNEL_V_2_6_32
endif # ! KERNEL_LINUX_CUSTOM
diff --git a/config/libc/glibc.in b/config/libc/glibc.in
index 767cbbf..9e4ff56 100644
--- a/config/libc/glibc.in
+++ b/config/libc/glibc.in
@@ -65,6 +65,11 @@ config CC_GLIBC_SHOW_LINARO
Linaro: http://www.linaro.org/
+# GLIBC and kernel are special when it comes to obsoletion. Users
+# of crosstool-ng depend on the ability to build new toolchains matching
+# the kernel/libc versions of a particular target system, and LTS releases
+# are still using quite ancient versions. Please do not retire versions
+# (including versions in between) until the EOL dates indicated below.
choice
bool
prompt "glibc version"
@@ -81,6 +86,7 @@ config LIBC_GLIBC_V_2_24
prompt "2.24"
select LIBC_GLIBC_2_23_or_later
+# EOL 04/2021 [Ubuntu16.04]
config LIBC_GLIBC_V_2_23
bool
prompt "2.23"
@@ -111,15 +117,64 @@ config LIBC_GLIBC_V_2_20
select LIBC_GLIBC_2_20_or_later
depends on OBSOLETE
+# EOL 04/2019 [Ubuntu14.04]
config LIBC_GLIBC_V_2_19
bool
prompt "2.19 (OBSOLETE)"
depends on OBSOLETE
+ select LIBC_GLIBC_2_17_or_later
config LIBC_GLIBC_V_2_18
bool
prompt "2.18 (OBSOLETE)"
depends on OBSOLETE
+ select LIBC_GLIBC_2_17_or_later
+
+# EOL 06/2024 [CentOS7.x]
+config LIBC_GLIBC_V_2_17
+ bool
+ prompt "2.17 (OBSOLETE)"
+ depends on OBSOLETE
+ select LIBC_GLIBC_2_17_or_later
+
+config LIBC_GLIBC_V_2_16_0
+ bool
+ prompt "2.16.0 (OBSOLETE)"
+ depends on OBSOLETE
+
+# EOL 04/2017 [Ubuntu12.04]
+config LIBC_GLIBC_V_2_15
+ bool
+ prompt "2.15 (OBSOLETE)"
+ depends on OBSOLETE
+
+config LIBC_GLIBC_V_2_14_1
+ bool
+ prompt "2.14.1 (OBSOLETE)"
+ depends on OBSOLETE
+
+config LIBC_GLIBC_V_2_14
+ bool
+ prompt "2.14 (OBSOLETE)"
+ depends on OBSOLETE
+
+config LIBC_GLIBC_V_2_13
+ bool
+ prompt "2.13 (OBSOLETE)"
+ depends on OBSOLETE
+
+# This version did not have glibc-ports addon released
+config LIBC_GLIBC_V_2_12_2
+ bool
+ prompt "2.12.2 (OBSOLETE)"
+ depends on OBSOLETE
+ depends on !LIBC_GLIBC_NEEDS_PORTS
+
+# EOL 11/2020 [CentOS6.x]
+config LIBC_GLIBC_V_2_12_1
+ bool
+ prompt "2.12.1 (OBSOLETE)"
+ depends on OBSOLETE
endchoice
@@ -134,6 +189,11 @@ config LIBC_GLIBC_2_23_or_later
# It is no longer possible to build glibc without pthread!
config LIBC_GLIBC_2_20_or_later
bool
+ select LIBC_GLIBC_2_17_or_later
+
+# DeMark no more ports
+config LIBC_GLIBC_2_17_or_later
+ bool
if ! LIBC_GLIBC_CUSTOM
@@ -150,5 +210,13 @@ config LIBC_VERSION
default "2.20" if LIBC_GLIBC_V_2_20
default "2.19" if LIBC_GLIBC_V_2_19
default "2.18" if LIBC_GLIBC_V_2_18
+ default "2.17" if LIBC_GLIBC_V_2_17
+ default "2.16.0" if LIBC_GLIBC_V_2_16_0
+ default "2.15" if LIBC_GLIBC_V_2_15
+ default "2.14.1" if LIBC_GLIBC_V_2_14_1
+ default "2.14" if LIBC_GLIBC_V_2_14
+ default "2.13" if LIBC_GLIBC_V_2_13
+ default "2.12.2" if LIBC_GLIBC_V_2_12_2
+ default "2.12.1" if LIBC_GLIBC_V_2_12_1
endif # ! LIBC_GLIBC_CUSTOM
diff --git a/config/libc/glibc.in.2 b/config/libc/glibc.in.2
index 104552a..9d3c2e1 100644
--- a/config/libc/glibc.in.2
+++ b/config/libc/glibc.in.2
@@ -5,22 +5,25 @@
# This list must be carefully in sync with the architectures names
# we can find in config/arch/*
+# Ports were integrated into the main tarball in 2.17
config LIBC_GLIBC_PORTS_EXTERNAL
- bool
- default n
+ def_bool y
+ depends on !LIBC_GLIBC_2_17_or_later
-config LIBC_GLIBC_MAY_FORCE_PORTS
- bool
- default y if ARCH_arm
- default y if ARCH_mips
- select LIBC_GLIBC_USE_PORTS
- depends on !LIBC_GLIBC_2_20_or_later
+config LIBC_GLIBC_NEEDS_PORTS
+ def_bool y
+ depends on ARCH_alpha || ARCH_arm || ARCH_m68k || ARCH_mips || ARCH_powerpc
+
+# Ports are no longer an add-on starting with 2.20
+config LIBC_GLIBC_USE_PORTS
+ def_bool y
+ depends on LIBC_GLIBC_NEEDS_PORTS && !LIBC_GLIBC_2_20_or_later
# Force using the BFD linker during the toolchain build
-config LIBC_glibc_familly
+config LIBC_glibc_family
bool
default y
- select BINUTILS_FORCE_LD_BFD
+ select BINUTILS_FORCE_LD_BFD_DEFAULT
config LIBC_GLIBC_EXTRA_CONFIG_ARRAY
string
@@ -109,19 +112,6 @@ config LIBC_GLIBC_FORCE_UNWIND
of glibc on some architectures
(seen on s390, s390x and x86_64).
-config LIBC_GLIBC_USE_PORTS
- bool
- prompt "Use the ports addon"
- depends on !LIBC_GLIBC_2_20_or_later
- help
- The ports addon contains some architecture ports that are not available
- in the official distribution.
-
- For example, this is the case for ARM with glibc-2.4 and above.
-
- Say n only if you're sure that your architecture is in the official
- distribution for your chosen version.
-
config LIBC_ADDONS_LIST
string
prompt "Extra addons"
@@ -131,17 +121,12 @@ config LIBC_ADDONS_LIST
You need to specify neither linuxthreads nor nptl, as they are added
automagically for you depending on the threading model you chose
- earlier.
+ earlier and on libc version selected.
- Eg.: crypt (for very old libces)
+ Also, do not specify ports even if applicable to the selected libc
+ version/architecture; it is selected automatically.
-if LIBC_GLIBC_USE_PORTS || ( LIBC_ADDONS_LIST != "" )
-comment "WARNING !!! "
-comment "| For glibc >= 2.8, it can happen that the tarballs "
-comment "| for the addons are not available for download. "
-comment "| If that happens, bad luck... Try a previous version "
-comment "| or try again later... :-( "
-endif
+ Eg.: libidn
config LIBC_LOCALES
bool
diff --git a/patches/glibc/2.12.1/900-march-i686.patch b/patches/glibc/2.12.1/900-march-i686.patch
new file mode 100644
index 0000000..7f5b1ce
--- /dev/null
+++ b/patches/glibc/2.12.1/900-march-i686.patch
@@ -0,0 +1,34 @@
+2007-02-15 Khem Raj <kraj@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
+ * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
+
+diff -urN glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c 2010-12-30 11:36:19.858708534 +0100
+@@ -45,6 +45,11 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
++asm ("\n#undef __i686");
++asm ("\n#define __i686 __i686");
++asm ("\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -urN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-12-30 11:36:19.858708534 +0100
+@@ -29,6 +29,10 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
diff --git a/patches/glibc/2.12.1/910-typedef-caddr.patch b/patches/glibc/2.12.1/910-typedef-caddr.patch
new file mode 100644
index 0000000..e29e810
--- /dev/null
+++ b/patches/glibc/2.12.1/910-typedef-caddr.patch
@@ -0,0 +1,28 @@
+diff -urN glibc-2.12.1-orig/posix/sys/types.h glibc-2.12.1/posix/sys/types.h
+--- glibc-2.12.1-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.1/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
+@@ -114,7 +114,10 @@
+ #ifdef __USE_BSD
+ # ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ # endif
+ #endif
+diff -urN glibc-2.12.1-orig/sunrpc/rpc/types.h glibc-2.12.1/sunrpc/rpc/types.h
+--- glibc-2.12.1-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.1/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
+@@ -80,7 +80,10 @@
+ #endif
+ #ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ #endif
+
diff --git a/patches/glibc/2.12.1/920-make-382.patch b/patches/glibc/2.12.1/920-make-382.patch
new file mode 100644
index 0000000..28be2fe
--- /dev/null
+++ b/patches/glibc/2.12.1/920-make-382.patch
@@ -0,0 +1,15 @@
+http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=blob_plain;f=source/base/glibc/make-3.82-fix.patch;hb=8217c32ecc2e14962847ba3d8a272eb64a3dba4f
+
+--- glibc-2.10.1.OLD/manual/Makefile
++++ glibc-2.10.1.NEW/manual/Makefile
+@@ -232,7 +232,9 @@
+ .PHONY: stubs
+ stubs: $(objpfx)stubs
+ endif
+-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
++$(objpfx)stubs ../po/manual.pot:
++ touch $@
++$(objpfx)stamp%:
+ $(make-target-directory)
+ touch $@
+
diff --git a/patches/glibc/2.12.1/999-new-tools.patch b/patches/glibc/2.12.1/999-new-tools.patch
new file mode 100644
index 0000000..d600b58
--- /dev/null
+++ b/patches/glibc/2.12.1/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.12.1.orig/configure glibc-2.12.1/configure
+--- glibc-2.12.1.orig/configure 2010-07-27 04:34:39.000000000 -0700
++++ glibc-2.12.1/configure 2017-02-08 00:37:58.117495908 -0800
+@@ -5079,7 +5079,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5142,7 +5142,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5269,7 +5269,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5329,7 +5329,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:$LINENO: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.12.1.orig/configure.in glibc-2.12.1/configure.in
+--- glibc-2.12.1.orig/configure.in 2010-07-27 04:34:39.000000000 -0700
++++ glibc-2.12.1/configure.in 2017-02-08 00:28:47.131374866 -0800
+@@ -960,11 +960,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -972,10 +972,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.12.2/900-march-i686.patch b/patches/glibc/2.12.2/900-march-i686.patch
new file mode 100644
index 0000000..6030de9
--- /dev/null
+++ b/patches/glibc/2.12.2/900-march-i686.patch
@@ -0,0 +1,34 @@
+2007-02-15 Khem Raj <kraj@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
+ * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
+
+diff -urN glibc-2.12.2.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.2/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2.12.2.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.2/nptl/sysdeps/pthread/pt-initfini.c 2010-12-30 11:36:19.858708534 +0100
+@@ -45,6 +45,11 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
++asm ("\n#undef __i686");
++asm ("\n#define __i686 __i686");
++asm ("\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -urN glibc-2.12.2.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.2/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.12.2.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.2/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-12-30 11:36:19.858708534 +0100
+@@ -29,6 +29,10 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
diff --git a/patches/glibc/2.12.2/910-typedef-caddr.patch b/patches/glibc/2.12.2/910-typedef-caddr.patch
new file mode 100644
index 0000000..4bc75cb
--- /dev/null
+++ b/patches/glibc/2.12.2/910-typedef-caddr.patch
@@ -0,0 +1,28 @@
+diff -urN glibc-2.12.2-orig/posix/sys/types.h glibc-2.12.2/posix/sys/types.h
+--- glibc-2.12.2-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.2/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
+@@ -114,7 +114,10 @@
+ #ifdef __USE_BSD
+ # ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ # endif
+ #endif
+diff -urN glibc-2.12.2-orig/sunrpc/rpc/types.h glibc-2.12.2/sunrpc/rpc/types.h
+--- glibc-2.12.2-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.2/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
+@@ -80,7 +80,10 @@
+ #endif
+ #ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ #endif
+
diff --git a/patches/glibc/2.12.2/999-new-tools.patch b/patches/glibc/2.12.2/999-new-tools.patch
new file mode 100644
index 0000000..e2f7b1d
--- /dev/null
+++ b/patches/glibc/2.12.2/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.12.2.orig/configure glibc-2.12.2/configure
+--- glibc-2.12.2.orig/configure 2010-12-13 02:47:26.000000000 -0800
++++ glibc-2.12.2/configure 2017-02-08 00:38:10.249617723 -0800
+@@ -5189,7 +5189,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5252,7 +5252,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5379,7 +5379,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5439,7 +5439,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:$LINENO: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.12.2.orig/configure.in glibc-2.12.2/configure.in
+--- glibc-2.12.2.orig/configure.in 2010-12-13 02:47:26.000000000 -0800
++++ glibc-2.12.2/configure.in 2017-02-08 00:29:52.484183611 -0800
+@@ -1026,11 +1026,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -1038,10 +1038,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.13/900-march-i686.patch b/patches/glibc/2.13/900-march-i686.patch
new file mode 100644
index 0000000..7f5b1ce
--- /dev/null
+++ b/patches/glibc/2.13/900-march-i686.patch
@@ -0,0 +1,34 @@
+2007-02-15 Khem Raj <kraj@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
+ * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
+
+diff -urN glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c 2010-12-30 11:36:19.858708534 +0100
+@@ -45,6 +45,11 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
++asm ("\n#undef __i686");
++asm ("\n#define __i686 __i686");
++asm ("\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -urN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-10-30 18:17:08.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-12-30 11:36:19.858708534 +0100
+@@ -29,6 +29,10 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
diff --git a/patches/glibc/2.13/910-typedef-caddr.patch b/patches/glibc/2.13/910-typedef-caddr.patch
new file mode 100644
index 0000000..e29e810
--- /dev/null
+++ b/patches/glibc/2.13/910-typedef-caddr.patch
@@ -0,0 +1,28 @@
+diff -urN glibc-2.12.1-orig/posix/sys/types.h glibc-2.12.1/posix/sys/types.h
+--- glibc-2.12.1-orig/posix/sys/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.1/posix/sys/types.h 2011-03-29 14:16:00.374064708 +0200
+@@ -114,7 +114,10 @@
+ #ifdef __USE_BSD
+ # ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ # endif
+ #endif
+diff -urN glibc-2.12.1-orig/sunrpc/rpc/types.h glibc-2.12.1/sunrpc/rpc/types.h
+--- glibc-2.12.1-orig/sunrpc/rpc/types.h 2010-12-13 11:47:26.000000000 +0100
++++ glibc-2.12.1/sunrpc/rpc/types.h 2011-03-29 14:16:32.988910439 +0200
+@@ -80,7 +80,10 @@
+ #endif
+ #ifndef __daddr_t_defined
+ typedef __daddr_t daddr_t;
++# if ! defined(caddr_t) && ! defined(__caddr_t_defined)
+ typedef __caddr_t caddr_t;
++# define __caddr_t_defined
++# endif
+ # define __daddr_t_defined
+ #endif
+
diff --git a/patches/glibc/2.13/950-initfini-ppc64.patch b/patches/glibc/2.13/950-initfini-ppc64.patch
new file mode 100644
index 0000000..87f8d23
--- /dev/null
+++ b/patches/glibc/2.13/950-initfini-ppc64.patch
@@ -0,0 +1,20 @@
+Prevent erroneous inline optimization of initfini.s on PowerPC64.
+
+The problem and the fix was reported there:
+http://sourceware.org/ml/libc-alpha/2012-01/msg00195.html
+Git commit:
+commit 1fe05ea95e1460e5e1cf1568a8ce3982f0f02de6
+Author: Ryan S. Arnold <rsa@us.ibm.com>
+Date: Tue May 3 17:26:17 2011 -0500
+
+--- glibc.orig/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:06.713568781 -0800
++++ glibc/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:50.318605517 -0800
+@@ -31,7 +31,7 @@
+ ifneq ($(elf),no)
+ # The initfini generation code doesn't work in the presence of -fPIC, so
+ # we use -fpic instead which is much better.
+-CFLAGS-initfini.s += -fpic -O1
++CFLAGS-initfini.s += -fpic -O1 -fno-inline
+ endif
+ endif
+
diff --git a/patches/glibc/2.13/999-new-tools.patch b/patches/glibc/2.13/999-new-tools.patch
new file mode 100644
index 0000000..d2d498a
--- /dev/null
+++ b/patches/glibc/2.13/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.13.orig/configure glibc-2.13/configure
+--- glibc-2.13.orig/configure 2011-01-17 20:34:07.000000000 -0800
++++ glibc-2.13/configure 2017-02-08 00:38:22.017735530 -0800
+@@ -5041,7 +5041,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5104,7 +5104,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5231,7 +5231,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5291,7 +5291,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.13.orig/configure.in glibc-2.13/configure.in
+--- glibc-2.13.orig/configure.in 2011-01-17 20:34:07.000000000 -0800
++++ glibc-2.13/configure.in 2017-02-08 00:30:01.720295526 -0800
+@@ -1026,11 +1026,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -1038,10 +1038,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.14.1/900-cpuid-include.patch b/patches/glibc/2.14.1/900-cpuid-include.patch
new file mode 100644
index 0000000..0b8db71
--- /dev/null
+++ b/patches/glibc/2.14.1/900-cpuid-include.patch
@@ -0,0 +1,628 @@
+This patch fixes another configure test issue when bootstrapping.
+sysdeps/i386/configure.in uses the obsolete AC_HEADER_CHECK macro to
+test for cpuid.h, and that macro tries to include various other
+standard headers (which come from the library, unlike cpuid.h which
+comes from the compiler, so aren't available when bootstrapping) in
+the test code it compiles. This patch changes the code to use
+AC_CHECK_HEADER, with the fourth argument used to prevent any default
+includes being used in the test.
+
+Tested x86_64 (native).
+
+2012-03-07 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/i386/configure.in (cpuid.h): Use AC_CHECK_HEADER with no
+ default includes instead of AC_HEADER_CHECK.
+ * sysdeps/i386/configure: Regenerated.
+
+Origin: http://sourceware.org/ml/libc-alpha/2012-03/msg00177.html
+
+diff -Nur glibc-2.14.1.orig/sysdeps/i386/configure glibc-2.14.1/sysdeps/i386/configure
+--- glibc-2.14.1.orig/sysdeps/i386/configure 2011-10-07 20:48:55.000000000 +1100
++++ glibc-2.14.1/sysdeps/i386/configure 2012-07-25 01:23:11.799118927 +1000
+@@ -16,23 +16,6 @@
+ as_fn_set_status $1
+ exit $1
+ } # as_fn_exit
+-# as_fn_arith ARG...
+-# ------------------
+-# Perform arithmetic evaluation on the ARGs, and store the result in the
+-# global $as_val. Take advantage of shells that can avoid forks. The arguments
+-# must be portable across $(()) and expr.
+-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+- eval 'as_fn_arith ()
+- {
+- as_val=$(( $* ))
+- }'
+-else
+- as_fn_arith ()
+- {
+- as_val=`expr "$@" || test $? -eq 1`
+- }
+-fi # as_fn_arith
+-
+ if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+@@ -89,6 +72,10 @@
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
++ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
++ # already done that, so ensure we don't try to do so again and fall
++ # in an infinite loop. This has already happened in practice.
++ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+@@ -97,42 +84,6 @@
+ exit
+ }
+
+-# Factoring default headers for most tests.
+-ac_includes_default="\
+-#include <stdio.h>
+-#ifdef HAVE_SYS_TYPES_H
+-# include <sys/types.h>
+-#endif
+-#ifdef HAVE_SYS_STAT_H
+-# include <sys/stat.h>
+-#endif
+-#ifdef STDC_HEADERS
+-# include <stdlib.h>
+-# include <stddef.h>
+-#else
+-# ifdef HAVE_STDLIB_H
+-# include <stdlib.h>
+-# endif
+-#endif
+-#ifdef HAVE_STRING_H
+-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+-# include <memory.h>
+-# endif
+-# include <string.h>
+-#endif
+-#ifdef HAVE_STRINGS_H
+-# include <strings.h>
+-#endif
+-#ifdef HAVE_INTTYPES_H
+-# include <inttypes.h>
+-#endif
+-#ifdef HAVE_STDINT_H
+-# include <stdint.h>
+-#endif
+-#ifdef HAVE_UNISTD_H
+-# include <unistd.h>
+-#endif"
+-
+
+ # ac_fn_c_try_compile LINENO
+ # --------------------------
+@@ -167,177 +118,11 @@
+
+ ac_retval=1
+ fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+ } # ac_fn_c_try_compile
+
+-# ac_fn_c_try_cpp LINENO
+-# ----------------------
+-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+-ac_fn_c_try_cpp ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+- ac_status=$?
+- if test -s conftest.err; then
+- grep -v '^ *+' conftest.err >conftest.er1
+- cat conftest.er1 >&5
+- mv -f conftest.er1 conftest.err
+- fi
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } >/dev/null && {
+- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+- test ! -s conftest.err
+- }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=1
+-fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_cpp
+-
+-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+-# -------------------------------------------------------
+-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+-# the include files in INCLUDES and setting the cache variable VAR
+-# accordingly.
+-ac_fn_c_check_header_mongrel ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if eval "test \"\${$3+set}\"" = set; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
+- $as_echo_n "(cached) " >&6
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-else
+- # Is the header compilable?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+-$as_echo_n "checking $2 usability... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-$4
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_header_compiler=yes
+-else
+- ac_header_compiler=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+-$as_echo "$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+-$as_echo_n "checking $2 presence... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+- ac_header_preproc=yes
+-else
+- ac_header_preproc=no
+-fi
+-rm -f conftest.err conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+-$as_echo "$ac_header_preproc" >&6; }
+-
+-# So? What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+- yes:no: )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+- no:yes:* )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+-esac
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- eval "$3=\$ac_header_compiler"
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+-
+-} # ac_fn_c_check_header_mongrel
+-
+-# ac_fn_c_try_run LINENO
+-# ----------------------
+-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+-# that executables *can* be run.
+-ac_fn_c_try_run ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_link"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_link") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+- { { case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_try") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; }; }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: program exited with status $ac_status" >&5
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=$ac_status
+-fi
+- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_run
+-
+ # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+ # -------------------------------------------------------
+ # Tests whether HEADER exists and can be compiled using the include files in
+@@ -347,7 +132,7 @@
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+ $as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
++if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -365,275 +150,16 @@
+ eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+ $as_echo "$ac_res" >&6; }
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+ } # ac_fn_c_check_header_compile
+ # This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/i386.
+
+
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+-if test "${ac_cv_path_GREP+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if test -z "$GREP"; then
+- ac_path_GREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in grep ggrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+-# Check for GNU ac_path_GREP and select it if it is found.
+- # Check for GNU $ac_path_GREP
+-case `"$ac_path_GREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'GREP' >> "conftest.nl"
+- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_GREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_GREP="$ac_path_GREP"
+- ac_path_GREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_GREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_GREP"; then
+- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_GREP=$GREP
+-fi
+-
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+-$as_echo "$ac_cv_path_GREP" >&6; }
+- GREP="$ac_cv_path_GREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+-$as_echo_n "checking for egrep... " >&6; }
+-if test "${ac_cv_path_EGREP+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+- then ac_cv_path_EGREP="$GREP -E"
+- else
+- if test -z "$EGREP"; then
+- ac_path_EGREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in egrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+-# Check for GNU ac_path_EGREP and select it if it is found.
+- # Check for GNU $ac_path_EGREP
+-case `"$ac_path_EGREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'EGREP' >> "conftest.nl"
+- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_EGREP="$ac_path_EGREP"
+- ac_path_EGREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_EGREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_EGREP"; then
+- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_EGREP=$EGREP
+-fi
+-
+- fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+-$as_echo "$ac_cv_path_EGREP" >&6; }
+- EGREP="$ac_cv_path_EGREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+-$as_echo_n "checking for ANSI C header files... " >&6; }
+-if test "${ac_cv_header_stdc+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-#include <stdarg.h>
+-#include <string.h>
+-#include <float.h>
+-
+-int
+-main ()
+-{
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_cv_header_stdc=yes
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-if test $ac_cv_header_stdc = yes; then
+- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <string.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "memchr" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "free" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+- if test "$cross_compiling" = yes; then :
+- :
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <ctype.h>
+-#include <stdlib.h>
+-#if ((' ' & 0x0FF) == 0x020)
+-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+-#else
+-# define ISLOWER(c) \
+- (('a' <= (c) && (c) <= 'i') \
+- || ('j' <= (c) && (c) <= 'r') \
+- || ('s' <= (c) && (c) <= 'z'))
+-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+-#endif
+-
+-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+-int
+-main ()
+-{
+- int i;
+- for (i = 0; i < 256; i++)
+- if (XOR (islower (i), ISLOWER (i))
+- || toupper (i) != TOUPPER (i))
+- return 2;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+- conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+-fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+-$as_echo "$ac_cv_header_stdc" >&6; }
+-if test $ac_cv_header_stdc = yes; then
+-
+-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+-
+-fi
+-
+-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+- inttypes.h stdint.h unistd.h
+-do :
+- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
++ac_fn_c_check_header_compile "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "/* No default includes. */
+ "
+-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+- cat >>confdefs.h <<_ACEOF
+-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+-_ACEOF
+-
+-fi
+-
+-done
+-
+-
+-ac_fn_c_check_header_mongrel "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "$ac_includes_default"
+-if test "x$ac_cv_header_cpuid_h" = x""yes; then :
++if test "x$ac_cv_header_cpuid_h" = xyes; then :
+
+ else
+ as_fn_error $? "gcc must provide the <cpuid.h> header" "$LINENO" 5
+@@ -643,7 +169,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -g produces usable source locations for assembler-with-cpp" >&5
+ $as_echo_n "checking if -g produces usable source locations for assembler-with-cpp... " >&6; }
+-if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then :
++if ${libc_cv_cpp_asm_debuginfo+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ cat > conftest.S <<EOF
+@@ -693,7 +219,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSE4 support" >&5
+ $as_echo_n "checking for SSE4 support... " >&6; }
+-if test "${libc_cv_cc_sse4+set}" = set; then :
++if ${libc_cv_cc_sse4+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -msse4 -xc /dev/null -S -o /dev/null'
+@@ -716,7 +242,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler -mtune=i686 support" >&5
+ $as_echo_n "checking for assembler -mtune=i686 support... " >&6; }
+-if test "${libc_cv_as_i686+set}" = set; then :
++if ${libc_cv_as_i686+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null'
+@@ -735,7 +261,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5
+ $as_echo_n "checking for AVX support... " >&6; }
+-if test "${libc_cv_cc_avx+set}" = set; then :
++if ${libc_cv_cc_avx+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null'
+@@ -758,7 +284,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5
+ $as_echo_n "checking for -mno-vzeroupper support... " >&6; }
+-if test "${libc_cv_cc_novzeroupper+set}" = set; then :
++if ${libc_cv_cc_novzeroupper+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null'
+diff -Nur glibc-2.14.1.orig/sysdeps/i386/configure.in glibc-2.14.1/sysdeps/i386/configure.in
+--- glibc-2.14.1.orig/sysdeps/i386/configure.in 2011-10-07 20:48:55.000000000 +1100
++++ glibc-2.14.1/sysdeps/i386/configure.in 2012-07-25 01:00:49.345025022 +1000
+@@ -1,8 +1,9 @@
+ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/i386.
+
+-AC_HEADER_CHECK([cpuid.h], ,
+- [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])])
++AC_CHECK_HEADER([cpuid.h], ,
++ [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])],
++ [/* No default includes. */])
+
+ AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp,
+ libc_cv_cpp_asm_debuginfo, [dnl
+
diff --git a/patches/glibc/2.14.1/910-asm-i686.patch b/patches/glibc/2.14.1/910-asm-i686.patch
new file mode 100644
index 0000000..b049887
--- /dev/null
+++ b/patches/glibc/2.14.1/910-asm-i686.patch
@@ -0,0 +1,50 @@
+Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
+Date: 2010-04-18
+Initial Package Version: 2.11.1
+Upstream Status: Not Submitted
+Origin: http://www.eglibc.org/archives/patches/msg00073.html
+Description: Fixes the following build problem with GCC-4.5.0:
+
+/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
+./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
+./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
+./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
+make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
+
+diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000
++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 11:34:06.882681001 +0000
+@@ -45,6 +45,11 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
++asm ("\n#undef __i686");
++asm ("\n#define __i686 __i686");
++asm ("\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -Naur glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000
++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 11:34:06.882681001 +0000
+@@ -29,6 +29,10 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+
diff --git a/patches/glibc/2.14.1/950-initfini-ppc64.patch b/patches/glibc/2.14.1/950-initfini-ppc64.patch
new file mode 100644
index 0000000..87f8d23
--- /dev/null
+++ b/patches/glibc/2.14.1/950-initfini-ppc64.patch
@@ -0,0 +1,20 @@
+Prevent erroneous inline optimization of initfini.s on PowerPC64.
+
+The problem and the fix was reported there:
+http://sourceware.org/ml/libc-alpha/2012-01/msg00195.html
+Git commit:
+commit 1fe05ea95e1460e5e1cf1568a8ce3982f0f02de6
+Author: Ryan S. Arnold <rsa@us.ibm.com>
+Date: Tue May 3 17:26:17 2011 -0500
+
+--- glibc.orig/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:06.713568781 -0800
++++ glibc/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:50.318605517 -0800
+@@ -31,7 +31,7 @@
+ ifneq ($(elf),no)
+ # The initfini generation code doesn't work in the presence of -fPIC, so
+ # we use -fpic instead which is much better.
+-CFLAGS-initfini.s += -fpic -O1
++CFLAGS-initfini.s += -fpic -O1 -fno-inline
+ endif
+ endif
+
diff --git a/patches/glibc/2.14.1/999-new-tools.patch b/patches/glibc/2.14.1/999-new-tools.patch
new file mode 100644
index 0000000..f335a54
--- /dev/null
+++ b/patches/glibc/2.14.1/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.14.1.orig/configure glibc-2.14.1/configure
+--- glibc-2.14.1.orig/configure 2011-10-07 02:48:55.000000000 -0700
++++ glibc-2.14.1/configure 2017-02-08 00:38:43.765952352 -0800
+@@ -4939,7 +4939,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5002,7 +5002,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5129,7 +5129,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5189,7 +5189,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.14.1.orig/configure.in glibc-2.14.1/configure.in
+--- glibc-2.14.1.orig/configure.in 2011-10-07 02:48:55.000000000 -0700
++++ glibc-2.14.1/configure.in 2017-02-08 00:30:13.660439376 -0800
+@@ -1026,11 +1026,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -1038,10 +1038,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.14/900-cpuid-include.patch b/patches/glibc/2.14/900-cpuid-include.patch
new file mode 100644
index 0000000..0b8db71
--- /dev/null
+++ b/patches/glibc/2.14/900-cpuid-include.patch
@@ -0,0 +1,628 @@
+This patch fixes another configure test issue when bootstrapping.
+sysdeps/i386/configure.in uses the obsolete AC_HEADER_CHECK macro to
+test for cpuid.h, and that macro tries to include various other
+standard headers (which come from the library, unlike cpuid.h which
+comes from the compiler, so aren't available when bootstrapping) in
+the test code it compiles. This patch changes the code to use
+AC_CHECK_HEADER, with the fourth argument used to prevent any default
+includes being used in the test.
+
+Tested x86_64 (native).
+
+2012-03-07 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/i386/configure.in (cpuid.h): Use AC_CHECK_HEADER with no
+ default includes instead of AC_HEADER_CHECK.
+ * sysdeps/i386/configure: Regenerated.
+
+Origin: http://sourceware.org/ml/libc-alpha/2012-03/msg00177.html
+
+diff -Nur glibc-2.14.1.orig/sysdeps/i386/configure glibc-2.14.1/sysdeps/i386/configure
+--- glibc-2.14.1.orig/sysdeps/i386/configure 2011-10-07 20:48:55.000000000 +1100
++++ glibc-2.14.1/sysdeps/i386/configure 2012-07-25 01:23:11.799118927 +1000
+@@ -16,23 +16,6 @@
+ as_fn_set_status $1
+ exit $1
+ } # as_fn_exit
+-# as_fn_arith ARG...
+-# ------------------
+-# Perform arithmetic evaluation on the ARGs, and store the result in the
+-# global $as_val. Take advantage of shells that can avoid forks. The arguments
+-# must be portable across $(()) and expr.
+-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+- eval 'as_fn_arith ()
+- {
+- as_val=$(( $* ))
+- }'
+-else
+- as_fn_arith ()
+- {
+- as_val=`expr "$@" || test $? -eq 1`
+- }
+-fi # as_fn_arith
+-
+ if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+@@ -89,6 +72,10 @@
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
++ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
++ # already done that, so ensure we don't try to do so again and fall
++ # in an infinite loop. This has already happened in practice.
++ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+@@ -97,42 +84,6 @@
+ exit
+ }
+
+-# Factoring default headers for most tests.
+-ac_includes_default="\
+-#include <stdio.h>
+-#ifdef HAVE_SYS_TYPES_H
+-# include <sys/types.h>
+-#endif
+-#ifdef HAVE_SYS_STAT_H
+-# include <sys/stat.h>
+-#endif
+-#ifdef STDC_HEADERS
+-# include <stdlib.h>
+-# include <stddef.h>
+-#else
+-# ifdef HAVE_STDLIB_H
+-# include <stdlib.h>
+-# endif
+-#endif
+-#ifdef HAVE_STRING_H
+-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+-# include <memory.h>
+-# endif
+-# include <string.h>
+-#endif
+-#ifdef HAVE_STRINGS_H
+-# include <strings.h>
+-#endif
+-#ifdef HAVE_INTTYPES_H
+-# include <inttypes.h>
+-#endif
+-#ifdef HAVE_STDINT_H
+-# include <stdint.h>
+-#endif
+-#ifdef HAVE_UNISTD_H
+-# include <unistd.h>
+-#endif"
+-
+
+ # ac_fn_c_try_compile LINENO
+ # --------------------------
+@@ -167,177 +118,11 @@
+
+ ac_retval=1
+ fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+ } # ac_fn_c_try_compile
+
+-# ac_fn_c_try_cpp LINENO
+-# ----------------------
+-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+-ac_fn_c_try_cpp ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+- ac_status=$?
+- if test -s conftest.err; then
+- grep -v '^ *+' conftest.err >conftest.er1
+- cat conftest.er1 >&5
+- mv -f conftest.er1 conftest.err
+- fi
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } >/dev/null && {
+- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+- test ! -s conftest.err
+- }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=1
+-fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_cpp
+-
+-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+-# -------------------------------------------------------
+-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+-# the include files in INCLUDES and setting the cache variable VAR
+-# accordingly.
+-ac_fn_c_check_header_mongrel ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if eval "test \"\${$3+set}\"" = set; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
+- $as_echo_n "(cached) " >&6
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-else
+- # Is the header compilable?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+-$as_echo_n "checking $2 usability... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-$4
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_header_compiler=yes
+-else
+- ac_header_compiler=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+-$as_echo "$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+-$as_echo_n "checking $2 presence... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+- ac_header_preproc=yes
+-else
+- ac_header_preproc=no
+-fi
+-rm -f conftest.err conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+-$as_echo "$ac_header_preproc" >&6; }
+-
+-# So? What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+- yes:no: )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+- no:yes:* )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+-esac
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- eval "$3=\$ac_header_compiler"
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-fi
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+-
+-} # ac_fn_c_check_header_mongrel
+-
+-# ac_fn_c_try_run LINENO
+-# ----------------------
+-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+-# that executables *can* be run.
+-ac_fn_c_try_run ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_link"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_link") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+- { { case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_try") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; }; }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: program exited with status $ac_status" >&5
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=$ac_status
+-fi
+- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_run
+-
+ # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+ # -------------------------------------------------------
+ # Tests whether HEADER exists and can be compiled using the include files in
+@@ -347,7 +132,7 @@
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+ $as_echo_n "checking for $2... " >&6; }
+-if eval "test \"\${$3+set}\"" = set; then :
++if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -365,275 +150,16 @@
+ eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+ $as_echo "$ac_res" >&6; }
+- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+ } # ac_fn_c_check_header_compile
+ # This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/i386.
+
+
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+-if test "${ac_cv_path_GREP+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if test -z "$GREP"; then
+- ac_path_GREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in grep ggrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+-# Check for GNU ac_path_GREP and select it if it is found.
+- # Check for GNU $ac_path_GREP
+-case `"$ac_path_GREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'GREP' >> "conftest.nl"
+- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_GREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_GREP="$ac_path_GREP"
+- ac_path_GREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_GREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_GREP"; then
+- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_GREP=$GREP
+-fi
+-
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+-$as_echo "$ac_cv_path_GREP" >&6; }
+- GREP="$ac_cv_path_GREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+-$as_echo_n "checking for egrep... " >&6; }
+-if test "${ac_cv_path_EGREP+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+- then ac_cv_path_EGREP="$GREP -E"
+- else
+- if test -z "$EGREP"; then
+- ac_path_EGREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in egrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+-# Check for GNU ac_path_EGREP and select it if it is found.
+- # Check for GNU $ac_path_EGREP
+-case `"$ac_path_EGREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'EGREP' >> "conftest.nl"
+- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_EGREP="$ac_path_EGREP"
+- ac_path_EGREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_EGREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_EGREP"; then
+- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_EGREP=$EGREP
+-fi
+-
+- fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+-$as_echo "$ac_cv_path_EGREP" >&6; }
+- EGREP="$ac_cv_path_EGREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+-$as_echo_n "checking for ANSI C header files... " >&6; }
+-if test "${ac_cv_header_stdc+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-#include <stdarg.h>
+-#include <string.h>
+-#include <float.h>
+-
+-int
+-main ()
+-{
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_cv_header_stdc=yes
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-if test $ac_cv_header_stdc = yes; then
+- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <string.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "memchr" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "free" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+- if test "$cross_compiling" = yes; then :
+- :
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <ctype.h>
+-#include <stdlib.h>
+-#if ((' ' & 0x0FF) == 0x020)
+-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+-#else
+-# define ISLOWER(c) \
+- (('a' <= (c) && (c) <= 'i') \
+- || ('j' <= (c) && (c) <= 'r') \
+- || ('s' <= (c) && (c) <= 'z'))
+-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+-#endif
+-
+-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+-int
+-main ()
+-{
+- int i;
+- for (i = 0; i < 256; i++)
+- if (XOR (islower (i), ISLOWER (i))
+- || toupper (i) != TOUPPER (i))
+- return 2;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+- conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+-fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+-$as_echo "$ac_cv_header_stdc" >&6; }
+-if test $ac_cv_header_stdc = yes; then
+-
+-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+-
+-fi
+-
+-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+- inttypes.h stdint.h unistd.h
+-do :
+- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
++ac_fn_c_check_header_compile "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "/* No default includes. */
+ "
+-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+- cat >>confdefs.h <<_ACEOF
+-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+-_ACEOF
+-
+-fi
+-
+-done
+-
+-
+-ac_fn_c_check_header_mongrel "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "$ac_includes_default"
+-if test "x$ac_cv_header_cpuid_h" = x""yes; then :
++if test "x$ac_cv_header_cpuid_h" = xyes; then :
+
+ else
+ as_fn_error $? "gcc must provide the <cpuid.h> header" "$LINENO" 5
+@@ -643,7 +169,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -g produces usable source locations for assembler-with-cpp" >&5
+ $as_echo_n "checking if -g produces usable source locations for assembler-with-cpp... " >&6; }
+-if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then :
++if ${libc_cv_cpp_asm_debuginfo+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ cat > conftest.S <<EOF
+@@ -693,7 +219,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSE4 support" >&5
+ $as_echo_n "checking for SSE4 support... " >&6; }
+-if test "${libc_cv_cc_sse4+set}" = set; then :
++if ${libc_cv_cc_sse4+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -msse4 -xc /dev/null -S -o /dev/null'
+@@ -716,7 +242,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler -mtune=i686 support" >&5
+ $as_echo_n "checking for assembler -mtune=i686 support... " >&6; }
+-if test "${libc_cv_as_i686+set}" = set; then :
++if ${libc_cv_as_i686+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null'
+@@ -735,7 +261,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5
+ $as_echo_n "checking for AVX support... " >&6; }
+-if test "${libc_cv_cc_avx+set}" = set; then :
++if ${libc_cv_cc_avx+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null'
+@@ -758,7 +284,7 @@
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5
+ $as_echo_n "checking for -mno-vzeroupper support... " >&6; }
+-if test "${libc_cv_cc_novzeroupper+set}" = set; then :
++if ${libc_cv_cc_novzeroupper+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ if { ac_try='${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null'
+diff -Nur glibc-2.14.1.orig/sysdeps/i386/configure.in glibc-2.14.1/sysdeps/i386/configure.in
+--- glibc-2.14.1.orig/sysdeps/i386/configure.in 2011-10-07 20:48:55.000000000 +1100
++++ glibc-2.14.1/sysdeps/i386/configure.in 2012-07-25 01:00:49.345025022 +1000
+@@ -1,8 +1,9 @@
+ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/i386.
+
+-AC_HEADER_CHECK([cpuid.h], ,
+- [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])])
++AC_CHECK_HEADER([cpuid.h], ,
++ [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])],
++ [/* No default includes. */])
+
+ AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp,
+ libc_cv_cpp_asm_debuginfo, [dnl
+
diff --git a/patches/glibc/2.14/950-initfini-ppc64.patch b/patches/glibc/2.14/950-initfini-ppc64.patch
new file mode 100644
index 0000000..87f8d23
--- /dev/null
+++ b/patches/glibc/2.14/950-initfini-ppc64.patch
@@ -0,0 +1,20 @@
+Prevent erroneous inline optimization of initfini.s on PowerPC64.
+
+The problem and the fix was reported there:
+http://sourceware.org/ml/libc-alpha/2012-01/msg00195.html
+Git commit:
+commit 1fe05ea95e1460e5e1cf1568a8ce3982f0f02de6
+Author: Ryan S. Arnold <rsa@us.ibm.com>
+Date: Tue May 3 17:26:17 2011 -0500
+
+--- glibc.orig/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:06.713568781 -0800
++++ glibc/sysdeps/powerpc/powerpc64/Makefile 2012-12-22 19:10:50.318605517 -0800
+@@ -31,7 +31,7 @@
+ ifneq ($(elf),no)
+ # The initfini generation code doesn't work in the presence of -fPIC, so
+ # we use -fpic instead which is much better.
+-CFLAGS-initfini.s += -fpic -O1
++CFLAGS-initfini.s += -fpic -O1 -fno-inline
+ endif
+ endif
+
diff --git a/patches/glibc/2.14/999-new-tools.patch b/patches/glibc/2.14/999-new-tools.patch
new file mode 100644
index 0000000..7d115fd
--- /dev/null
+++ b/patches/glibc/2.14/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.14.orig/configure glibc-2.14/configure
+--- glibc-2.14.orig/configure 2011-05-30 21:12:33.000000000 -0700
++++ glibc-2.14/configure 2017-02-08 00:38:34.469859812 -0800
+@@ -4939,7 +4939,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5002,7 +5002,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5129,7 +5129,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5189,7 +5189,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.14.orig/configure.in glibc-2.14/configure.in
+--- glibc-2.14.orig/configure.in 2011-05-30 21:12:33.000000000 -0700
++++ glibc-2.14/configure.in 2017-02-08 00:30:32.232661325 -0800
+@@ -1026,11 +1026,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -1038,10 +1038,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.15/900-cpuid-include.patch b/patches/glibc/2.15/900-cpuid-include.patch
new file mode 100644
index 0000000..29edf7b
--- /dev/null
+++ b/patches/glibc/2.15/900-cpuid-include.patch
@@ -0,0 +1,548 @@
+[As applied to 2.15]
+
+This patch fixes another configure test issue when bootstrapping.
+sysdeps/i386/configure.in uses the obsolete AC_HEADER_CHECK macro to
+test for cpuid.h, and that macro tries to include various other
+standard headers (which come from the library, unlike cpuid.h which
+comes from the compiler, so aren't available when bootstrapping) in
+the test code it compiles. This patch changes the code to use
+AC_CHECK_HEADER, with the fourth argument used to prevent any default
+includes being used in the test.
+
+Tested x86_64 (native).
+
+2012-03-07 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/i386/configure.in (cpuid.h): Use AC_CHECK_HEADER with no
+ default includes instead of AC_HEADER_CHECK.
+ * sysdeps/i386/configure: Regenerated.
+
+Origin: http://sourceware.org/ml/libc-alpha/2012-03/msg00177.html
+
+diff -urpN '--exclude=autom4te.cache' glibc-2.15.orig/sysdeps/i386/configure glibc-2.15/sysdeps/i386/configure
+--- glibc-2.15.orig/sysdeps/i386/configure 2017-02-08 14:28:19.947516097 -0800
++++ glibc-2.15/sysdeps/i386/configure 2017-02-08 17:25:19.756462280 -0800
+@@ -16,23 +16,6 @@ as_fn_exit ()
+ as_fn_set_status $1
+ exit $1
+ } # as_fn_exit
+-# as_fn_arith ARG...
+-# ------------------
+-# Perform arithmetic evaluation on the ARGs, and store the result in the
+-# global $as_val. Take advantage of shells that can avoid forks. The arguments
+-# must be portable across $(()) and expr.
+-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+- eval 'as_fn_arith ()
+- {
+- as_val=$(( $* ))
+- }'
+-else
+- as_fn_arith ()
+- {
+- as_val=`expr "$@" || test $? -eq 1`
+- }
+-fi # as_fn_arith
+-
+ if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+@@ -97,42 +80,6 @@ $as_echo X/"$0" |
+ exit
+ }
+
+-# Factoring default headers for most tests.
+-ac_includes_default="\
+-#include <stdio.h>
+-#ifdef HAVE_SYS_TYPES_H
+-# include <sys/types.h>
+-#endif
+-#ifdef HAVE_SYS_STAT_H
+-# include <sys/stat.h>
+-#endif
+-#ifdef STDC_HEADERS
+-# include <stdlib.h>
+-# include <stddef.h>
+-#else
+-# ifdef HAVE_STDLIB_H
+-# include <stdlib.h>
+-# endif
+-#endif
+-#ifdef HAVE_STRING_H
+-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+-# include <memory.h>
+-# endif
+-# include <string.h>
+-#endif
+-#ifdef HAVE_STRINGS_H
+-# include <strings.h>
+-#endif
+-#ifdef HAVE_INTTYPES_H
+-# include <inttypes.h>
+-#endif
+-#ifdef HAVE_STDINT_H
+-# include <stdint.h>
+-#endif
+-#ifdef HAVE_UNISTD_H
+-# include <unistd.h>
+-#endif"
+-
+
+ # ac_fn_c_try_compile LINENO
+ # --------------------------
+@@ -172,172 +119,6 @@ fi
+
+ } # ac_fn_c_try_compile
+
+-# ac_fn_c_try_cpp LINENO
+-# ----------------------
+-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+-ac_fn_c_try_cpp ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+- ac_status=$?
+- if test -s conftest.err; then
+- grep -v '^ *+' conftest.err >conftest.er1
+- cat conftest.er1 >&5
+- mv -f conftest.er1 conftest.err
+- fi
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } > conftest.i && {
+- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+- test ! -s conftest.err
+- }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=1
+-fi
+- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_cpp
+-
+-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+-# -------------------------------------------------------
+-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+-# the include files in INCLUDES and setting the cache variable VAR
+-# accordingly.
+-ac_fn_c_check_header_mongrel ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if eval \${$3+:} false; then :
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval \${$3+:} false; then :
+- $as_echo_n "(cached) " >&6
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-else
+- # Is the header compilable?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+-$as_echo_n "checking $2 usability... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-$4
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_header_compiler=yes
+-else
+- ac_header_compiler=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+-$as_echo "$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+-$as_echo_n "checking $2 presence... " >&6; }
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <$2>
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+- ac_header_preproc=yes
+-else
+- ac_header_preproc=no
+-fi
+-rm -f conftest.err conftest.i conftest.$ac_ext
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+-$as_echo "$ac_header_preproc" >&6; }
+-
+-# So? What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+- yes:no: )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+- no:yes:* )
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+- ;;
+-esac
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+-$as_echo_n "checking for $2... " >&6; }
+-if eval \${$3+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- eval "$3=\$ac_header_compiler"
+-fi
+-eval ac_res=\$$3
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-fi
+- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+-
+-} # ac_fn_c_check_header_mongrel
+-
+-# ac_fn_c_try_run LINENO
+-# ----------------------
+-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+-# that executables *can* be run.
+-ac_fn_c_try_run ()
+-{
+- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+- if { { ac_try="$ac_link"
+-case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_link") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+- { { case "(($ac_try" in
+- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+- *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+-$as_echo "$ac_try_echo"; } >&5
+- (eval "$ac_try") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; }; }; then :
+- ac_retval=0
+-else
+- $as_echo "$as_me: program exited with status $ac_status" >&5
+- $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+- ac_retval=$ac_status
+-fi
+- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+- as_fn_set_status $ac_retval
+-
+-} # ac_fn_c_try_run
+-
+ # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+ # -------------------------------------------------------
+ # Tests whether HEADER exists and can be compiled using the include files in
+@@ -372,267 +153,8 @@ $as_echo "$ac_res" >&6; }
+ # Local configure fragment for sysdeps/i386.
+
+
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+-if ${ac_cv_path_GREP+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if test -z "$GREP"; then
+- ac_path_GREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in grep ggrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+-# Check for GNU ac_path_GREP and select it if it is found.
+- # Check for GNU $ac_path_GREP
+-case `"$ac_path_GREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'GREP' >> "conftest.nl"
+- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_GREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_GREP="$ac_path_GREP"
+- ac_path_GREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_GREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_GREP"; then
+- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_GREP=$GREP
+-fi
+-
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+-$as_echo "$ac_cv_path_GREP" >&6; }
+- GREP="$ac_cv_path_GREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+-$as_echo_n "checking for egrep... " >&6; }
+-if ${ac_cv_path_EGREP+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+- then ac_cv_path_EGREP="$GREP -E"
+- else
+- if test -z "$EGREP"; then
+- ac_path_EGREP_found=false
+- # Loop through the user's path and test for each of PROGNAME-LIST
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_prog in egrep; do
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+-# Check for GNU ac_path_EGREP and select it if it is found.
+- # Check for GNU $ac_path_EGREP
+-case `"$ac_path_EGREP" --version 2>&1` in
+-*GNU*)
+- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+-*)
+- ac_count=0
+- $as_echo_n 0123456789 >"conftest.in"
+- while :
+- do
+- cat "conftest.in" "conftest.in" >"conftest.tmp"
+- mv "conftest.tmp" "conftest.in"
+- cp "conftest.in" "conftest.nl"
+- $as_echo 'EGREP' >> "conftest.nl"
+- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+- as_fn_arith $ac_count + 1 && ac_count=$as_val
+- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+- # Best one so far, save it but keep looking for a better one
+- ac_cv_path_EGREP="$ac_path_EGREP"
+- ac_path_EGREP_max=$ac_count
+- fi
+- # 10*(2^10) chars as input seems more than enough
+- test $ac_count -gt 10 && break
+- done
+- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
+-
+- $ac_path_EGREP_found && break 3
+- done
+- done
+- done
+-IFS=$as_save_IFS
+- if test -z "$ac_cv_path_EGREP"; then
+- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+- fi
+-else
+- ac_cv_path_EGREP=$EGREP
+-fi
+-
+- fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+-$as_echo "$ac_cv_path_EGREP" >&6; }
+- EGREP="$ac_cv_path_EGREP"
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+-$as_echo_n "checking for ANSI C header files... " >&6; }
+-if ${ac_cv_header_stdc+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-#include <stdarg.h>
+-#include <string.h>
+-#include <float.h>
+-
+-int
+-main ()
+-{
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- ac_cv_header_stdc=yes
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-if test $ac_cv_header_stdc = yes; then
+- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <string.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "memchr" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <stdlib.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+- $EGREP "free" >/dev/null 2>&1; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+- if test "$cross_compiling" = yes; then :
+- :
+-else
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-#include <ctype.h>
+-#include <stdlib.h>
+-#if ((' ' & 0x0FF) == 0x020)
+-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+-#else
+-# define ISLOWER(c) \
+- (('a' <= (c) && (c) <= 'i') \
+- || ('j' <= (c) && (c) <= 'r') \
+- || ('s' <= (c) && (c) <= 'z'))
+-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+-#endif
+-
+-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+-int
+-main ()
+-{
+- int i;
+- for (i = 0; i < 256; i++)
+- if (XOR (islower (i), ISLOWER (i))
+- || toupper (i) != TOUPPER (i))
+- return 2;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-
+-else
+- ac_cv_header_stdc=no
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+- conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+-fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+-$as_echo "$ac_cv_header_stdc" >&6; }
+-if test $ac_cv_header_stdc = yes; then
+-
+-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+-
+-fi
+-
+-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+- inttypes.h stdint.h unistd.h
+-do :
+- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
++ac_fn_c_check_header_compile "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "/* No default includes. */
+ "
+-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+- cat >>confdefs.h <<_ACEOF
+-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+-_ACEOF
+-
+-fi
+-
+-done
+-
+-
+-ac_fn_c_check_header_mongrel "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "$ac_includes_default"
+ if test "x$ac_cv_header_cpuid_h" = xyes; then :
+
+ else
+diff -urpN '--exclude=autom4te.cache' glibc-2.15.orig/sysdeps/i386/configure.in glibc-2.15/sysdeps/i386/configure.in
+--- glibc-2.15.orig/sysdeps/i386/configure.in 2017-02-08 14:28:19.951516034 -0800
++++ glibc-2.15/sysdeps/i386/configure.in 2017-02-08 17:24:29.995973278 -0800
+@@ -1,8 +1,9 @@
+ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+ # Local configure fragment for sysdeps/i386.
+
+-AC_HEADER_CHECK([cpuid.h], ,
+- [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])])
++AC_CHECK_HEADER([cpuid.h], ,
++ [AC_MSG_ERROR([gcc must provide the <cpuid.h> header])],
++ [/* No default includes. */])
+
+ AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp,
+ libc_cv_cpp_asm_debuginfo, [dnl
diff --git a/patches/glibc/2.15/910-asm-i686.patch b/patches/glibc/2.15/910-asm-i686.patch
new file mode 100644
index 0000000..b049887
--- /dev/null
+++ b/patches/glibc/2.15/910-asm-i686.patch
@@ -0,0 +1,50 @@
+Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
+Date: 2010-04-18
+Initial Package Version: 2.11.1
+Upstream Status: Not Submitted
+Origin: http://www.eglibc.org/archives/patches/msg00073.html
+Description: Fixes the following build problem with GCC-4.5.0:
+
+/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
+./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
+./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
+./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
+./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
+./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
+make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
+
+diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
+--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000
++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 11:34:06.882681001 +0000
+@@ -45,6 +45,11 @@
+ /* Embed an #include to pull in the alignment and .end directives. */
+ asm ("\n#include \"defs.h\"");
+
++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
++asm ("\n#undef __i686");
++asm ("\n#define __i686 __i686");
++asm ("\n#endif");
++
+ /* The initial common code ends here. */
+ asm ("\n/*@HEADER_ENDS*/");
+
+diff -Naur glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
+--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000
++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 11:34:06.882681001 +0000
+@@ -29,6 +29,10 @@
+ #include <dl-sysdep.h>
+ #include <tls.h>
+
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
+
+ /* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+
diff --git a/patches/glibc/2.15/990-try-link-static.patch b/patches/glibc/2.15/990-try-link-static.patch
new file mode 100644
index 0000000..a0ffadd
--- /dev/null
+++ b/patches/glibc/2.15/990-try-link-static.patch
@@ -0,0 +1,171 @@
+[Patch modified to apply to 2.15]
+
+commit 07037eeb43ca1e0ac2802e3a1492cecf869c63c6
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Thu Mar 8 00:17:27 2012 +0000
+
+ Fix .ctors/.dtors header configure test for bootstrapping.
+
+diff -urpN glibc-2.15.orig/aclocal.m4 glibc-2.15/aclocal.m4
+--- glibc-2.15.orig/aclocal.m4 2017-02-08 11:27:28.445657746 -0800
++++ glibc-2.15/aclocal.m4 2017-02-08 11:37:25.818463475 -0800
+@@ -114,3 +114,17 @@ AC_CACHE_CHECK(whether $LD is GNU ld, li
+ [LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
+ gnu_ld=$libc_cv_prog_ld_gnu
+ ])
++
++dnl Run a static link test with -nostdlib -nostartfiles.
++dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
++AC_DEFUN([LIBC_TRY_LINK_STATIC],
++[cat > conftest.c <<EOF
++int _start (void) { return 0; }
++int __start (void) { return 0; }
++$1
++EOF
++AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
++ conftest.c -static -nostartfiles -nostdlib
++ 1>&AS_MESSAGE_LOG_FD])],
++ [$2], [$3])
++rm -f conftest*])
+diff -urpN glibc-2.15.orig/configure glibc-2.15/configure
+--- glibc-2.15.orig/configure 2017-02-08 11:27:28.453657802 -0800
++++ glibc-2.15/configure 2017-02-08 11:47:36.184360147 -0800
+@@ -6147,29 +6147,32 @@ $as_echo_n "checking for .preinit_array/
+ if ${libc_cv_initfini_array+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+- cat > conftest.c <<EOF
++ cat > conftest.c <<EOF
+ int _start (void) { return 0; }
+ int __start (void) { return 0; }
++
+ int foo (void) { return 1; }
+ int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
++
+ EOF
+- if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
+- -static -nostartfiles -nostdlib 1>&5'
++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
++ conftest.c -static -nostartfiles -nostdlib
++ 1>&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; }; }
+- then
+- if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
+- libc_cv_initfini_array=yes
+- else
+- libc_cv_initfini_array=no
+- fi
++ test $ac_status = 0; }; }; then :
++ if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
++ libc_cv_initfini_array=yes
+ else
+ libc_cv_initfini_array=no
+ fi
+- rm -f conftest*
++else
++ libc_cv_initfini_array=no
++fi
++rm -f conftest*
++
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_initfini_array" >&5
+ $as_echo "$libc_cv_initfini_array" >&6; }
+@@ -6183,21 +6186,22 @@ if ${libc_cv_ctors_header+:} false; then
+ $as_echo_n "(cached) " >&6
+ else
+ libc_cv_ctors_header=yes
+- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
++ cat > conftest.c <<EOF
++int _start (void) { return 0; }
++int __start (void) { return 0; }
++
++__attribute__ ((constructor)) void ctor (void) { asm (""); }
++__attribute__ ((destructor)) void dtor (void) { asm (""); }
+
+-int
+-main ()
+-{
+-
+-__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
+-__attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
+-
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
++EOF
++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
++ conftest.c -static -nostartfiles -nostdlib
++ 1>&5'
++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++ test $ac_status = 0; }; }; then :
+ if $READELF -WS conftest$ac_exeext | $AWK '
+ { gsub(/\[ */, "[") }
+ $2 == ".ctors" || $2 == ".dtors" {
+@@ -6219,8 +6223,7 @@ else
+ as_fn_error $? "missing __attribute__ ((constructor)) support??" "$LINENO" 5
+
+ fi
+-rm -f core conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
++rm -f conftest*
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ctors_header" >&5
+diff -urpN glibc-2.15.orig/configure.in glibc-2.15/configure.in
+--- glibc-2.15.orig/configure.in 2017-02-08 11:27:28.433657663 -0800
++++ glibc-2.15/configure.in 2017-02-08 11:46:58.994915812 -0800
+@@ -1439,24 +1439,17 @@ EOF
+
+ AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+ libc_cv_initfini_array, [dnl
+- cat > conftest.c <<EOF
+-int _start (void) { return 0; }
+-int __start (void) { return 0; }
++LIBC_TRY_LINK_STATIC([
+ int foo (void) { return 1; }
+ int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
+-EOF
+- if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
+- -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
+- then
+- if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
+- libc_cv_initfini_array=yes
+- else
+- libc_cv_initfini_array=no
+- fi
++],
++ [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
++ libc_cv_initfini_array=yes
+ else
+ libc_cv_initfini_array=no
+- fi
+- rm -f conftest*])
++ fi],
++ [libc_cv_initfini_array=no])
++])
+ if test $libc_cv_initfini_array != yes; then
+ AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
+ fi
+@@ -1464,9 +1457,9 @@ EOF
+ AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
+ libc_cv_ctors_header, [dnl
+ libc_cv_ctors_header=yes
+- AC_TRY_LINK([], [
+-__attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
+-__attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
++ LIBC_TRY_LINK_STATIC([
++__attribute__ ((constructor)) void ctor (void) { asm (""); }
++__attribute__ ((destructor)) void dtor (void) { asm (""); }
+ ],
+ [dnl
+ AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
diff --git a/patches/glibc/2.15/991-builtin_expect.patch b/patches/glibc/2.15/991-builtin_expect.patch
new file mode 100644
index 0000000..8a327fa
--- /dev/null
+++ b/patches/glibc/2.15/991-builtin_expect.patch
@@ -0,0 +1,82 @@
+[As applied to 2.15]
+
+commit 3857022a761ea7251f8e5c0e45d382ebc3e34cf9
+Author: Ulrich Drepper <drepper@gmail.com>
+Date: Sun Jan 8 09:21:09 2012 -0500
+
+ No need for test for __builtin_expect
+
+diff -urpN glibc-2.15.orig/configure glibc-2.15/configure
+--- glibc-2.15.orig/configure 2017-02-08 12:47:52.580858002 -0800
++++ glibc-2.15/configure 2017-02-08 13:01:40.682870318 -0800
+@@ -7185,38 +7185,6 @@ if test "$libc_cv_c_asmcr0_bug" != 'no';
+ fi
+ fi
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_expect" >&5
+-$as_echo_n "checking for __builtin_expect... " >&6; }
+-if ${libc_cv_gcc_builtin_expect+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- cat > conftest.c <<EOF
+-#line $LINENO "configure"
+-int foo (int a)
+-{
+- a = __builtin_expect (a, 10);
+- return a == 10 ? 0 : 1;
+-}
+-EOF
+-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
+- -o conftest conftest.c -lgcc >&5'
+- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+- test $ac_status = 0; }; }; then
+- libc_cv_gcc_builtin_expect=yes
+-else
+- libc_cv_gcc_builtin_expect=no
+-fi
+-rm -f conftest*
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_builtin_expect" >&5
+-$as_echo "$libc_cv_gcc_builtin_expect" >&6; }
+-if test "$libc_cv_gcc_builtin_expect" = no; then
+- as_fn_error $? "support for __builtin_expect needed" "$LINENO" 5
+-fi
+-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_memset" >&5
+ $as_echo_n "checking for __builtin_memset... " >&6; }
+ if ${libc_cv_gcc_builtin_memset+:} false; then :
+diff -urpN glibc-2.15.orig/configure.in glibc-2.15/configure.in
+--- glibc-2.15.orig/configure.in 2017-02-08 12:47:52.580858002 -0800
++++ glibc-2.15/configure.in 2017-02-08 13:01:17.638580410 -0800
+@@ -2098,28 +2098,6 @@ if test "$libc_cv_c_asmcr0_bug" != 'no';
+ fi
+ fi
+
+-dnl Check whether compiler understands __builtin_expect.
+-AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
+-[cat > conftest.c <<EOF
+-#line $LINENO "configure"
+-int foo (int a)
+-{
+- a = __builtin_expect (a, 10);
+- return a == 10 ? 0 : 1;
+-}
+-EOF
+-dnl No \ in command here because it ends up inside ''.
+-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
+- -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
+- libc_cv_gcc_builtin_expect=yes
+-else
+- libc_cv_gcc_builtin_expect=no
+-fi
+-rm -f conftest*])
+-if test "$libc_cv_gcc_builtin_expect" = no; then
+- AC_MSG_ERROR([support for __builtin_expect needed])
+-fi
+-
+ AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
+ cat > conftest.c <<\EOF
+ void zero (void *x)
diff --git a/patches/glibc/2.15/992-gcc_s-suffix.patch b/patches/glibc/2.15/992-gcc_s-suffix.patch
new file mode 100644
index 0000000..6dbc70f
--- /dev/null
+++ b/patches/glibc/2.15/992-gcc_s-suffix.patch
@@ -0,0 +1,108 @@
+[As applied to 2.15]
+commit 3a533ca370725b68b516e6b74adf4727d17ed28a
+Author: Joseph Myers <joseph@codesourcery.com>
+Date: Tue Apr 24 10:22:45 2012 +0000
+
+ Don't handle libgcc_s suffixes.
+
+diff -urpN glibc-2.15.orig/config.make.in glibc-2.15/config.make.in
+--- glibc-2.15.orig/config.make.in 2017-02-08 13:24:23.338055977 -0800
++++ glibc-2.15/config.make.in 2017-02-08 13:25:21.810625337 -0800
+@@ -50,7 +50,6 @@ have-z-execstack = @libc_cv_z_execstack@
+ have-initfini = @libc_cv_have_initfini@
+ have-Bgroup = @libc_cv_Bgroup@
+ have-as-needed = @libc_cv_as_needed@
+-libgcc_s_suffix = @libc_cv_libgcc_s_suffix@
+ need-nopic-initfini = @nopic_initfini@
+ with-fp = @with_fp@
+ old-glibc-headers = @old_glibc_headers@
+diff -urpN glibc-2.15.orig/configure glibc-2.15/configure
+--- glibc-2.15.orig/configure 2017-02-08 13:24:23.346056054 -0800
++++ glibc-2.15/configure 2017-02-08 13:27:07.327670602 -0800
+@@ -654,7 +654,6 @@ libc_cv_z_execstack
+ libc_cv_z_combreloc
+ ASFLAGS_config
+ libc_cv_as_needed
+-libc_cv_libgcc_s_suffix
+ libc_cv_Bgroup
+ libc_cv_cc_with_libunwind
+ VERSIONING
+@@ -6465,24 +6464,6 @@ fi
+ $as_echo "$libc_cv_Bgroup" >&6; }
+
+
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgcc_s suffix" >&5
+-$as_echo_n "checking for libgcc_s suffix... " >&6; }
+-if ${libc_cv_libgcc_s_suffix+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- cat > conftest.c <<EOF
+-int main (void) { return 0; }
+-EOF
+- libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+- -fPIC -shared -shared-libgcc -o conftest.so \
+- conftest.c -v 2>&1 >/dev/null \
+- | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+- rm -f conftest*
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_libgcc_s_suffix" >&5
+-$as_echo "$libc_cv_libgcc_s_suffix" >&6; }
+-
+-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed option" >&5
+ $as_echo_n "checking for --as-needed option... " >&6; }
+ if ${libc_cv_as_needed+:} false; then :
+@@ -6493,7 +6474,7 @@ int main (void) { return 0; }
+ EOF
+ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -fPIC -shared -o conftest.so conftest.c
+- -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
++ -lgcc_s -Wl,--as-needed
+ -nostdlib 1>&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+diff -urpN glibc-2.15.orig/configure.in glibc-2.15/configure.in
+--- glibc-2.15.orig/configure.in 2017-02-08 13:24:23.346056054 -0800
++++ glibc-2.15/configure.in 2017-02-08 13:26:44.383441535 -0800
+@@ -1639,20 +1639,6 @@ EOF
+ rm -f conftest*])
+ AC_SUBST(libc_cv_Bgroup)
+
+- AC_CACHE_CHECK(for libgcc_s suffix,
+- libc_cv_libgcc_s_suffix, [dnl
+- cat > conftest.c <<EOF
+-int main (void) { return 0; }
+-EOF
+-changequote(,)dnl
+- libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+- -fPIC -shared -shared-libgcc -o conftest.so \
+- conftest.c -v 2>&1 >/dev/null \
+- | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+-changequote([,])dnl
+- rm -f conftest*])
+- AC_SUBST(libc_cv_libgcc_s_suffix)
+-
+ AC_CACHE_CHECK(for --as-needed option,
+ libc_cv_as_needed, [dnl
+ cat > conftest.c <<EOF
+@@ -1660,7 +1646,7 @@ int main (void) { return 0; }
+ EOF
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -fPIC -shared -o conftest.so conftest.c
+- -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
++ -lgcc_s -Wl,--as-needed
+ -nostdlib 1>&AS_MESSAGE_LOG_FD])
+ then
+ libc_cv_as_needed=yes
+diff -urpN glibc-2.15.orig/Makeconfig glibc-2.15/Makeconfig
+--- glibc-2.15.orig/Makeconfig 2017-02-08 13:24:23.338055977 -0800
++++ glibc-2.15/Makeconfig 2017-02-08 13:24:31.262132679 -0800
+@@ -565,7 +565,7 @@ endif
+ ifneq ($(have-as-needed),yes)
+ libgcc_eh := -lgcc_eh $(libunwind)
+ else
+- libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
++ libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
+ endif
+ gnulib := -lgcc $(libgcc_eh)
+ static-gnulib := -lgcc -lgcc_eh $(libunwind)
diff --git a/patches/glibc/2.15/999-new-tools.patch b/patches/glibc/2.15/999-new-tools.patch
new file mode 100644
index 0000000..e0632a3
--- /dev/null
+++ b/patches/glibc/2.15/999-new-tools.patch
@@ -0,0 +1,69 @@
+diff -urpN glibc-2.15.orig/configure glibc-2.15/configure
+--- glibc-2.15.orig/configure 2012-03-19 07:56:58.000000000 -0700
++++ glibc-2.15/configure 2017-02-08 00:38:53.578049806 -0800
+@@ -4922,7 +4922,7 @@ $as_echo_n "checking version of $CC... "
+ ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.4* | 4.[0-9]* )
++ 3.4* | [4-9].* )
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -4985,7 +4985,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5112,7 +5112,7 @@ $as_echo_n "checking version of $MAKEINF
+ ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 4.*)
++ [4-9].*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5172,7 +5172,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.15.orig/configure.in glibc-2.15/configure.in
+--- glibc-2.15.orig/configure.in 2012-01-01 04:16:32.000000000 -0800
++++ glibc-2.15/configure.in 2017-02-08 00:30:47.440841480 -0800
+@@ -1000,11 +1000,11 @@ fi
+ # These programs are version sensitive.
+ AC_CHECK_TOOL_PREFIX
+ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+- [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
++ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | [4-9].* ],
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+@@ -1012,10 +1012,10 @@ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsg
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+ AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+- [4.*],
++ [[4-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+ AC_CHECK_PROG_VER(SED, sed, --version,
+- [GNU sed version \([0-9]*\.[0-9.]*\)],
++ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+
diff --git a/patches/glibc/2.16.0/500-fix-parsing-of-numeric-hosts-in-gethostbyname_r.patch b/patches/glibc/2.16.0/500-fix-parsing-of-numeric-hosts-in-gethostbyname_r.patch
new file mode 100644
index 0000000..803ac6f
--- /dev/null
+++ b/patches/glibc/2.16.0/500-fix-parsing-of-numeric-hosts-in-gethostbyname_r.patch
@@ -0,0 +1,222 @@
+From 536ae0651b015b1f6140ec01775d4deaacf12c0c Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@suse.de>
+Date: Mon, 21 Jan 2013 17:41:28 +0100
+Subject: [PATCH] Fix parsing of numeric hosts in gethostbyname_r
+
+Ported from master, fixes CVE-2015-0235.
+---
+ nss/Makefile | 2 -
+ nss/digits_dots.c | 73 +++++++++++++------------------------------------
+ nss/getXXbyYY_r.c | 3 ++
+ nss/test-digits-dots.c | 38 +++++++++++++++++++++++++
+ 4 files changed, 62 insertions(+), 54 deletions(-)
+ create mode 100644 nss/test-digits-dots.c
+
+--- a/nss/Makefile
++++ b/nss/Makefile
+@@ -38,7 +38,7 @@ install-bin := getent makedb
+ makedb-modules = xmalloc hash-string
+ extra-objs += $(makedb-modules:=.o)
+
+-tests = test-netdb tst-nss-test1
++tests = test-netdb tst-nss-test1 test-digits-dots
+ xtests = bug-erange
+
+ include ../Makeconfig
+--- a/nss/digits_dots.c
++++ b/nss/digits_dots.c
+@@ -46,7 +46,10 @@ __nss_hostname_digits_dots (const char *
+ {
+ if (h_errnop)
+ *h_errnop = NETDB_INTERNAL;
+- *result = NULL;
++ if (buffer_size == NULL)
++ *status = NSS_STATUS_TRYAGAIN;
++ else
++ *result = NULL;
+ return -1;
+ }
+
+@@ -83,14 +86,16 @@ __nss_hostname_digits_dots (const char *
+ }
+
+ size_needed = (sizeof (*host_addr)
+- + sizeof (*h_addr_ptrs) + strlen (name) + 1);
++ + sizeof (*h_addr_ptrs)
++ + sizeof (*h_alias_ptr) + strlen (name) + 1);
+
+ if (buffer_size == NULL)
+ {
+ if (buflen < size_needed)
+ {
++ *status = NSS_STATUS_TRYAGAIN;
+ if (h_errnop != NULL)
+- *h_errnop = TRY_AGAIN;
++ *h_errnop = NETDB_INTERNAL;
+ __set_errno (ERANGE);
+ goto done;
+ }
+@@ -109,7 +114,7 @@ __nss_hostname_digits_dots (const char *
+ *buffer_size = 0;
+ __set_errno (save);
+ if (h_errnop != NULL)
+- *h_errnop = TRY_AGAIN;
++ *h_errnop = NETDB_INTERNAL;
+ *result = NULL;
+ goto done;
+ }
+@@ -149,7 +154,9 @@ __nss_hostname_digits_dots (const char *
+ if (! ok)
+ {
+ *h_errnop = HOST_NOT_FOUND;
+- if (buffer_size)
++ if (buffer_size == NULL)
++ *status = NSS_STATUS_NOTFOUND;
++ else
+ *result = NULL;
+ goto done;
+ }
+@@ -190,7 +197,7 @@ __nss_hostname_digits_dots (const char *
+ if (buffer_size == NULL)
+ *status = NSS_STATUS_SUCCESS;
+ else
+- *result = resbuf;
++ *result = resbuf;
+ goto done;
+ }
+
+@@ -201,15 +208,6 @@ __nss_hostname_digits_dots (const char *
+
+ if ((isxdigit (name[0]) && strchr (name, ':') != NULL) || name[0] == ':')
+ {
+- const char *cp;
+- char *hostname;
+- typedef unsigned char host_addr_t[16];
+- host_addr_t *host_addr;
+- typedef char *host_addr_list_t[2];
+- host_addr_list_t *h_addr_ptrs;
+- size_t size_needed;
+- int addr_size;
+-
+ switch (af)
+ {
+ default:
+@@ -225,7 +223,10 @@ __nss_hostname_digits_dots (const char *
+ /* This is not possible. We cannot represent an IPv6 address
+ in an `struct in_addr' variable. */
+ *h_errnop = HOST_NOT_FOUND;
+- *result = NULL;
++ if (buffer_size == NULL)
++ *status = NSS_STATUS_NOTFOUND;
++ else
++ *result = NULL;
+ goto done;
+
+ case AF_INET6:
+@@ -233,42 +234,6 @@ __nss_hostname_digits_dots (const char *
+ break;
+ }
+
+- size_needed = (sizeof (*host_addr)
+- + sizeof (*h_addr_ptrs) + strlen (name) + 1);
+-
+- if (buffer_size == NULL && buflen < size_needed)
+- {
+- if (h_errnop != NULL)
+- *h_errnop = TRY_AGAIN;
+- __set_errno (ERANGE);
+- goto done;
+- }
+- else if (buffer_size != NULL && *buffer_size < size_needed)
+- {
+- char *new_buf;
+- *buffer_size = size_needed;
+- new_buf = realloc (*buffer, *buffer_size);
+-
+- if (new_buf == NULL)
+- {
+- save = errno;
+- free (*buffer);
+- __set_errno (save);
+- *buffer = NULL;
+- *buffer_size = 0;
+- *result = NULL;
+- goto done;
+- }
+- *buffer = new_buf;
+- }
+-
+- memset (*buffer, '\0', size_needed);
+-
+- host_addr = (host_addr_t *) *buffer;
+- h_addr_ptrs = (host_addr_list_t *)
+- ((char *) host_addr + sizeof (*host_addr));
+- hostname = (char *) h_addr_ptrs + sizeof (*h_addr_ptrs);
+-
+ for (cp = name;; ++cp)
+ {
+ if (!*cp)
+@@ -281,7 +246,9 @@ __nss_hostname_digits_dots (const char *
+ if (inet_pton (AF_INET6, name, host_addr) <= 0)
+ {
+ *h_errnop = HOST_NOT_FOUND;
+- if (buffer_size)
++ if (buffer_size == NULL)
++ *status = NSS_STATUS_NOTFOUND;
++ else
+ *result = NULL;
+ goto done;
+ }
+--- /dev/null
++++ b/nss/test-digits-dots.c
+@@ -0,0 +1,38 @@
++/* Copyright (C) 2013 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/>. */
++
++/* Testcase for BZ #15014 */
++
++#include <stdlib.h>
++#include <netdb.h>
++#include <errno.h>
++
++static int
++do_test (void)
++{
++ char buf[32];
++ struct hostent *result = NULL;
++ struct hostent ret;
++ int h_err = 0;
++ int err;
++
++ err = gethostbyname_r ("1.2.3.4", &ret, buf, sizeof (buf), &result, &h_err);
++ return err == ERANGE && h_err == NETDB_INTERNAL ? EXIT_SUCCESS : EXIT_FAILURE;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+--- a/nss/getXXbyYY_r.c
++++ b/nss/getXXbyYY_r.c
+@@ -179,6 +179,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L
+ case -1:
+ return errno;
+ case 1:
++#ifdef NEED_H_ERRNO
++ any_service = true;
++#endif
+ goto done;
+ }
+ #endif
diff --git a/patches/glibc/2.16.0/999-new-tools.patch b/patches/glibc/2.16.0/999-new-tools.patch
new file mode 100644
index 0000000..e753365
--- /dev/null
+++ b/patches/glibc/2.16.0/999-new-tools.patch
@@ -0,0 +1,33 @@
+diff -urpN glibc-2.16.0.orig/configure glibc-2.16.0/configure
+--- glibc-2.16.0.orig/configure 2012-06-30 12:12:34.000000000 -0700
++++ glibc-2.16.0/configure 2017-02-08 00:39:03.778150878 -0800
+@@ -4845,7 +4845,7 @@ $as_echo_n "checking version of $MAKE...
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+@@ -5032,7 +5032,7 @@ else
+ # Found it, now check the version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
+ $as_echo_n "checking version of $SED... " >&6; }
+- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 3.0[2-9]*|3.[1-9]*|[4-9]*)
+diff -urpN glibc-2.16.0.orig/configure.in glibc-2.16.0/configure.in
+--- glibc-2.16.0.orig/configure.in 2012-06-30 12:12:34.000000000 -0700
++++ glibc-2.16.0/configure.in 2017-02-08 00:14:07.996446792 -0800
+@@ -940,7 +940,7 @@ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}g
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
diff --git a/patches/glibc/2.17/100-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/2.17/100-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..59f95aa
--- /dev/null
+++ b/patches/glibc/2.17/100-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,54 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c b/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+index 6ccd9b4..660d148 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -22,7 +22,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -20,7 +20,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+
+--
+1.9.4
+
diff --git a/patches/glibc/2.17/120-support-make4.patch b/patches/glibc/2.17/120-support-make4.patch
new file mode 100644
index 0000000..ca2bae0
--- /dev/null
+++ b/patches/glibc/2.17/120-support-make4.patch
@@ -0,0 +1,38 @@
+Original patch modified: Removed ChangeLog and NEWS sections, ajdust for configure.in
+KS
+
+From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
+Date: Thu, 31 Oct 2013 02:37:50 +0000 (+1000)
+Subject: Accept make versions 4.0 and greater
+X-Git-Tag: glibc-2.19~556
+X-Git-Url: https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=28d708c44bc47b56f6551ff285f78edcf61c208a;hp=a56ee40b176d0a3f47f2a7eb75208f2e3763c9fd
+
+Accept make versions 4.0 and greater
+---
+
+diff --git a/configure b/configure
+index f382138..5e61abd 100755
+--- a/configure
++++ b/configure
+@@ -4761,7 +4761,7 @@ $as_echo_n "checking version of $MAKE... " >&6; }
+ ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 3.79* | 3.[89]*)
++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+
+diff --git a/configure.in b/configure.in
+index 49b70fd..6da8efd 100644
+--- a/configure.in
++++ b/configure.in
+@@ -984,7 +984,7 @@ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
+ critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
diff --git a/patches/glibc/ports-2.12.1/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.12.1/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..1a632fe
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,72 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
diff --git a/patches/glibc/ports-2.12.1/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.12.1/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..ed022be
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,25 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.12.1.orig/Makeconfig glibc-2.12.1/Makeconfig
+--- glibc-2.12.1.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.12.1/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -697,6 +697,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
+diff -durN glibc-2.12.1.orig/config.make.in glibc-2.12.1/config.make.in
+--- glibc-2.12.1.orig/config.make.in 2009-05-09 17:59:38.000000000 +0200
++++ glibc-2.12.1/config.make.in 2009-11-13 00:49:41.000000000 +0100
+@@ -107,6 +107,7 @@
+ CXX = @CXX@
+ BUILD_CC = @BUILD_CC@
+ CFLAGS = @CFLAGS@
++CPPFLAGS-config = @CPPFLAGS@
+ ASFLAGS-config = @ASFLAGS_config@
+ AR = @AR@
+ RANLIB = @RANLIB@
diff --git a/patches/glibc/ports-2.12.1/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.12.1/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..95f5ace
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.12.1/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.12.1/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.12.1/140-disable-ldconfig.patch b/patches/glibc/ports-2.12.1/140-disable-ldconfig.patch
new file mode 100644
index 0000000..43330b8
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.12.1.orig/Makefile glibc-2.12.1/Makefile
+--- glibc-2.12.1.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.12.1/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.12.1/150-queue-header-updates.patch b/patches/glibc/ports-2.12.1/150-queue-header-updates.patch
new file mode 100644
index 0000000..fe625e1
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.12.1.orig/misc/sys/queue.h glibc-2.12.1/misc/sys/queue.h
+
+diff -durN glibc-2.12.1.orig/misc/sys/queue.h glibc-2.12.1/misc/sys/queue.h
+--- glibc-2.12.1.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.12.1/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.12.1/160-manual-no-perl.patch b/patches/glibc/ports-2.12.1/160-manual-no-perl.patch
new file mode 100644
index 0000000..2eb5414
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/160-manual-no-perl.patch
@@ -0,0 +1,24 @@
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+diff -durN glibc-2.12.1.orig/manual/Makefile glibc-2.12.1/manual/Makefile
+--- glibc-2.12.1.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2.12.1/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/ports-2.12.1/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.12.1/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..0e05844
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.12.1.orig/locale/programs/3level.h glibc-2.12.1/locale/programs/3level.h
+--- glibc-2.12.1.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.12.1/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.12.1/180-resolv-dynamic.patch b/patches/glibc/ports-2.12.1/180-resolv-dynamic.patch
new file mode 100644
index 0000000..8f74a53
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.12.1.orig/resolv/res_libc.c glibc-2.12.1/resolv/res_libc.c
+--- glibc-2.12.1.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.12.1/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.12.1/190-localedef-mmap.patch b/patches/glibc/ports-2.12.1/190-localedef-mmap.patch
new file mode 100644
index 0000000..b24ed80
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/190-localedef-mmap.patch
@@ -0,0 +1,39 @@
+sniped from Debian
+http://bugs.gentoo.org/289615
+
+2009-10-27 Aurelien Jarno <aurelien@aurel32.net>
+
+ * locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
+ used later with MMAP_FIXED | MMAP_SHARED to cope with different
+ alignment restrictions.
+
+diff -durN glibc-2.12.1.orig/locale/programs/locarchive.c glibc-2.12.1/locale/programs/locarchive.c
+--- glibc-2.12.1.orig/locale/programs/locarchive.c 2009-04-27 16:07:47.000000000 +0200
++++ glibc-2.12.1/locale/programs/locarchive.c 2009-11-13 00:50:01.000000000 +0100
+@@ -134,7 +134,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -396,7 +396,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -614,7 +614,7 @@
+ int xflags = 0;
+ void *p;
+ if (st.st_size < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
diff --git a/patches/glibc/ports-2.12.1/200-fadvise64_64.patch b/patches/glibc/ports-2.12.1/200-fadvise64_64.patch
new file mode 100644
index 0000000..a9f10cd
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.12.1/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.12.1/220-section-comments.patch b/patches/glibc/ports-2.12.1/220-section-comments.patch
new file mode 100644
index 0000000..4d35535
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/220-section-comments.patch
@@ -0,0 +1,24 @@
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+diff -durN glibc-2.12.1.orig/include/libc-symbols.h glibc-2.12.1/include/libc-symbols.h
+--- glibc-2.12.1.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
++++ glibc-2.12.1/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
+@@ -239,12 +239,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/ports-2.12.1/230-no-inline-gmon.patch b/patches/glibc/ports-2.12.1/230-no-inline-gmon.patch
new file mode 100644
index 0000000..594fb79
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/230-no-inline-gmon.patch
@@ -0,0 +1,36 @@
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+Index: sysdeps/generic/initfini.c
+===================================================================
+
+diff -durN glibc-2.12.1.orig/sysdeps/generic/initfini.c glibc-2.12.1/sysdeps/generic/initfini.c
+--- glibc-2.12.1.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2.12.1/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/ports-2.12.1/240-check_native-headers.patch b/patches/glibc/ports-2.12.1/240-check_native-headers.patch
new file mode 100644
index 0000000..de0cb5b
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/240-check_native-headers.patch
@@ -0,0 +1,17 @@
+many ports hit this warning:
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+
+snipped from suse
+
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.12.1/sysdeps/unix/sysv/linux/check_native.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/check_native.c 2007-11-24 04:12:17.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/check_native.c 2009-11-13 00:50:11.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <net/if.h>
diff --git a/patches/glibc/ports-2.12.1/250-fix-pr631.patch b/patches/glibc/ports-2.12.1/250-fix-pr631.patch
new file mode 100644
index 0000000..af5b347
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/250-fix-pr631.patch
@@ -0,0 +1,45 @@
+From dank@kegel.com
+Wed Jun 15 09:12:43 PDT 2005
+
+Fixes
+
+build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
+build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
+... 53 lines deleted ...
+build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
+collect2: ld returned 1 exit status
+make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1
+
+when building glibc with --enable-static-nss.
+
+See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
+
+diff -durN glibc-2.12.1.orig/Makeconfig glibc-2.12.1/Makeconfig
+--- glibc-2.12.1.orig/Makeconfig 2009-11-13 00:49:41.000000000 +0100
++++ glibc-2.12.1/Makeconfig 2009-11-13 00:50:13.000000000 +0100
+@@ -531,7 +531,7 @@
+
+ # The static libraries.
+ ifeq (yes,$(build-static))
+-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
+ else
+ ifeq (yes,$(build-shared))
+ # We can try to link the programs with lib*_pic.a...
+diff -durN glibc-2.12.1.orig/elf/Makefile glibc-2.12.1/elf/Makefile
+--- glibc-2.12.1.orig/elf/Makefile 2009-01-31 01:20:55.000000000 +0100
++++ glibc-2.12.1/elf/Makefile 2009-11-13 00:50:13.000000000 +0100
+@@ -146,6 +146,13 @@
+ install-bin-script = ldd
+ endif
+
++ifeq (yes,$(build-static-nss))
++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
++ $(resolvobjdir)/libresolv.a
++endif
++
+ others = sprof sln
+ install-bin = sprof
+ others-static = sln
diff --git a/patches/glibc/ports-2.12.1/260-assume-pipe2.patch b/patches/glibc/ports-2.12.1/260-assume-pipe2.patch
new file mode 100644
index 0000000..b84f882
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.12.1.orig/socket/have_sock_cloexec.c glibc-2.12.1/socket/have_sock_cloexec.c
+--- glibc-2.12.1.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.12.1/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.12.1/270-china.patch b/patches/glibc/ports-2.12.1/270-china.patch
new file mode 100644
index 0000000..4cde1cf
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.12.1.orig/localedata/locales/zh_TW glibc-2.12.1/localedata/locales/zh_TW
+--- glibc-2.12.1.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.12.1/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.12.1/280-new-valencian-locale.patch b/patches/glibc/ports-2.12.1/280-new-valencian-locale.patch
new file mode 100644
index 0000000..6b46b44
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.12.1.orig/localedata/SUPPORTED glibc-2.12.1/localedata/SUPPORTED
+--- glibc-2.12.1.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.12.1/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.12.1.orig/localedata/locales/ca_ES@valencia glibc-2.12.1/localedata/locales/ca_ES@valencia
+--- glibc-2.12.1.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.12.1/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.12.1/300-nscd-one-fork.patch b/patches/glibc/ports-2.12.1/300-nscd-one-fork.patch
new file mode 100644
index 0000000..27eae51
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/300-nscd-one-fork.patch
@@ -0,0 +1,40 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.12.1.orig/nscd/nscd.c glibc-2.12.1/nscd/nscd.c
+--- glibc-2.12.1.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.12.1/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -182,6 +182,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -231,12 +234,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.12.1/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.12.1/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..947bb58
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.12.1.orig/elf/rtld.c glibc-2.12.1/elf/rtld.c
+--- glibc-2.12.1.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.12.1/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -390,14 +390,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.12.1.orig/include/atomic.h glibc-2.12.1/include/atomic.h
+--- glibc-2.12.1.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.12.1/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.12.1.orig/nptl/Makefile glibc-2.12.1/nptl/Makefile
+--- glibc-2.12.1.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.12.1/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -264,9 +264,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -425,6 +425,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.12.1.orig/nptl/pthread_barrier_wait.c glibc-2.12.1/nptl/pthread_barrier_wait.c
+--- glibc-2.12.1.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.12.1/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.12.1.orig/nptl/sysdeps/pthread/Makefile glibc-2.12.1/nptl/sysdeps/pthread/Makefile
+--- glibc-2.12.1.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.12.1/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.12.1.orig/stdio-common/Makefile glibc-2.12.1/stdio-common/Makefile
+--- glibc-2.12.1.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.12.1/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.12.1.orig/sunrpc/clnt_udp.c glibc-2.12.1/sunrpc/clnt_udp.c
+--- glibc-2.12.1.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.12.1/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.12.1/330-m68k-sys-user.patch b/patches/glibc/ports-2.12.1/330-m68k-sys-user.patch
new file mode 100644
index 0000000..b441691
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.12.1.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.12.1/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..afdb39c
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.12.1.orig/nptl/allocatestack.c glibc-2.12.1/nptl/allocatestack.c
+--- glibc-2.12.1.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.12.1/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.12.1/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.12.1/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.12.1/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..3f03169
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.12.1.orig/elf/elf.h glibc-2.12.1/elf/elf.h
+--- glibc-2.12.1.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.12.1/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..a847cdb
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.12.1.orig/grp/tst_fgetgrent.sh glibc-2.12.1/grp/tst_fgetgrent.sh
+--- glibc-2.12.1.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.12.1/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.12.1.orig/iconvdata/run-iconv-test.sh glibc-2.12.1/iconvdata/run-iconv-test.sh
+--- glibc-2.12.1.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.12.1/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.12.1.orig/iconvdata/tst-table.sh glibc-2.12.1/iconvdata/tst-table.sh
+--- glibc-2.12.1.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.12.1/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.12.1.orig/intl/tst-codeset.sh glibc-2.12.1/intl/tst-codeset.sh
+--- glibc-2.12.1.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.12.1/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.12.1.orig/intl/tst-gettext.sh glibc-2.12.1/intl/tst-gettext.sh
+--- glibc-2.12.1.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.12.1/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.12.1.orig/intl/tst-gettext2.sh glibc-2.12.1/intl/tst-gettext2.sh
+--- glibc-2.12.1.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.12.1/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.12.1.orig/intl/tst-translit.sh glibc-2.12.1/intl/tst-translit.sh
+--- glibc-2.12.1.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.12.1/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.12.1.orig/malloc/tst-mtrace.sh glibc-2.12.1/malloc/tst-mtrace.sh
+--- glibc-2.12.1.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.12.1/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.12.1.orig/nptl/tst-tls6.sh glibc-2.12.1/nptl/tst-tls6.sh
+--- glibc-2.12.1.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.12.1/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.12.1.orig/posix/globtest.sh glibc-2.12.1/posix/globtest.sh
+--- glibc-2.12.1.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.12.1/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.12.1.orig/posix/tst-getconf.sh glibc-2.12.1/posix/tst-getconf.sh
+--- glibc-2.12.1.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.12.1/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.12.1.orig/posix/wordexp-tst.sh glibc-2.12.1/posix/wordexp-tst.sh
+--- glibc-2.12.1.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.12.1/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.12.1/370-fnmatch.patch b/patches/glibc/ports-2.12.1/370-fnmatch.patch
new file mode 100644
index 0000000..f345b35
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/370-fnmatch.patch
@@ -0,0 +1,62 @@
+http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
+
+When fnmatch detects an invalid multibyte character it should fall back to
+single byte matching, so that "*" has a chance to match such a string.
+
+Andreas.
+
+2005-04-12 Andreas Schwab <schwab@suse.de>
+
+ * posix/fnmatch.c (fnmatch): If conversion to wide character
+ fails fall back to single byte matching.
+
+Index: posix/fnmatch.c
+===================================================================
+
+diff -durN glibc-2.12.1.orig/posix/fnmatch.c glibc-2.12.1/posix/fnmatch.c
+--- glibc-2.12.1.orig/posix/fnmatch.c 2007-07-28 22:35:00.000000000 +0200
++++ glibc-2.12.1/posix/fnmatch.c 2009-11-13 00:50:39.000000000 +0100
+@@ -327,6 +327,7 @@
+ # if HANDLE_MULTIBYTE
+ if (__builtin_expect (MB_CUR_MAX, 1) != 1)
+ {
++ const char *orig_pattern = pattern;
+ mbstate_t ps;
+ size_t n;
+ const char *p;
+@@ -382,10 +383,8 @@
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ n = mbsrtowcs (wstring, &p, n + 1, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ if (p)
+ {
+ memset (&ps, '\0', sizeof (ps));
+@@ -397,10 +396,8 @@
+ prepare_wstring:
+ n = mbsrtowcs (NULL, &string, 0, &ps);
+ if (__builtin_expect (n == (size_t) -1, 0))
+- /* Something wrong.
+- XXX Do we have to set `errno' to something which mbsrtows hasn't
+- already done? */
+- return -1;
++ /* Something wrong. Fall back to single byte matching. */
++ goto try_singlebyte;
+ wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
+ assert (mbsinit (&ps));
+ (void) mbsrtowcs (wstring, &string, n + 1, &ps);
+@@ -408,6 +405,9 @@
+
+ return internal_fnwmatch (wpattern, wstring, wstring + n,
+ flags & FNM_PERIOD, flags, NULL);
++
++ try_singlebyte:
++ pattern = orig_pattern;
+ }
+ # endif /* mbstate_t and mbsrtowcs or _LIBC. */
+
diff --git a/patches/glibc/ports-2.12.1/380-dont-build-timezone.patch b/patches/glibc/ports-2.12.1/380-dont-build-timezone.patch
new file mode 100644
index 0000000..0a30436
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.12.1.orig/Makeconfig glibc-2.12.1/Makeconfig
+--- glibc-2.12.1.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.12.1/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.12.1/400-alpha-xstat.patch b/patches/glibc/ports-2.12.1/400-alpha-xstat.patch
new file mode 100644
index 0000000..97bea98
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.12.1/430-alpha-creat.patch b/patches/glibc/ports-2.12.1/430-alpha-creat.patch
new file mode 100644
index 0000000..bfb72d0
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.12.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.12.1/440-alpha-cache-shape.patch b/patches/glibc/ports-2.12.1/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..ea85e99
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.12.1/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.12.1/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..6438267
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.12.1.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.12.1/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.12.1/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.12.1/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..9d35ebd
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.12.1/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -20,6 +20,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+
+ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.12.1/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.12.1/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.12.1/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.12.1/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..621a6f3
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/alpha/Makefile glibc-2.12.1/glibc-ports-2.12.1/sysdeps/alpha/Makefile
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.12.1.orig/ports/sysdeps/alpha/Makefile glibc-2.12.1/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.12.1/560-ppc-atomic.patch b/patches/glibc/ports-2.12.1/560-ppc-atomic.patch
new file mode 100644
index 0000000..679ef18
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.12.1.orig/sysdeps/powerpc/bits/atomic.h glibc-2.12.1/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.12.1.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.12.1/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.12.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.12.1/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.12.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.12.1/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.12.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.12.1/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.12.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.12.1/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.12.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch b/patches/glibc/ports-2.12.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
new file mode 100644
index 0000000..fc42a92
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
@@ -0,0 +1,374 @@
+http://yann.poupet.free.fr/ep93xx/
+Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/bits/endian.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/bits/endian.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
+@@ -12,7 +12,7 @@
+ /* FPA floating point units are always big-endian, irrespective of the
+ CPU endianness. VFP floating point units use the same endianness
+ as the rest of the system. */
+-#ifdef __VFP_FP__
++#if defined __VFP_FP__ || defined __MAVERICK__
+ #define __FLOAT_WORD_ORDER __BYTE_ORDER
+ #else
+ #define __FLOAT_WORD_ORDER __BIG_ENDIAN
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/__longjmp.S glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/__longjmp.S
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -30,7 +30,33 @@
+ movs r0, r1 /* get the return value in place */
+ moveq r0, #1 /* can't let setjmp() return zero! */
+
++#ifdef __MAVERICK__
++ cfldrd mvd4, [ip], #8
++ nop
++ cfldrd mvd5, [ip], #8
++ nop
++ cfldrd mvd6, [ip], #8
++ nop
++ cfldrd mvd7, [ip], #8
++ nop
++ cfldrd mvd8, [ip], #8
++ nop
++ cfldrd mvd9, [ip], #8
++ nop
++ cfldrd mvd10, [ip], #8
++ nop
++ cfldrd mvd11, [ip], #8
++ nop
++ cfldrd mvd12, [ip], #8
++ nop
++ cfldrd mvd13, [ip], #8
++ nop
++ cfldrd mvd14, [ip], #8
++ nop
++ cfldrd mvd15, [ip], #8
++#else
+ lfmfd f4, 4, [ip] ! /* load the floating point regs */
++#endif
+
+ LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
+ END (__longjmp)
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/fenv.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/fenv.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
+@@ -20,6 +20,45 @@
+ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+ #endif
+
++#if defined(__MAVERICK__)
++
++/* Define bits representing exceptions in the FPU status word. */
++enum
++ {
++ FE_INVALID = 1,
++#define FE_INVALID FE_INVALID
++ FE_OVERFLOW = 4,
++#define FE_OVERFLOW FE_OVERFLOW
++ FE_UNDERFLOW = 8,
++#define FE_UNDERFLOW FE_UNDERFLOW
++ FE_INEXACT = 16,
++#define FE_INEXACT FE_INEXACT
++ };
++
++/* Amount to shift by to convert an exception to a mask bit. */
++#define FE_EXCEPT_SHIFT 5
++
++/* All supported exceptions. */
++#define FE_ALL_EXCEPT \
++ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
++
++/* IEEE rounding modes. */
++enum
++ {
++ FE_TONEAREST = 0,
++#define FE_TONEAREST FE_TONEAREST
++ FE_TOWARDZERO = 0x400,
++#define FE_TOWARDZERO FE_TOWARDZERO
++ FE_DOWNWARD = 0x800,
++#define FE_DOWNWARD FE_DOWNWARD
++ FE_UPWARD = 0xc00,
++#define FE_UPWARD FE_UPWARD
++ };
++
++#define FE_ROUND_MASK (FE_UPWARD)
++
++#else /* FPA */
++
+ /* Define bits representing exceptions in the FPU status word. */
+ enum
+ {
+@@ -44,6 +83,8 @@
+ modes exist, but you have to encode them in the actual instruction. */
+ #define FE_TONEAREST 0
+
++#endif
++
+ /* Type representing exception flags. */
+ typedef unsigned long int fexcept_t;
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/setjmp.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/setjmp.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
+@@ -28,7 +28,11 @@
+ #ifndef _ASM
+ /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
+ saved. */
++#ifdef __MAVERICK__
++typedef int __jmp_buf[34];
++#else
+ typedef int __jmp_buf[22];
+ #endif
++#endif
+
+ #endif
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fegetround.c glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fegetround.c
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,9 +18,21 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fegetround (void)
+ {
++#if defined(__MAVERICK__)
++
++ unsigned long temp;
++
++ _FPU_GETCW (temp);
++ return temp & FE_ROUND_MASK;
++
++#else /* FPA */
++
+ return FE_TONEAREST; /* Easy. :-) */
++
++#endif
+ }
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fesetround.c glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fesetround.c
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,12 +18,28 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fesetround (int round)
+ {
++#if defined(__MAVERICK__)
++ unsigned long temp;
++
++ if (round & ~FE_ROUND_MASK)
++ return 1;
++
++ _FPU_GETCW (temp);
++ temp = (temp & ~FE_ROUND_MASK) | round;
++ _FPU_SETCW (temp);
++ return 0;
++
++#else /* FPA */
++
+ /* We only support FE_TONEAREST, so there is no need for any work. */
+ return (round == FE_TONEAREST)?0:1;
++
++#endif
+ }
+
+ libm_hidden_def (fesetround)
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fpu_control.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fpu_control.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
+@@ -1,5 +1,6 @@
+ /* FPU control word definitions. ARM version.
+- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2005
++ 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
+@@ -20,6 +21,79 @@
+ #ifndef _FPU_CONTROL_H
+ #define _FPU_CONTROL_H
+
++#if defined(__MAVERICK__)
++
++/* DSPSC register: (from EP9312 User's Guide)
++ *
++ * bits 31..29 - DAID
++ * bits 28..26 - HVID
++ * bits 25..24 - RSVD
++ * bit 23 - ISAT
++ * bit 22 - UI
++ * bit 21 - INT
++ * bit 20 - AEXC
++ * bits 19..18 - SAT
++ * bits 17..16 - FCC
++ * bit 15 - V
++ * bit 14 - FWDEN
++ * bit 13 - Invalid
++ * bit 12 - Denorm
++ * bits 11..10 - RM
++ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
++ * bits 4..0 - IX, UF, OF, RSVD, IO
++ */
++
++/* masking of interrupts */
++#define _FPU_MASK_IM (1 << 5) /* invalid operation */
++#define _FPU_MASK_ZM 0 /* divide by zero */
++#define _FPU_MASK_OM (1 << 7) /* overflow */
++#define _FPU_MASK_UM (1 << 8) /* underflow */
++#define _FPU_MASK_PM (1 << 9) /* inexact */
++#define _FPU_MASK_DM 0 /* denormalized operation */
++
++#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
++
++#define _FPU_DEFAULT 0x00b00000 /* Default value. */
++#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t;
++
++/* Macros for accessing the hardware control word. */
++#define _FPU_GETCW(cw) ({ \
++ register int __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv32sc mvdx0, dspsc\n\t" \
++ "cfmvr64l %0, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
++ ); \
++})
++
++#define _FPU_SETCW(cw) ({ \
++ register int __t0, __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %0\n\t" \
++ "cfmvsc32 dspsc, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
++ : "0" (cw) \
++ ); \
++})
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#else /* FPA */
++
+ /* We have a slight terminology confusion here. On the ARM, the register
+ * we're interested in is actually the FPU status word - the FPU control
+ * word is something different (which is implementation-defined and only
+@@ -99,4 +173,6 @@
+ /* Default control word set at startup. */
+ extern fpu_control_t __fpu_control;
+
++#endif
++
+ #endif /* _FPU_CONTROL_H */
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/jmpbuf-offsets.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,4 +17,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define __JMP_BUF_SP 32
++#else
+ #define __JMP_BUF_SP 20
++#endif
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/setjmp.S glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/setjmp.S
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -24,11 +24,41 @@
+
+ ENTRY (__sigsetjmp)
+ /* Save registers */
++#ifdef __MAVERICK__
++ cfstrd mvd4, [r0], #8
++ nop
++ cfstrd mvd5, [r0], #8
++ nop
++ cfstrd mvd6, [r0], #8
++ nop
++ cfstrd mvd7, [r0], #8
++ nop
++ cfstrd mvd8, [r0], #8
++ nop
++ cfstrd mvd9, [r0], #8
++ nop
++ cfstrd mvd10, [r0], #8
++ nop
++ cfstrd mvd11, [r0], #8
++ nop
++ cfstrd mvd12, [r0], #8
++ nop
++ cfstrd mvd13, [r0], #8
++ nop
++ cfstrd mvd14, [r0], #8
++ nop
++ cfstrd mvd15, [r0], #8
++#else
+ sfmea f4, 4, [r0]!
++#endif
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Restore pointer to jmp_buf */
++#ifdef __MAVERICK__
++ sub r0, r0, #96
++#else
+ sub r0, r0, #48
++#endif
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/gccframe.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/gccframe.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,6 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define FIRST_PSEUDO_REGISTER 43
++#else
+ #define FIRST_PSEUDO_REGISTER 27
++#endif
+
+ #include <sysdeps/generic/gccframe.h>
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/gmp-mparam.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/gmp-mparam.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
+@@ -29,7 +29,7 @@
+ #if defined(__ARMEB__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 1
+-#elif defined(__VFP_FP__)
++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 0
+ #else
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/bits/endian.h glibc-2.12.1/ports/sysdeps/arm/bits/endian.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.12.1/ports/sysdeps/arm/fpu/__longjmp.S
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.12.1/ports/sysdeps/arm/fpu/bits/fenv.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.12.1/ports/sysdeps/arm/fpu/bits/setjmp.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.12.1/ports/sysdeps/arm/fpu/fegetround.c
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.12.1/ports/sysdeps/arm/fpu/fesetround.c
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.12.1/ports/sysdeps/arm/fpu/fpu_control.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.12.1/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.12.1/ports/sysdeps/arm/fpu/setjmp.S
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/gccframe.h glibc-2.12.1/ports/sysdeps/arm/gccframe.h
+diff -durN glibc-2.12.1.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.12.1/ports/sysdeps/arm/gmp-mparam.h
diff --git a/patches/glibc/ports-2.12.1/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.12.1/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..c243a76
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.12.1.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.12.1/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.12.1/610-fpu-cw-mips.patch b/patches/glibc/ports-2.12.1/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..7d990de
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/mips/fpu_control.h glibc-2.12.1/glibc-ports-2.12.1/sysdeps/mips/fpu_control.h
+--- glibc-2.12.1.orig/glibc-ports-2.12.1/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.12.1/glibc-ports-2.12.1/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.12.1.orig/ports/sysdeps/mips/fpu_control.h glibc-2.12.1/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.12.1/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.12.1/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..f6a5eb6
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.12.1.orig/elf/dl-lookup.c glibc-2.12.1/elf/dl-lookup.c
+--- glibc-2.12.1.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.12.1/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.12.1/640-alpha-atfcts.patch b/patches/glibc/ports-2.12.1/640-alpha-atfcts.patch
new file mode 100644
index 0000000..90a9d0d
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.12.1/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.12.1/650-syslog.patch b/patches/glibc/ports-2.12.1/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.12.1/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.12.1/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.12.1/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/patches/glibc/ports-2.13/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.13/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..1a632fe
--- /dev/null
+++ b/patches/glibc/ports-2.13/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,72 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
diff --git a/patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..3798cb2
--- /dev/null
+++ b/patches/glibc/ports-2.13/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,14 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.13/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -697,6 +697,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff --git a/patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..c7f6182
--- /dev/null
+++ b/patches/glibc/ports-2.13/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.13/140-disable-ldconfig.patch b/patches/glibc/ports-2.13/140-disable-ldconfig.patch
new file mode 100644
index 0000000..378e1df
--- /dev/null
+++ b/patches/glibc/ports-2.13/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.13.orig/Makefile glibc-2.13/Makefile
+--- glibc-2.13.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.13/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.13/150-queue-header-updates.patch b/patches/glibc/ports-2.13/150-queue-header-updates.patch
new file mode 100644
index 0000000..7cbe70e
--- /dev/null
+++ b/patches/glibc/ports-2.13/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+--- glibc-2.13.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.13/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.13/160-manual-no-perl.patch b/patches/glibc/ports-2.13/160-manual-no-perl.patch
new file mode 100644
index 0000000..5e2b807
--- /dev/null
+++ b/patches/glibc/ports-2.13/160-manual-no-perl.patch
@@ -0,0 +1,24 @@
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+diff -durN glibc-2.13.orig/manual/Makefile glibc-2.13/manual/Makefile
+--- glibc-2.13.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2.13/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..4784a07
--- /dev/null
+++ b/patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
+--- glibc-2.13.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.13/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.13/180-resolv-dynamic.patch b/patches/glibc/ports-2.13/180-resolv-dynamic.patch
new file mode 100644
index 0000000..e916bce
--- /dev/null
+++ b/patches/glibc/ports-2.13/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
+--- glibc-2.13.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.13/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.13/190-localedef-mmap.patch b/patches/glibc/ports-2.13/190-localedef-mmap.patch
new file mode 100644
index 0000000..f3914cd
--- /dev/null
+++ b/patches/glibc/ports-2.13/190-localedef-mmap.patch
@@ -0,0 +1,39 @@
+sniped from Debian
+http://bugs.gentoo.org/289615
+
+2009-10-27 Aurelien Jarno <aurelien@aurel32.net>
+
+ * locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
+ used later with MMAP_FIXED | MMAP_SHARED to cope with different
+ alignment restrictions.
+
+diff -durN glibc-2.13.orig/locale/programs/locarchive.c glibc-2.13/locale/programs/locarchive.c
+--- glibc-2.13.orig/locale/programs/locarchive.c 2009-04-27 16:07:47.000000000 +0200
++++ glibc-2.13/locale/programs/locarchive.c 2009-11-13 00:50:01.000000000 +0100
+@@ -134,7 +134,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -396,7 +396,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -614,7 +614,7 @@
+ int xflags = 0;
+ void *p;
+ if (st.st_size < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
diff --git a/patches/glibc/ports-2.13/200-fadvise64_64.patch b/patches/glibc/ports-2.13/200-fadvise64_64.patch
new file mode 100644
index 0000000..71bca38
--- /dev/null
+++ b/patches/glibc/ports-2.13/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.13/220-section-comments.patch b/patches/glibc/ports-2.13/220-section-comments.patch
new file mode 100644
index 0000000..d717829
--- /dev/null
+++ b/patches/glibc/ports-2.13/220-section-comments.patch
@@ -0,0 +1,24 @@
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+diff -durN glibc-2.13.orig/include/libc-symbols.h glibc-2.13/include/libc-symbols.h
+--- glibc-2.13.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
++++ glibc-2.13/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
+@@ -239,12 +239,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/ports-2.13/230-no-inline-gmon.patch b/patches/glibc/ports-2.13/230-no-inline-gmon.patch
new file mode 100644
index 0000000..fa33c2b
--- /dev/null
+++ b/patches/glibc/ports-2.13/230-no-inline-gmon.patch
@@ -0,0 +1,36 @@
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+Index: sysdeps/generic/initfini.c
+===================================================================
+
+diff -durN glibc-2.13.orig/sysdeps/generic/initfini.c glibc-2.13/sysdeps/generic/initfini.c
+--- glibc-2.13.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2.13/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/ports-2.13/240-check_native-headers.patch b/patches/glibc/ports-2.13/240-check_native-headers.patch
new file mode 100644
index 0000000..c936f71
--- /dev/null
+++ b/patches/glibc/ports-2.13/240-check_native-headers.patch
@@ -0,0 +1,17 @@
+many ports hit this warning:
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+
+snipped from suse
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.13/sysdeps/unix/sysv/linux/check_native.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c 2007-11-24 04:12:17.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/check_native.c 2009-11-13 00:50:11.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <net/if.h>
diff --git a/patches/glibc/ports-2.13/250-fix-pr631.patch b/patches/glibc/ports-2.13/250-fix-pr631.patch
new file mode 100644
index 0000000..a48912e
--- /dev/null
+++ b/patches/glibc/ports-2.13/250-fix-pr631.patch
@@ -0,0 +1,45 @@
+From dank@kegel.com
+Wed Jun 15 09:12:43 PDT 2005
+
+Fixes
+
+build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
+build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
+... 53 lines deleted ...
+build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
+collect2: ld returned 1 exit status
+make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1
+
+when building glibc with --enable-static-nss.
+
+See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:49:41.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:13.000000000 +0100
+@@ -531,7 +531,7 @@
+
+ # The static libraries.
+ ifeq (yes,$(build-static))
+-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
+ else
+ ifeq (yes,$(build-shared))
+ # We can try to link the programs with lib*_pic.a...
+diff -durN glibc-2.13.orig/elf/Makefile glibc-2.13/elf/Makefile
+--- glibc-2.13.orig/elf/Makefile 2009-01-31 01:20:55.000000000 +0100
++++ glibc-2.13/elf/Makefile 2009-11-13 00:50:13.000000000 +0100
+@@ -146,6 +146,13 @@
+ install-bin-script = ldd
+ endif
+
++ifeq (yes,$(build-static-nss))
++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
++ $(resolvobjdir)/libresolv.a
++endif
++
+ others = sprof sln
+ install-bin = sprof
+ others-static = sln
diff --git a/patches/glibc/ports-2.13/260-assume-pipe2.patch b/patches/glibc/ports-2.13/260-assume-pipe2.patch
new file mode 100644
index 0000000..42e8f4e
--- /dev/null
+++ b/patches/glibc/ports-2.13/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.13.orig/socket/have_sock_cloexec.c glibc-2.13/socket/have_sock_cloexec.c
+--- glibc-2.13.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.13/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.13/270-china.patch b/patches/glibc/ports-2.13/270-china.patch
new file mode 100644
index 0000000..41d7759
--- /dev/null
+++ b/patches/glibc/ports-2.13/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
+--- glibc-2.13.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.13/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.13/280-new-valencian-locale.patch b/patches/glibc/ports-2.13/280-new-valencian-locale.patch
new file mode 100644
index 0000000..4cdd108
--- /dev/null
+++ b/patches/glibc/ports-2.13/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
+--- glibc-2.13.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.13/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
+--- glibc-2.13.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.13/300-nscd-one-fork.patch b/patches/glibc/ports-2.13/300-nscd-one-fork.patch
new file mode 100644
index 0000000..adc9b3f
--- /dev/null
+++ b/patches/glibc/ports-2.13/300-nscd-one-fork.patch
@@ -0,0 +1,40 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
+--- glibc-2.13.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.13/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -182,6 +182,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -231,12 +234,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..4c028b2
--- /dev/null
+++ b/patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
+--- glibc-2.13.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.13/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -392,14 +392,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
+--- glibc-2.13.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.13/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
+--- glibc-2.13.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.13/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -265,9 +265,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -426,6 +426,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
+--- glibc-2.13.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.13/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
+--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.13/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
+--- glibc-2.13.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.13/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
+--- glibc-2.13.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.13/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.13/330-m68k-sys-user.patch b/patches/glibc/ports-2.13/330-m68k-sys-user.patch
new file mode 100644
index 0000000..191e0c6
--- /dev/null
+++ b/patches/glibc/ports-2.13/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.13/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..2402af0
--- /dev/null
+++ b/patches/glibc/ports-2.13/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
+--- glibc-2.13.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.13/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..f8f6b83
--- /dev/null
+++ b/patches/glibc/ports-2.13/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
+--- glibc-2.13.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.13/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..9f78c52
--- /dev/null
+++ b/patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
+--- glibc-2.13.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.13/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
+--- glibc-2.13.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.13/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
+--- glibc-2.13.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.13/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
+--- glibc-2.13.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.13/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
+--- glibc-2.13.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.13/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
+--- glibc-2.13.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.13/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
+--- glibc-2.13.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.13/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
+--- glibc-2.13.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.13/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
+--- glibc-2.13.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.13/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
+--- glibc-2.13.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.13/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
+--- glibc-2.13.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.13/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
+--- glibc-2.13.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.13/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.13/380-dont-build-timezone.patch b/patches/glibc/ports-2.13/380-dont-build-timezone.patch
new file mode 100644
index 0000000..11c358e
--- /dev/null
+++ b/patches/glibc/ports-2.13/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.13/400-alpha-xstat.patch b/patches/glibc/ports-2.13/400-alpha-xstat.patch
new file mode 100644
index 0000000..6e4ab8f
--- /dev/null
+++ b/patches/glibc/ports-2.13/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch b/patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch
new file mode 100644
index 0000000..fd55537
--- /dev/null
+++ b/patches/glibc/ports-2.13/410-alpha-SETPIPE-GETPIPE.patch
@@ -0,0 +1,19 @@
+2011-02-28 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (F_SETPIPE_SZ,
+ F_GETPIPE_SZ): Define.
+
+diff --git glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+index 860e9ac..e5e726b 100644
+--- glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+@@ -97,6 +97,8 @@
+ # define F_SETLEASE 1024 /* Set a lease. */
+ # define F_GETLEASE 1025 /* Enquire what lease is active. */
+ # define F_NOTIFY 1026 /* Request notfications on a directory. */
++# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
++# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
+ #endif
+ #ifdef __USE_XOPEN2K8
+ # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+
diff --git a/patches/glibc/ports-2.13/420-alpha-statfs.patch b/patches/glibc/ports-2.13/420-alpha-statfs.patch
new file mode 100644
index 0000000..65c925a
--- /dev/null
+++ b/patches/glibc/ports-2.13/420-alpha-statfs.patch
@@ -0,0 +1,29 @@
+2011-02-28 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/mips/bits/statfs.h (struct statfs,
+ struct statfs64): Add f_flags field.
+
+diff --git glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
+index d838e6b..157591d 100644
+--- glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/bits/statfs.h
+@@ -42,7 +42,8 @@ struct statfs
+ __fsid_t f_fsid;
+ int f_namelen;
+ int f_frsize;
+- int f_spare[5];
++ int f_flags;
++ int f_spare[4];
+ };
+
+ #ifdef __USE_LARGEFILE64
+@@ -58,7 +59,8 @@ struct statfs64
+ __fsid_t f_fsid;
+ int f_namelen;
+ int f_frsize;
+- int f_spare[5];
++ int f_flags;
++ int f_spare[4];
+ };
+ #endif
+
diff --git a/patches/glibc/ports-2.13/430-alpha-creat.patch b/patches/glibc/ports-2.13/430-alpha-creat.patch
new file mode 100644
index 0000000..da6ddda
--- /dev/null
+++ b/patches/glibc/ports-2.13/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.13/440-alpha-cache-shape.patch b/patches/glibc/ports-2.13/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..62ade7b
--- /dev/null
+++ b/patches/glibc/ports-2.13/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch b/patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch
new file mode 100644
index 0000000..ac3ea9a
--- /dev/null
+++ b/patches/glibc/ports-2.13/450-alpha-DEFAULT_STACK_PERMS.patch
@@ -0,0 +1,23 @@
+2011-02-28 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/stackinfo.h: Define DEFAULT_STACK_PERMS with PF_X.
+
+diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
+index 0a281bd..d9dbc35 100644
+--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/stackinfo.h
+@@ -22,7 +22,13 @@
+ #ifndef _STACKINFO_H
+ #define _STACKINFO_H 1
+
++#include <elf.h>
++
+ /* On Alpha the stack grows down. */
+ #define _STACK_GROWS_DOWN 1
+
++/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is
++ * present, but it is presumed absent. */
++#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X)
++
+ #endif /* stackinfo.h */
+
diff --git a/patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..313e0e0
--- /dev/null
+++ b/patches/glibc/ports-2.13/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.13/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.13/470-alpha-feupdateenv.patch b/patches/glibc/ports-2.13/470-alpha-feupdateenv.patch
new file mode 100644
index 0000000..45a7051
--- /dev/null
+++ b/patches/glibc/ports-2.13/470-alpha-feupdateenv.patch
@@ -0,0 +1,26 @@
+2011-03-01 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/fpu/feupdateenv.c (feupdateenv): Add
+ libm_hidden_def.
+ * sysdeps/alpha/fpu/ftestexcept.c (fetestexcept): Likewise.
+
+diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
+index c798070..9abbf11 100644
+--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/feupdateenv.c
+@@ -46,4 +46,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
+ compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
+ #endif
+
++libm_hidden_ver (__feupdateenv, feupdateenv)
+ versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
+diff --git glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
+index a4b3081..34d8113 100644
+--- glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/fpu/ftestexcept.c
+@@ -30,3 +30,4 @@ fetestexcept (int excepts)
+
+ return tmp & excepts & SWCR_STATUS_MASK;
+ }
++libm_hidden_def (fetestexcept)
+
diff --git a/patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..372f34c
--- /dev/null
+++ b/patches/glibc/ports-2.13/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -20,6 +20,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+
+ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..b2ae9b5
--- /dev/null
+++ b/patches/glibc/ports-2.13/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/alpha/Makefile glibc-2.13/glibc-ports-2.13/sysdeps/alpha/Makefile
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.13.orig/ports/sysdeps/alpha/Makefile glibc-2.13/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.13/560-ppc-atomic.patch b/patches/glibc/ports-2.13/560-ppc-atomic.patch
new file mode 100644
index 0000000..ee1cb90
--- /dev/null
+++ b/patches/glibc/ports-2.13/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch b/patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
new file mode 100644
index 0000000..4f4dbec
--- /dev/null
+++ b/patches/glibc/ports-2.13/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
@@ -0,0 +1,374 @@
+http://yann.poupet.free.fr/ep93xx/
+Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/bits/endian.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/bits/endian.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
+@@ -12,7 +12,7 @@
+ /* FPA floating point units are always big-endian, irrespective of the
+ CPU endianness. VFP floating point units use the same endianness
+ as the rest of the system. */
+-#ifdef __VFP_FP__
++#if defined __VFP_FP__ || defined __MAVERICK__
+ #define __FLOAT_WORD_ORDER __BYTE_ORDER
+ #else
+ #define __FLOAT_WORD_ORDER __BIG_ENDIAN
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -30,7 +30,33 @@
+ movs r0, r1 /* get the return value in place */
+ moveq r0, #1 /* can't let setjmp() return zero! */
+
++#ifdef __MAVERICK__
++ cfldrd mvd4, [ip], #8
++ nop
++ cfldrd mvd5, [ip], #8
++ nop
++ cfldrd mvd6, [ip], #8
++ nop
++ cfldrd mvd7, [ip], #8
++ nop
++ cfldrd mvd8, [ip], #8
++ nop
++ cfldrd mvd9, [ip], #8
++ nop
++ cfldrd mvd10, [ip], #8
++ nop
++ cfldrd mvd11, [ip], #8
++ nop
++ cfldrd mvd12, [ip], #8
++ nop
++ cfldrd mvd13, [ip], #8
++ nop
++ cfldrd mvd14, [ip], #8
++ nop
++ cfldrd mvd15, [ip], #8
++#else
+ lfmfd f4, 4, [ip] ! /* load the floating point regs */
++#endif
+
+ LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
+ END (__longjmp)
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
+@@ -20,6 +20,45 @@
+ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+ #endif
+
++#if defined(__MAVERICK__)
++
++/* Define bits representing exceptions in the FPU status word. */
++enum
++ {
++ FE_INVALID = 1,
++#define FE_INVALID FE_INVALID
++ FE_OVERFLOW = 4,
++#define FE_OVERFLOW FE_OVERFLOW
++ FE_UNDERFLOW = 8,
++#define FE_UNDERFLOW FE_UNDERFLOW
++ FE_INEXACT = 16,
++#define FE_INEXACT FE_INEXACT
++ };
++
++/* Amount to shift by to convert an exception to a mask bit. */
++#define FE_EXCEPT_SHIFT 5
++
++/* All supported exceptions. */
++#define FE_ALL_EXCEPT \
++ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
++
++/* IEEE rounding modes. */
++enum
++ {
++ FE_TONEAREST = 0,
++#define FE_TONEAREST FE_TONEAREST
++ FE_TOWARDZERO = 0x400,
++#define FE_TOWARDZERO FE_TOWARDZERO
++ FE_DOWNWARD = 0x800,
++#define FE_DOWNWARD FE_DOWNWARD
++ FE_UPWARD = 0xc00,
++#define FE_UPWARD FE_UPWARD
++ };
++
++#define FE_ROUND_MASK (FE_UPWARD)
++
++#else /* FPA */
++
+ /* Define bits representing exceptions in the FPU status word. */
+ enum
+ {
+@@ -44,6 +83,8 @@
+ modes exist, but you have to encode them in the actual instruction. */
+ #define FE_TONEAREST 0
+
++#endif
++
+ /* Type representing exception flags. */
+ typedef unsigned long int fexcept_t;
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
+@@ -28,7 +28,11 @@
+ #ifndef _ASM
+ /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
+ saved. */
++#ifdef __MAVERICK__
++typedef int __jmp_buf[34];
++#else
+ typedef int __jmp_buf[22];
+ #endif
++#endif
+
+ #endif
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,9 +18,21 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fegetround (void)
+ {
++#if defined(__MAVERICK__)
++
++ unsigned long temp;
++
++ _FPU_GETCW (temp);
++ return temp & FE_ROUND_MASK;
++
++#else /* FPA */
++
+ return FE_TONEAREST; /* Easy. :-) */
++
++#endif
+ }
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,12 +18,28 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fesetround (int round)
+ {
++#if defined(__MAVERICK__)
++ unsigned long temp;
++
++ if (round & ~FE_ROUND_MASK)
++ return 1;
++
++ _FPU_GETCW (temp);
++ temp = (temp & ~FE_ROUND_MASK) | round;
++ _FPU_SETCW (temp);
++ return 0;
++
++#else /* FPA */
++
+ /* We only support FE_TONEAREST, so there is no need for any work. */
+ return (round == FE_TONEAREST)?0:1;
++
++#endif
+ }
+
+ libm_hidden_def (fesetround)
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
+@@ -1,5 +1,6 @@
+ /* FPU control word definitions. ARM version.
+- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2005
++ 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
+@@ -20,6 +21,79 @@
+ #ifndef _FPU_CONTROL_H
+ #define _FPU_CONTROL_H
+
++#if defined(__MAVERICK__)
++
++/* DSPSC register: (from EP9312 User's Guide)
++ *
++ * bits 31..29 - DAID
++ * bits 28..26 - HVID
++ * bits 25..24 - RSVD
++ * bit 23 - ISAT
++ * bit 22 - UI
++ * bit 21 - INT
++ * bit 20 - AEXC
++ * bits 19..18 - SAT
++ * bits 17..16 - FCC
++ * bit 15 - V
++ * bit 14 - FWDEN
++ * bit 13 - Invalid
++ * bit 12 - Denorm
++ * bits 11..10 - RM
++ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
++ * bits 4..0 - IX, UF, OF, RSVD, IO
++ */
++
++/* masking of interrupts */
++#define _FPU_MASK_IM (1 << 5) /* invalid operation */
++#define _FPU_MASK_ZM 0 /* divide by zero */
++#define _FPU_MASK_OM (1 << 7) /* overflow */
++#define _FPU_MASK_UM (1 << 8) /* underflow */
++#define _FPU_MASK_PM (1 << 9) /* inexact */
++#define _FPU_MASK_DM 0 /* denormalized operation */
++
++#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
++
++#define _FPU_DEFAULT 0x00b00000 /* Default value. */
++#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t;
++
++/* Macros for accessing the hardware control word. */
++#define _FPU_GETCW(cw) ({ \
++ register int __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv32sc mvdx0, dspsc\n\t" \
++ "cfmvr64l %0, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
++ ); \
++})
++
++#define _FPU_SETCW(cw) ({ \
++ register int __t0, __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %0\n\t" \
++ "cfmvsc32 dspsc, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
++ : "0" (cw) \
++ ); \
++})
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#else /* FPA */
++
+ /* We have a slight terminology confusion here. On the ARM, the register
+ * we're interested in is actually the FPU status word - the FPU control
+ * word is something different (which is implementation-defined and only
+@@ -99,4 +173,6 @@
+ /* Default control word set at startup. */
+ extern fpu_control_t __fpu_control;
+
++#endif
++
+ #endif /* _FPU_CONTROL_H */
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,4 +17,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define __JMP_BUF_SP 32
++#else
+ #define __JMP_BUF_SP 20
++#endif
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -24,11 +24,41 @@
+
+ ENTRY (__sigsetjmp)
+ /* Save registers */
++#ifdef __MAVERICK__
++ cfstrd mvd4, [r0], #8
++ nop
++ cfstrd mvd5, [r0], #8
++ nop
++ cfstrd mvd6, [r0], #8
++ nop
++ cfstrd mvd7, [r0], #8
++ nop
++ cfstrd mvd8, [r0], #8
++ nop
++ cfstrd mvd9, [r0], #8
++ nop
++ cfstrd mvd10, [r0], #8
++ nop
++ cfstrd mvd11, [r0], #8
++ nop
++ cfstrd mvd12, [r0], #8
++ nop
++ cfstrd mvd13, [r0], #8
++ nop
++ cfstrd mvd14, [r0], #8
++ nop
++ cfstrd mvd15, [r0], #8
++#else
+ sfmea f4, 4, [r0]!
++#endif
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Restore pointer to jmp_buf */
++#ifdef __MAVERICK__
++ sub r0, r0, #96
++#else
+ sub r0, r0, #48
++#endif
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gccframe.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/gccframe.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,6 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define FIRST_PSEUDO_REGISTER 43
++#else
+ #define FIRST_PSEUDO_REGISTER 27
++#endif
+
+ #include <sysdeps/generic/gccframe.h>
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h glibc-2.13/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
+@@ -29,7 +29,7 @@
+ #if defined(__ARMEB__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 1
+-#elif defined(__VFP_FP__)
++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 0
+ #else
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/bits/endian.h glibc-2.13/ports/sysdeps/arm/bits/endian.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.13/ports/sysdeps/arm/fpu/__longjmp.S
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.13/ports/sysdeps/arm/fpu/bits/fenv.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.13/ports/sysdeps/arm/fpu/bits/setjmp.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.13/ports/sysdeps/arm/fpu/fegetround.c
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.13/ports/sysdeps/arm/fpu/fesetround.c
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.13/ports/sysdeps/arm/fpu/fpu_control.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.13/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.13/ports/sysdeps/arm/fpu/setjmp.S
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/gccframe.h glibc-2.13/ports/sysdeps/arm/gccframe.h
+diff -durN glibc-2.13.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.13/ports/sysdeps/arm/gmp-mparam.h
diff --git a/patches/glibc/ports-2.13/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.13/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..08518e9
--- /dev/null
+++ b/patches/glibc/ports-2.13/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.13.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.13/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.13/610-fpu-cw-mips.patch b/patches/glibc/ports-2.13/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..cd2b4d9
--- /dev/null
+++ b/patches/glibc/ports-2.13/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.13.orig/glibc-ports-2.13/sysdeps/mips/fpu_control.h glibc-2.13/glibc-ports-2.13/sysdeps/mips/fpu_control.h
+--- glibc-2.13.orig/glibc-ports-2.13/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.13/glibc-ports-2.13/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.13.orig/ports/sysdeps/mips/fpu_control.h glibc-2.13/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..791d76c
--- /dev/null
+++ b/patches/glibc/ports-2.13/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
+--- glibc-2.13.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.13/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.13/640-alpha-atfcts.patch b/patches/glibc/ports-2.13/640-alpha-atfcts.patch
new file mode 100644
index 0000000..7a8a94a
--- /dev/null
+++ b/patches/glibc/ports-2.13/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.13/650-syslog.patch b/patches/glibc/ports-2.13/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.13/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.13/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/patches/glibc/ports-2.14.1/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.14.1/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..1a632fe
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,72 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
diff --git a/patches/glibc/ports-2.14.1/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.14.1/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..3798cb2
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,14 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.13/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -697,6 +697,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff --git a/patches/glibc/ports-2.14.1/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.14.1/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..c7f6182
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.14.1/140-disable-ldconfig.patch b/patches/glibc/ports-2.14.1/140-disable-ldconfig.patch
new file mode 100644
index 0000000..378e1df
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.13.orig/Makefile glibc-2.13/Makefile
+--- glibc-2.13.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.13/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.14.1/150-queue-header-updates.patch b/patches/glibc/ports-2.14.1/150-queue-header-updates.patch
new file mode 100644
index 0000000..7cbe70e
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+--- glibc-2.13.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.13/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.14.1/160-manual-no-perl.patch b/patches/glibc/ports-2.14.1/160-manual-no-perl.patch
new file mode 100644
index 0000000..5e2b807
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/160-manual-no-perl.patch
@@ -0,0 +1,24 @@
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+diff -durN glibc-2.13.orig/manual/Makefile glibc-2.13/manual/Makefile
+--- glibc-2.13.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2.13/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/ports-2.14.1/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.14.1/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..4784a07
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
+--- glibc-2.13.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.13/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.14.1/180-resolv-dynamic.patch b/patches/glibc/ports-2.14.1/180-resolv-dynamic.patch
new file mode 100644
index 0000000..e916bce
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
+--- glibc-2.13.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.13/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.14.1/190-localedef-mmap.patch b/patches/glibc/ports-2.14.1/190-localedef-mmap.patch
new file mode 100644
index 0000000..f3914cd
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/190-localedef-mmap.patch
@@ -0,0 +1,39 @@
+sniped from Debian
+http://bugs.gentoo.org/289615
+
+2009-10-27 Aurelien Jarno <aurelien@aurel32.net>
+
+ * locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
+ used later with MMAP_FIXED | MMAP_SHARED to cope with different
+ alignment restrictions.
+
+diff -durN glibc-2.13.orig/locale/programs/locarchive.c glibc-2.13/locale/programs/locarchive.c
+--- glibc-2.13.orig/locale/programs/locarchive.c 2009-04-27 16:07:47.000000000 +0200
++++ glibc-2.13/locale/programs/locarchive.c 2009-11-13 00:50:01.000000000 +0100
+@@ -134,7 +134,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -396,7 +396,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -614,7 +614,7 @@
+ int xflags = 0;
+ void *p;
+ if (st.st_size < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
diff --git a/patches/glibc/ports-2.14.1/200-fadvise64_64.patch b/patches/glibc/ports-2.14.1/200-fadvise64_64.patch
new file mode 100644
index 0000000..71bca38
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.14.1/220-section-comments.patch b/patches/glibc/ports-2.14.1/220-section-comments.patch
new file mode 100644
index 0000000..d717829
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/220-section-comments.patch
@@ -0,0 +1,24 @@
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+diff -durN glibc-2.13.orig/include/libc-symbols.h glibc-2.13/include/libc-symbols.h
+--- glibc-2.13.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
++++ glibc-2.13/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
+@@ -239,12 +239,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/ports-2.14.1/230-no-inline-gmon.patch b/patches/glibc/ports-2.14.1/230-no-inline-gmon.patch
new file mode 100644
index 0000000..fa33c2b
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/230-no-inline-gmon.patch
@@ -0,0 +1,36 @@
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+Index: sysdeps/generic/initfini.c
+===================================================================
+
+diff -durN glibc-2.13.orig/sysdeps/generic/initfini.c glibc-2.13/sysdeps/generic/initfini.c
+--- glibc-2.13.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2.13/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/ports-2.14.1/260-assume-pipe2.patch b/patches/glibc/ports-2.14.1/260-assume-pipe2.patch
new file mode 100644
index 0000000..42e8f4e
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.13.orig/socket/have_sock_cloexec.c glibc-2.13/socket/have_sock_cloexec.c
+--- glibc-2.13.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.13/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.14.1/270-china.patch b/patches/glibc/ports-2.14.1/270-china.patch
new file mode 100644
index 0000000..41d7759
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
+--- glibc-2.13.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.13/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.14.1/280-new-valencian-locale.patch b/patches/glibc/ports-2.14.1/280-new-valencian-locale.patch
new file mode 100644
index 0000000..4cdd108
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
+--- glibc-2.13.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.13/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
+--- glibc-2.13.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.14.1/300-nscd-one-fork.patch b/patches/glibc/ports-2.14.1/300-nscd-one-fork.patch
new file mode 100644
index 0000000..adc9b3f
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/300-nscd-one-fork.patch
@@ -0,0 +1,40 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
+--- glibc-2.13.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.13/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -182,6 +182,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -231,12 +234,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.14.1/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.14.1/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..4c028b2
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
+--- glibc-2.13.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.13/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -392,14 +392,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
+--- glibc-2.13.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.13/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
+--- glibc-2.13.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.13/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -265,9 +265,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -426,6 +426,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
+--- glibc-2.13.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.13/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
+--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.13/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
+--- glibc-2.13.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.13/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
+--- glibc-2.13.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.13/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.14.1/330-m68k-sys-user.patch b/patches/glibc/ports-2.14.1/330-m68k-sys-user.patch
new file mode 100644
index 0000000..8fbe2e5
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.14.1.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.14.1/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.14.1/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.14.1/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..2402af0
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
+--- glibc-2.13.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.13/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.14.1/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.14.1/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..f8f6b83
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
+--- glibc-2.13.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.13/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.14.1/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.14.1/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..9f78c52
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
+--- glibc-2.13.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.13/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
+--- glibc-2.13.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.13/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
+--- glibc-2.13.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.13/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
+--- glibc-2.13.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.13/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
+--- glibc-2.13.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.13/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
+--- glibc-2.13.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.13/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
+--- glibc-2.13.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.13/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
+--- glibc-2.13.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.13/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
+--- glibc-2.13.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.13/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
+--- glibc-2.13.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.13/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
+--- glibc-2.13.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.13/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
+--- glibc-2.13.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.13/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.14.1/380-dont-build-timezone.patch b/patches/glibc/ports-2.14.1/380-dont-build-timezone.patch
new file mode 100644
index 0000000..11c358e
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.14.1/400-alpha-xstat.patch b/patches/glibc/ports-2.14.1/400-alpha-xstat.patch
new file mode 100644
index 0000000..6e4ab8f
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.14.1/430-alpha-creat.patch b/patches/glibc/ports-2.14.1/430-alpha-creat.patch
new file mode 100644
index 0000000..da6ddda
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.14.1/440-alpha-cache-shape.patch b/patches/glibc/ports-2.14.1/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..8ca0bd6
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.14.1/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.14.1/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..c3e59f4
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.14.1.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.14.1/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.14.1/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.14.1/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..372f34c
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -20,6 +20,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+
+ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.14.1/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.14.1/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..2691a99
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/alpha/Makefile glibc-2.14.1/glibc-ports-2.14.1/sysdeps/alpha/Makefile
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.14.1.orig/ports/sysdeps/alpha/Makefile glibc-2.14.1/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.14.1/560-ppc-atomic.patch b/patches/glibc/ports-2.14.1/560-ppc-atomic.patch
new file mode 100644
index 0000000..ee1cb90
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.14.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch b/patches/glibc/ports-2.14.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
new file mode 100644
index 0000000..5e45682
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
@@ -0,0 +1,374 @@
+http://yann.poupet.free.fr/ep93xx/
+Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/bits/endian.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/bits/endian.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
+@@ -12,7 +12,7 @@
+ /* FPA floating point units are always big-endian, irrespective of the
+ CPU endianness. VFP floating point units use the same endianness
+ as the rest of the system. */
+-#ifdef __VFP_FP__
++#if defined __VFP_FP__ || defined __MAVERICK__
+ #define __FLOAT_WORD_ORDER __BYTE_ORDER
+ #else
+ #define __FLOAT_WORD_ORDER __BIG_ENDIAN
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/__longjmp.S glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/__longjmp.S
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -30,7 +30,33 @@
+ movs r0, r1 /* get the return value in place */
+ moveq r0, #1 /* can't let setjmp() return zero! */
+
++#ifdef __MAVERICK__
++ cfldrd mvd4, [ip], #8
++ nop
++ cfldrd mvd5, [ip], #8
++ nop
++ cfldrd mvd6, [ip], #8
++ nop
++ cfldrd mvd7, [ip], #8
++ nop
++ cfldrd mvd8, [ip], #8
++ nop
++ cfldrd mvd9, [ip], #8
++ nop
++ cfldrd mvd10, [ip], #8
++ nop
++ cfldrd mvd11, [ip], #8
++ nop
++ cfldrd mvd12, [ip], #8
++ nop
++ cfldrd mvd13, [ip], #8
++ nop
++ cfldrd mvd14, [ip], #8
++ nop
++ cfldrd mvd15, [ip], #8
++#else
+ lfmfd f4, 4, [ip] ! /* load the floating point regs */
++#endif
+
+ LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
+ END (__longjmp)
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/fenv.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/fenv.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
+@@ -20,6 +20,45 @@
+ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+ #endif
+
++#if defined(__MAVERICK__)
++
++/* Define bits representing exceptions in the FPU status word. */
++enum
++ {
++ FE_INVALID = 1,
++#define FE_INVALID FE_INVALID
++ FE_OVERFLOW = 4,
++#define FE_OVERFLOW FE_OVERFLOW
++ FE_UNDERFLOW = 8,
++#define FE_UNDERFLOW FE_UNDERFLOW
++ FE_INEXACT = 16,
++#define FE_INEXACT FE_INEXACT
++ };
++
++/* Amount to shift by to convert an exception to a mask bit. */
++#define FE_EXCEPT_SHIFT 5
++
++/* All supported exceptions. */
++#define FE_ALL_EXCEPT \
++ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
++
++/* IEEE rounding modes. */
++enum
++ {
++ FE_TONEAREST = 0,
++#define FE_TONEAREST FE_TONEAREST
++ FE_TOWARDZERO = 0x400,
++#define FE_TOWARDZERO FE_TOWARDZERO
++ FE_DOWNWARD = 0x800,
++#define FE_DOWNWARD FE_DOWNWARD
++ FE_UPWARD = 0xc00,
++#define FE_UPWARD FE_UPWARD
++ };
++
++#define FE_ROUND_MASK (FE_UPWARD)
++
++#else /* FPA */
++
+ /* Define bits representing exceptions in the FPU status word. */
+ enum
+ {
+@@ -44,6 +83,8 @@
+ modes exist, but you have to encode them in the actual instruction. */
+ #define FE_TONEAREST 0
+
++#endif
++
+ /* Type representing exception flags. */
+ typedef unsigned long int fexcept_t;
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/setjmp.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/setjmp.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
+@@ -28,7 +28,11 @@
+ #ifndef _ASM
+ /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
+ saved. */
++#ifdef __MAVERICK__
++typedef int __jmp_buf[34];
++#else
+ typedef int __jmp_buf[22];
+ #endif
++#endif
+
+ #endif
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fegetround.c glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fegetround.c
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,9 +18,21 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fegetround (void)
+ {
++#if defined(__MAVERICK__)
++
++ unsigned long temp;
++
++ _FPU_GETCW (temp);
++ return temp & FE_ROUND_MASK;
++
++#else /* FPA */
++
+ return FE_TONEAREST; /* Easy. :-) */
++
++#endif
+ }
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fesetround.c glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fesetround.c
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,12 +18,28 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fesetround (int round)
+ {
++#if defined(__MAVERICK__)
++ unsigned long temp;
++
++ if (round & ~FE_ROUND_MASK)
++ return 1;
++
++ _FPU_GETCW (temp);
++ temp = (temp & ~FE_ROUND_MASK) | round;
++ _FPU_SETCW (temp);
++ return 0;
++
++#else /* FPA */
++
+ /* We only support FE_TONEAREST, so there is no need for any work. */
+ return (round == FE_TONEAREST)?0:1;
++
++#endif
+ }
+
+ libm_hidden_def (fesetround)
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fpu_control.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fpu_control.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
+@@ -1,5 +1,6 @@
+ /* FPU control word definitions. ARM version.
+- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2005
++ 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
+@@ -20,6 +21,79 @@
+ #ifndef _FPU_CONTROL_H
+ #define _FPU_CONTROL_H
+
++#if defined(__MAVERICK__)
++
++/* DSPSC register: (from EP9312 User's Guide)
++ *
++ * bits 31..29 - DAID
++ * bits 28..26 - HVID
++ * bits 25..24 - RSVD
++ * bit 23 - ISAT
++ * bit 22 - UI
++ * bit 21 - INT
++ * bit 20 - AEXC
++ * bits 19..18 - SAT
++ * bits 17..16 - FCC
++ * bit 15 - V
++ * bit 14 - FWDEN
++ * bit 13 - Invalid
++ * bit 12 - Denorm
++ * bits 11..10 - RM
++ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
++ * bits 4..0 - IX, UF, OF, RSVD, IO
++ */
++
++/* masking of interrupts */
++#define _FPU_MASK_IM (1 << 5) /* invalid operation */
++#define _FPU_MASK_ZM 0 /* divide by zero */
++#define _FPU_MASK_OM (1 << 7) /* overflow */
++#define _FPU_MASK_UM (1 << 8) /* underflow */
++#define _FPU_MASK_PM (1 << 9) /* inexact */
++#define _FPU_MASK_DM 0 /* denormalized operation */
++
++#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
++
++#define _FPU_DEFAULT 0x00b00000 /* Default value. */
++#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t;
++
++/* Macros for accessing the hardware control word. */
++#define _FPU_GETCW(cw) ({ \
++ register int __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv32sc mvdx0, dspsc\n\t" \
++ "cfmvr64l %0, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
++ ); \
++})
++
++#define _FPU_SETCW(cw) ({ \
++ register int __t0, __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %0\n\t" \
++ "cfmvsc32 dspsc, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
++ : "0" (cw) \
++ ); \
++})
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#else /* FPA */
++
+ /* We have a slight terminology confusion here. On the ARM, the register
+ * we're interested in is actually the FPU status word - the FPU control
+ * word is something different (which is implementation-defined and only
+@@ -99,4 +173,6 @@
+ /* Default control word set at startup. */
+ extern fpu_control_t __fpu_control;
+
++#endif
++
+ #endif /* _FPU_CONTROL_H */
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/jmpbuf-offsets.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,4 +17,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define __JMP_BUF_SP 32
++#else
+ #define __JMP_BUF_SP 20
++#endif
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/setjmp.S glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/setjmp.S
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -24,11 +24,41 @@
+
+ ENTRY (__sigsetjmp)
+ /* Save registers */
++#ifdef __MAVERICK__
++ cfstrd mvd4, [r0], #8
++ nop
++ cfstrd mvd5, [r0], #8
++ nop
++ cfstrd mvd6, [r0], #8
++ nop
++ cfstrd mvd7, [r0], #8
++ nop
++ cfstrd mvd8, [r0], #8
++ nop
++ cfstrd mvd9, [r0], #8
++ nop
++ cfstrd mvd10, [r0], #8
++ nop
++ cfstrd mvd11, [r0], #8
++ nop
++ cfstrd mvd12, [r0], #8
++ nop
++ cfstrd mvd13, [r0], #8
++ nop
++ cfstrd mvd14, [r0], #8
++ nop
++ cfstrd mvd15, [r0], #8
++#else
+ sfmea f4, 4, [r0]!
++#endif
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Restore pointer to jmp_buf */
++#ifdef __MAVERICK__
++ sub r0, r0, #96
++#else
+ sub r0, r0, #48
++#endif
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/gccframe.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/gccframe.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,6 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define FIRST_PSEUDO_REGISTER 43
++#else
+ #define FIRST_PSEUDO_REGISTER 27
++#endif
+
+ #include <sysdeps/generic/gccframe.h>
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/gmp-mparam.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/gmp-mparam.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
+@@ -29,7 +29,7 @@
+ #if defined(__ARMEB__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 1
+-#elif defined(__VFP_FP__)
++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 0
+ #else
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/bits/endian.h glibc-2.14.1/ports/sysdeps/arm/bits/endian.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.14.1/ports/sysdeps/arm/fpu/__longjmp.S
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.14.1/ports/sysdeps/arm/fpu/bits/fenv.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.14.1/ports/sysdeps/arm/fpu/bits/setjmp.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.14.1/ports/sysdeps/arm/fpu/fegetround.c
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.14.1/ports/sysdeps/arm/fpu/fesetround.c
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.14.1/ports/sysdeps/arm/fpu/fpu_control.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.14.1/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.14.1/ports/sysdeps/arm/fpu/setjmp.S
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/gccframe.h glibc-2.14.1/ports/sysdeps/arm/gccframe.h
+diff -durN glibc-2.14.1.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.14.1/ports/sysdeps/arm/gmp-mparam.h
diff --git a/patches/glibc/ports-2.14.1/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.14.1/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..6bf5250
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.14.1.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.14.1/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.14.1/610-fpu-cw-mips.patch b/patches/glibc/ports-2.14.1/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..e53ac78
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/mips/fpu_control.h glibc-2.14.1/glibc-ports-2.14.1/sysdeps/mips/fpu_control.h
+--- glibc-2.14.1.orig/glibc-ports-2.14.1/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14.1/glibc-ports-2.14.1/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.14.1.orig/ports/sysdeps/mips/fpu_control.h glibc-2.14.1/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.14.1/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.14.1/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..791d76c
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
+--- glibc-2.13.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.13/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.14.1/640-alpha-atfcts.patch b/patches/glibc/ports-2.14.1/640-alpha-atfcts.patch
new file mode 100644
index 0000000..7a8a94a
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.14.1/650-syslog.patch b/patches/glibc/ports-2.14.1/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.14.1/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.14.1/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.14.1/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/patches/glibc/ports-2.14/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.14/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..1a632fe
--- /dev/null
+++ b/patches/glibc/ports-2.14/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,72 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
diff --git a/patches/glibc/ports-2.14/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.14/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..3798cb2
--- /dev/null
+++ b/patches/glibc/ports-2.14/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,14 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.13/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -697,6 +697,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff --git a/patches/glibc/ports-2.14/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.14/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..c7f6182
--- /dev/null
+++ b/patches/glibc/ports-2.14/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.14/140-disable-ldconfig.patch b/patches/glibc/ports-2.14/140-disable-ldconfig.patch
new file mode 100644
index 0000000..378e1df
--- /dev/null
+++ b/patches/glibc/ports-2.14/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.13.orig/Makefile glibc-2.13/Makefile
+--- glibc-2.13.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.13/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.14/150-queue-header-updates.patch b/patches/glibc/ports-2.14/150-queue-header-updates.patch
new file mode 100644
index 0000000..7cbe70e
--- /dev/null
+++ b/patches/glibc/ports-2.14/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+--- glibc-2.13.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.13/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.14/160-manual-no-perl.patch b/patches/glibc/ports-2.14/160-manual-no-perl.patch
new file mode 100644
index 0000000..5e2b807
--- /dev/null
+++ b/patches/glibc/ports-2.14/160-manual-no-perl.patch
@@ -0,0 +1,24 @@
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+diff -durN glibc-2.13.orig/manual/Makefile glibc-2.13/manual/Makefile
+--- glibc-2.13.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2.13/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/ports-2.14/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.14/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..4784a07
--- /dev/null
+++ b/patches/glibc/ports-2.14/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
+--- glibc-2.13.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.13/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.14/180-resolv-dynamic.patch b/patches/glibc/ports-2.14/180-resolv-dynamic.patch
new file mode 100644
index 0000000..e916bce
--- /dev/null
+++ b/patches/glibc/ports-2.14/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
+--- glibc-2.13.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.13/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.14/190-localedef-mmap.patch b/patches/glibc/ports-2.14/190-localedef-mmap.patch
new file mode 100644
index 0000000..f3914cd
--- /dev/null
+++ b/patches/glibc/ports-2.14/190-localedef-mmap.patch
@@ -0,0 +1,39 @@
+sniped from Debian
+http://bugs.gentoo.org/289615
+
+2009-10-27 Aurelien Jarno <aurelien@aurel32.net>
+
+ * locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
+ used later with MMAP_FIXED | MMAP_SHARED to cope with different
+ alignment restrictions.
+
+diff -durN glibc-2.13.orig/locale/programs/locarchive.c glibc-2.13/locale/programs/locarchive.c
+--- glibc-2.13.orig/locale/programs/locarchive.c 2009-04-27 16:07:47.000000000 +0200
++++ glibc-2.13/locale/programs/locarchive.c 2009-11-13 00:50:01.000000000 +0100
+@@ -134,7 +134,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -396,7 +396,7 @@
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+@@ -614,7 +614,7 @@
+ int xflags = 0;
+ void *p;
+ if (st.st_size < reserved
+- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
++ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
diff --git a/patches/glibc/ports-2.14/200-fadvise64_64.patch b/patches/glibc/ports-2.14/200-fadvise64_64.patch
new file mode 100644
index 0000000..71bca38
--- /dev/null
+++ b/patches/glibc/ports-2.14/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.14/220-section-comments.patch b/patches/glibc/ports-2.14/220-section-comments.patch
new file mode 100644
index 0000000..d717829
--- /dev/null
+++ b/patches/glibc/ports-2.14/220-section-comments.patch
@@ -0,0 +1,24 @@
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+diff -durN glibc-2.13.orig/include/libc-symbols.h glibc-2.13/include/libc-symbols.h
+--- glibc-2.13.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
++++ glibc-2.13/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
+@@ -239,12 +239,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/ports-2.14/230-no-inline-gmon.patch b/patches/glibc/ports-2.14/230-no-inline-gmon.patch
new file mode 100644
index 0000000..fa33c2b
--- /dev/null
+++ b/patches/glibc/ports-2.14/230-no-inline-gmon.patch
@@ -0,0 +1,36 @@
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+Index: sysdeps/generic/initfini.c
+===================================================================
+
+diff -durN glibc-2.13.orig/sysdeps/generic/initfini.c glibc-2.13/sysdeps/generic/initfini.c
+--- glibc-2.13.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2.13/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/ports-2.14/240-check_native-headers.patch b/patches/glibc/ports-2.14/240-check_native-headers.patch
new file mode 100644
index 0000000..c936f71
--- /dev/null
+++ b/patches/glibc/ports-2.14/240-check_native-headers.patch
@@ -0,0 +1,17 @@
+many ports hit this warning:
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
+
+snipped from suse
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.13/sysdeps/unix/sysv/linux/check_native.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/check_native.c 2007-11-24 04:12:17.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/check_native.c 2009-11-13 00:50:11.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <net/if.h>
diff --git a/patches/glibc/ports-2.14/260-assume-pipe2.patch b/patches/glibc/ports-2.14/260-assume-pipe2.patch
new file mode 100644
index 0000000..42e8f4e
--- /dev/null
+++ b/patches/glibc/ports-2.14/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.13.orig/socket/have_sock_cloexec.c glibc-2.13/socket/have_sock_cloexec.c
+--- glibc-2.13.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.13/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.14/270-china.patch b/patches/glibc/ports-2.14/270-china.patch
new file mode 100644
index 0000000..41d7759
--- /dev/null
+++ b/patches/glibc/ports-2.14/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
+--- glibc-2.13.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.13/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.14/280-new-valencian-locale.patch b/patches/glibc/ports-2.14/280-new-valencian-locale.patch
new file mode 100644
index 0000000..4cdd108
--- /dev/null
+++ b/patches/glibc/ports-2.14/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
+--- glibc-2.13.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.13/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
+--- glibc-2.13.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.14/300-nscd-one-fork.patch b/patches/glibc/ports-2.14/300-nscd-one-fork.patch
new file mode 100644
index 0000000..adc9b3f
--- /dev/null
+++ b/patches/glibc/ports-2.14/300-nscd-one-fork.patch
@@ -0,0 +1,40 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
+--- glibc-2.13.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.13/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -182,6 +182,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -231,12 +234,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.14/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.14/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..4c028b2
--- /dev/null
+++ b/patches/glibc/ports-2.14/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
+--- glibc-2.13.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.13/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -392,14 +392,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
+--- glibc-2.13.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.13/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
+--- glibc-2.13.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.13/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -265,9 +265,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -426,6 +426,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
+--- glibc-2.13.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.13/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
+--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.13/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
+--- glibc-2.13.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.13/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
+--- glibc-2.13.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.13/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.14/330-m68k-sys-user.patch b/patches/glibc/ports-2.14/330-m68k-sys-user.patch
new file mode 100644
index 0000000..28bcb11
--- /dev/null
+++ b/patches/glibc/ports-2.14/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.14.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.14/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.14/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.14/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..2402af0
--- /dev/null
+++ b/patches/glibc/ports-2.14/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
+--- glibc-2.13.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.13/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.14/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.14/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..f8f6b83
--- /dev/null
+++ b/patches/glibc/ports-2.14/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
+--- glibc-2.13.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.13/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.14/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.14/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..9f78c52
--- /dev/null
+++ b/patches/glibc/ports-2.14/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
+--- glibc-2.13.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.13/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
+--- glibc-2.13.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.13/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
+--- glibc-2.13.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.13/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
+--- glibc-2.13.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.13/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
+--- glibc-2.13.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.13/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
+--- glibc-2.13.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.13/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
+--- glibc-2.13.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.13/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
+--- glibc-2.13.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.13/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
+--- glibc-2.13.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.13/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
+--- glibc-2.13.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.13/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
+--- glibc-2.13.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.13/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
+--- glibc-2.13.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.13/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.14/380-dont-build-timezone.patch b/patches/glibc/ports-2.14/380-dont-build-timezone.patch
new file mode 100644
index 0000000..11c358e
--- /dev/null
+++ b/patches/glibc/ports-2.14/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.14/400-alpha-xstat.patch b/patches/glibc/ports-2.14/400-alpha-xstat.patch
new file mode 100644
index 0000000..6e4ab8f
--- /dev/null
+++ b/patches/glibc/ports-2.14/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.14/430-alpha-creat.patch b/patches/glibc/ports-2.14/430-alpha-creat.patch
new file mode 100644
index 0000000..da6ddda
--- /dev/null
+++ b/patches/glibc/ports-2.14/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.14/440-alpha-cache-shape.patch b/patches/glibc/ports-2.14/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..def0181
--- /dev/null
+++ b/patches/glibc/ports-2.14/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.14/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.14/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..1569ce4
--- /dev/null
+++ b/patches/glibc/ports-2.14/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.14.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.14/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.14/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.14/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..372f34c
--- /dev/null
+++ b/patches/glibc/ports-2.14/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -20,6 +20,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+
+ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.14/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.14/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..3560e2a
--- /dev/null
+++ b/patches/glibc/ports-2.14/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/alpha/Makefile glibc-2.14/glibc-ports-2.14/sysdeps/alpha/Makefile
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.14.orig/ports/sysdeps/alpha/Makefile glibc-2.14/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.14/560-ppc-atomic.patch b/patches/glibc/ports-2.14/560-ppc-atomic.patch
new file mode 100644
index 0000000..ee1cb90
--- /dev/null
+++ b/patches/glibc/ports-2.14/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.14/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch b/patches/glibc/ports-2.14/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
new file mode 100644
index 0000000..b297ff0
--- /dev/null
+++ b/patches/glibc/ports-2.14/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
@@ -0,0 +1,374 @@
+http://yann.poupet.free.fr/ep93xx/
+Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/bits/endian.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/bits/endian.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
+@@ -12,7 +12,7 @@
+ /* FPA floating point units are always big-endian, irrespective of the
+ CPU endianness. VFP floating point units use the same endianness
+ as the rest of the system. */
+-#ifdef __VFP_FP__
++#if defined __VFP_FP__ || defined __MAVERICK__
+ #define __FLOAT_WORD_ORDER __BYTE_ORDER
+ #else
+ #define __FLOAT_WORD_ORDER __BIG_ENDIAN
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/__longjmp.S glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/__longjmp.S
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -30,7 +30,33 @@
+ movs r0, r1 /* get the return value in place */
+ moveq r0, #1 /* can't let setjmp() return zero! */
+
++#ifdef __MAVERICK__
++ cfldrd mvd4, [ip], #8
++ nop
++ cfldrd mvd5, [ip], #8
++ nop
++ cfldrd mvd6, [ip], #8
++ nop
++ cfldrd mvd7, [ip], #8
++ nop
++ cfldrd mvd8, [ip], #8
++ nop
++ cfldrd mvd9, [ip], #8
++ nop
++ cfldrd mvd10, [ip], #8
++ nop
++ cfldrd mvd11, [ip], #8
++ nop
++ cfldrd mvd12, [ip], #8
++ nop
++ cfldrd mvd13, [ip], #8
++ nop
++ cfldrd mvd14, [ip], #8
++ nop
++ cfldrd mvd15, [ip], #8
++#else
+ lfmfd f4, 4, [ip] ! /* load the floating point regs */
++#endif
+
+ LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
+ END (__longjmp)
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/bits/fenv.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/bits/fenv.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
+@@ -20,6 +20,45 @@
+ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+ #endif
+
++#if defined(__MAVERICK__)
++
++/* Define bits representing exceptions in the FPU status word. */
++enum
++ {
++ FE_INVALID = 1,
++#define FE_INVALID FE_INVALID
++ FE_OVERFLOW = 4,
++#define FE_OVERFLOW FE_OVERFLOW
++ FE_UNDERFLOW = 8,
++#define FE_UNDERFLOW FE_UNDERFLOW
++ FE_INEXACT = 16,
++#define FE_INEXACT FE_INEXACT
++ };
++
++/* Amount to shift by to convert an exception to a mask bit. */
++#define FE_EXCEPT_SHIFT 5
++
++/* All supported exceptions. */
++#define FE_ALL_EXCEPT \
++ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
++
++/* IEEE rounding modes. */
++enum
++ {
++ FE_TONEAREST = 0,
++#define FE_TONEAREST FE_TONEAREST
++ FE_TOWARDZERO = 0x400,
++#define FE_TOWARDZERO FE_TOWARDZERO
++ FE_DOWNWARD = 0x800,
++#define FE_DOWNWARD FE_DOWNWARD
++ FE_UPWARD = 0xc00,
++#define FE_UPWARD FE_UPWARD
++ };
++
++#define FE_ROUND_MASK (FE_UPWARD)
++
++#else /* FPA */
++
+ /* Define bits representing exceptions in the FPU status word. */
+ enum
+ {
+@@ -44,6 +83,8 @@
+ modes exist, but you have to encode them in the actual instruction. */
+ #define FE_TONEAREST 0
+
++#endif
++
+ /* Type representing exception flags. */
+ typedef unsigned long int fexcept_t;
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/bits/setjmp.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/bits/setjmp.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
+@@ -28,7 +28,11 @@
+ #ifndef _ASM
+ /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
+ saved. */
++#ifdef __MAVERICK__
++typedef int __jmp_buf[34];
++#else
+ typedef int __jmp_buf[22];
+ #endif
++#endif
+
+ #endif
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fegetround.c glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fegetround.c
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,9 +18,21 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fegetround (void)
+ {
++#if defined(__MAVERICK__)
++
++ unsigned long temp;
++
++ _FPU_GETCW (temp);
++ return temp & FE_ROUND_MASK;
++
++#else /* FPA */
++
+ return FE_TONEAREST; /* Easy. :-) */
++
++#endif
+ }
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fesetround.c glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fesetround.c
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,12 +18,28 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fesetround (int round)
+ {
++#if defined(__MAVERICK__)
++ unsigned long temp;
++
++ if (round & ~FE_ROUND_MASK)
++ return 1;
++
++ _FPU_GETCW (temp);
++ temp = (temp & ~FE_ROUND_MASK) | round;
++ _FPU_SETCW (temp);
++ return 0;
++
++#else /* FPA */
++
+ /* We only support FE_TONEAREST, so there is no need for any work. */
+ return (round == FE_TONEAREST)?0:1;
++
++#endif
+ }
+
+ libm_hidden_def (fesetround)
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fpu_control.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fpu_control.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
+@@ -1,5 +1,6 @@
+ /* FPU control word definitions. ARM version.
+- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2005
++ 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
+@@ -20,6 +21,79 @@
+ #ifndef _FPU_CONTROL_H
+ #define _FPU_CONTROL_H
+
++#if defined(__MAVERICK__)
++
++/* DSPSC register: (from EP9312 User's Guide)
++ *
++ * bits 31..29 - DAID
++ * bits 28..26 - HVID
++ * bits 25..24 - RSVD
++ * bit 23 - ISAT
++ * bit 22 - UI
++ * bit 21 - INT
++ * bit 20 - AEXC
++ * bits 19..18 - SAT
++ * bits 17..16 - FCC
++ * bit 15 - V
++ * bit 14 - FWDEN
++ * bit 13 - Invalid
++ * bit 12 - Denorm
++ * bits 11..10 - RM
++ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
++ * bits 4..0 - IX, UF, OF, RSVD, IO
++ */
++
++/* masking of interrupts */
++#define _FPU_MASK_IM (1 << 5) /* invalid operation */
++#define _FPU_MASK_ZM 0 /* divide by zero */
++#define _FPU_MASK_OM (1 << 7) /* overflow */
++#define _FPU_MASK_UM (1 << 8) /* underflow */
++#define _FPU_MASK_PM (1 << 9) /* inexact */
++#define _FPU_MASK_DM 0 /* denormalized operation */
++
++#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
++
++#define _FPU_DEFAULT 0x00b00000 /* Default value. */
++#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t;
++
++/* Macros for accessing the hardware control word. */
++#define _FPU_GETCW(cw) ({ \
++ register int __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv32sc mvdx0, dspsc\n\t" \
++ "cfmvr64l %0, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
++ ); \
++})
++
++#define _FPU_SETCW(cw) ({ \
++ register int __t0, __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %0\n\t" \
++ "cfmvsc32 dspsc, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
++ : "0" (cw) \
++ ); \
++})
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#else /* FPA */
++
+ /* We have a slight terminology confusion here. On the ARM, the register
+ * we're interested in is actually the FPU status word - the FPU control
+ * word is something different (which is implementation-defined and only
+@@ -99,4 +173,6 @@
+ /* Default control word set at startup. */
+ extern fpu_control_t __fpu_control;
+
++#endif
++
+ #endif /* _FPU_CONTROL_H */
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/jmpbuf-offsets.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,4 +17,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define __JMP_BUF_SP 32
++#else
+ #define __JMP_BUF_SP 20
++#endif
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/setjmp.S glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/setjmp.S
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -24,11 +24,41 @@
+
+ ENTRY (__sigsetjmp)
+ /* Save registers */
++#ifdef __MAVERICK__
++ cfstrd mvd4, [r0], #8
++ nop
++ cfstrd mvd5, [r0], #8
++ nop
++ cfstrd mvd6, [r0], #8
++ nop
++ cfstrd mvd7, [r0], #8
++ nop
++ cfstrd mvd8, [r0], #8
++ nop
++ cfstrd mvd9, [r0], #8
++ nop
++ cfstrd mvd10, [r0], #8
++ nop
++ cfstrd mvd11, [r0], #8
++ nop
++ cfstrd mvd12, [r0], #8
++ nop
++ cfstrd mvd13, [r0], #8
++ nop
++ cfstrd mvd14, [r0], #8
++ nop
++ cfstrd mvd15, [r0], #8
++#else
+ sfmea f4, 4, [r0]!
++#endif
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Restore pointer to jmp_buf */
++#ifdef __MAVERICK__
++ sub r0, r0, #96
++#else
+ sub r0, r0, #48
++#endif
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/gccframe.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/gccframe.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,6 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define FIRST_PSEUDO_REGISTER 43
++#else
+ #define FIRST_PSEUDO_REGISTER 27
++#endif
+
+ #include <sysdeps/generic/gccframe.h>
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/gmp-mparam.h glibc-2.14/glibc-ports-2.14/sysdeps/arm/gmp-mparam.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
+@@ -29,7 +29,7 @@
+ #if defined(__ARMEB__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 1
+-#elif defined(__VFP_FP__)
++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 0
+ #else
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/bits/endian.h glibc-2.14/ports/sysdeps/arm/bits/endian.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.14/ports/sysdeps/arm/fpu/__longjmp.S
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.14/ports/sysdeps/arm/fpu/bits/fenv.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.14/ports/sysdeps/arm/fpu/bits/setjmp.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.14/ports/sysdeps/arm/fpu/fegetround.c
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.14/ports/sysdeps/arm/fpu/fesetround.c
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.14/ports/sysdeps/arm/fpu/fpu_control.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.14/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.14/ports/sysdeps/arm/fpu/setjmp.S
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/gccframe.h glibc-2.14/ports/sysdeps/arm/gccframe.h
+diff -durN glibc-2.14.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.14/ports/sysdeps/arm/gmp-mparam.h
diff --git a/patches/glibc/ports-2.14/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.14/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..a2a141c
--- /dev/null
+++ b/patches/glibc/ports-2.14/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.14.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.14/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.14/610-fpu-cw-mips.patch b/patches/glibc/ports-2.14/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..c624565
--- /dev/null
+++ b/patches/glibc/ports-2.14/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.14.orig/glibc-ports-2.14/sysdeps/mips/fpu_control.h glibc-2.14/glibc-ports-2.14/sysdeps/mips/fpu_control.h
+--- glibc-2.14.orig/glibc-ports-2.14/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.14/glibc-ports-2.14/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.14.orig/ports/sysdeps/mips/fpu_control.h glibc-2.14/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.14/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.14/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..791d76c
--- /dev/null
+++ b/patches/glibc/ports-2.14/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
+--- glibc-2.13.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.13/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.14/640-alpha-atfcts.patch b/patches/glibc/ports-2.14/640-alpha-atfcts.patch
new file mode 100644
index 0000000..7a8a94a
--- /dev/null
+++ b/patches/glibc/ports-2.14/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.14/650-syslog.patch b/patches/glibc/ports-2.14/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.14/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.14/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.14/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.14/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/patches/glibc/ports-2.15/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.15/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..1a632fe
--- /dev/null
+++ b/patches/glibc/ports-2.15/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,72 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c
+@@ -23,7 +23,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+--- a/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c
+@@ -21,7 +21,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
diff --git a/patches/glibc/ports-2.15/091-libmemusage-link-failure.patch b/patches/glibc/ports-2.15/091-libmemusage-link-failure.patch
new file mode 100644
index 0000000..9f9887c
--- /dev/null
+++ b/patches/glibc/ports-2.15/091-libmemusage-link-failure.patch
@@ -0,0 +1,19 @@
+commit 2d80bda39073a35af4b904d27fa1511cd309b26f
+Author: Nathan Sidwell <nathan@codesourcery.com>
+Date: Fri Jan 6 20:14:44 2012 +0000
+
+ Add ARM dependency of libmemusage.so on libc_nonshared.a.
+
+diff --git a/ports/sysdeps/arm/Makefile b/ports/sysdeps/arm/Makefile
+index 5651161..1a88430 100644
+--- a/ports/sysdeps/arm/Makefile
++++ b/ports/sysdeps/arm/Makefile
+@@ -7,3 +7,8 @@ endif
+ ifeq ($(subdir),csu)
+ gen-as-const-headers += tlsdesc.sym
+ endif
++
++# to pull in __aeabi_read_tp, needed for tls
++ifeq ($(subdir),malloc)
++$(objpfx)libmemusage.so: $(common-objpfx)libc_nonshared.a
++endif
diff --git a/patches/glibc/ports-2.15/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.15/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..3798cb2
--- /dev/null
+++ b/patches/glibc/ports-2.15/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,14 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.13/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -697,6 +697,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff --git a/patches/glibc/ports-2.15/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.15/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..c7f6182
--- /dev/null
+++ b/patches/glibc/ports-2.15/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.15/140-disable-ldconfig.patch b/patches/glibc/ports-2.15/140-disable-ldconfig.patch
new file mode 100644
index 0000000..378e1df
--- /dev/null
+++ b/patches/glibc/ports-2.15/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.13.orig/Makefile glibc-2.13/Makefile
+--- glibc-2.13.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.13/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.15/150-queue-header-updates.patch b/patches/glibc/ports-2.15/150-queue-header-updates.patch
new file mode 100644
index 0000000..7cbe70e
--- /dev/null
+++ b/patches/glibc/ports-2.15/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+--- glibc-2.13.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.13/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.15/160-manual-no-perl.patch b/patches/glibc/ports-2.15/160-manual-no-perl.patch
new file mode 100644
index 0000000..5e2b807
--- /dev/null
+++ b/patches/glibc/ports-2.15/160-manual-no-perl.patch
@@ -0,0 +1,24 @@
+If we're using a cvs snapshot which updates the source files, and
+perl isn't installed yet, then we can't regen the docs. Not a big
+deal, so just whine a little and continue on our merry way.
+
+http://bugs.gentoo.org/60132
+
+diff -durN glibc-2.13.orig/manual/Makefile glibc-2.13/manual/Makefile
+--- glibc-2.13.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
++++ glibc-2.13/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
+@@ -104,9 +104,14 @@
+ libm-err.texi: stamp-libm-err
+ stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
++ifneq ($(PERL),no)
+ pwd=`pwd`; \
+ $(PERL) $< $$pwd/.. > libm-err-tmp
+ $(move-if-change) libm-err-tmp libm-err.texi
++else
++ echo "Unable to rebuild math docs, no perl installed"
++ touch libm-err.texi
++endif
+ touch $@
+
+ # Generate Texinfo files from the C source for the example programs.
diff --git a/patches/glibc/ports-2.15/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.15/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..4784a07
--- /dev/null
+++ b/patches/glibc/ports-2.15/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
+--- glibc-2.13.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.13/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.15/180-resolv-dynamic.patch b/patches/glibc/ports-2.15/180-resolv-dynamic.patch
new file mode 100644
index 0000000..e916bce
--- /dev/null
+++ b/patches/glibc/ports-2.15/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
+--- glibc-2.13.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.13/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.15/200-fadvise64_64.patch b/patches/glibc/ports-2.15/200-fadvise64_64.patch
new file mode 100644
index 0000000..71bca38
--- /dev/null
+++ b/patches/glibc/ports-2.15/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.15/220-section-comments.patch b/patches/glibc/ports-2.15/220-section-comments.patch
new file mode 100644
index 0000000..d717829
--- /dev/null
+++ b/patches/glibc/ports-2.15/220-section-comments.patch
@@ -0,0 +1,24 @@
+http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
+
+fixes building on some architectures (like m68k/arm/cris/etc...) because
+it does the right thing
+
+diff -durN glibc-2.13.orig/include/libc-symbols.h glibc-2.13/include/libc-symbols.h
+--- glibc-2.13.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
++++ glibc-2.13/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
+@@ -239,12 +239,12 @@
+ # define __make_section_unallocated(section_string)
+ # endif
+
+-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
++/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+ # ifdef HAVE_SECTION_QUOTES
+-# define __sec_comment "\"\n\t#\""
++# define __sec_comment "\"\n#APP\n\t#\""
+ # else
+-# define __sec_comment "\n\t#"
++# define __sec_comment "\n#APP\n\t#"
+ # endif
+ # define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." #symbol) \
diff --git a/patches/glibc/ports-2.15/230-no-inline-gmon.patch b/patches/glibc/ports-2.15/230-no-inline-gmon.patch
new file mode 100644
index 0000000..fa33c2b
--- /dev/null
+++ b/patches/glibc/ports-2.15/230-no-inline-gmon.patch
@@ -0,0 +1,36 @@
+http://bugs.gentoo.org/196245
+http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
+
+Attached is a patch to add __attribute__ ((noinline)) to
+call_gmon_start.
+
+Without this patch, the sec script that processed initfini.s removes a
+part of inlined call_gmon_start, causing undefined label errors.
+
+This patch solves the problem by forcing gcc not to inline
+call_gmon_start with __attribute__ ((noinline)).
+
+Tested by building for arm-none-lixux-gnueabi. OK to apply?
+
+Kazu Hirata
+
+2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
+
+ * sysdeps/generic/initfini.c (call_gmon_start): Add
+ __attribute__ ((noinline)).
+
+Index: sysdeps/generic/initfini.c
+===================================================================
+
+diff -durN glibc-2.13.orig/sysdeps/generic/initfini.c glibc-2.13/sysdeps/generic/initfini.c
+--- glibc-2.13.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
++++ glibc-2.13/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
+@@ -70,7 +70,7 @@
+ /* The beginning of _init: */
+ asm ("\n/*@_init_PROLOG_BEGINS*/");
+
+-static void
++static void __attribute__ ((noinline))
+ call_gmon_start(void)
+ {
+ extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
diff --git a/patches/glibc/ports-2.15/260-assume-pipe2.patch b/patches/glibc/ports-2.15/260-assume-pipe2.patch
new file mode 100644
index 0000000..42e8f4e
--- /dev/null
+++ b/patches/glibc/ports-2.15/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.13.orig/socket/have_sock_cloexec.c glibc-2.13/socket/have_sock_cloexec.c
+--- glibc-2.13.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.13/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -16,9 +16,14 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.15/270-china.patch b/patches/glibc/ports-2.15/270-china.patch
new file mode 100644
index 0000000..41d7759
--- /dev/null
+++ b/patches/glibc/ports-2.15/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
+--- glibc-2.13.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.13/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.15/280-new-valencian-locale.patch b/patches/glibc/ports-2.15/280-new-valencian-locale.patch
new file mode 100644
index 0000000..4cdd108
--- /dev/null
+++ b/patches/glibc/ports-2.15/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
+--- glibc-2.13.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.13/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
+--- glibc-2.13.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.15/300-nscd-one-fork.patch b/patches/glibc/ports-2.15/300-nscd-one-fork.patch
new file mode 100644
index 0000000..adc9b3f
--- /dev/null
+++ b/patches/glibc/ports-2.15/300-nscd-one-fork.patch
@@ -0,0 +1,40 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
+--- glibc-2.13.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.13/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -182,6 +182,9 @@
+ if (pid != 0)
+ exit (0);
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -231,12 +234,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.15/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.15/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..4c028b2
--- /dev/null
+++ b/patches/glibc/ports-2.15/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
+--- glibc-2.13.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.13/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -392,14 +392,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
+--- glibc-2.13.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.13/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
+--- glibc-2.13.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.13/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -265,9 +265,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ distribute = eintr.c tst-cleanup4aux.c
+
+@@ -426,6 +426,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
+--- glibc-2.13.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.13/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
+--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.13/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
+--- glibc-2.13.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.13/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
+--- glibc-2.13.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.13/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.15/330-m68k-sys-user.patch b/patches/glibc/ports-2.15/330-m68k-sys-user.patch
new file mode 100644
index 0000000..faee18f
--- /dev/null
+++ b/patches/glibc/ports-2.15/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.15.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.15/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.15/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.15/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..2402af0
--- /dev/null
+++ b/patches/glibc/ports-2.15/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
+--- glibc-2.13.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.13/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.15/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.15/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..f8f6b83
--- /dev/null
+++ b/patches/glibc/ports-2.15/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
+--- glibc-2.13.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.13/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.15/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.15/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..9f78c52
--- /dev/null
+++ b/patches/glibc/ports-2.15/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
+--- glibc-2.13.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.13/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
+--- glibc-2.13.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.13/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
+--- glibc-2.13.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.13/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
+--- glibc-2.13.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.13/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
+--- glibc-2.13.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.13/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
+--- glibc-2.13.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.13/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
+--- glibc-2.13.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.13/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
+--- glibc-2.13.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.13/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
+--- glibc-2.13.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.13/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
+--- glibc-2.13.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.13/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
+--- glibc-2.13.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.13/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
+--- glibc-2.13.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.13/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.15/380-dont-build-timezone.patch b/patches/glibc/ports-2.15/380-dont-build-timezone.patch
new file mode 100644
index 0000000..11c358e
--- /dev/null
+++ b/patches/glibc/ports-2.15/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.15/400-alpha-xstat.patch b/patches/glibc/ports-2.15/400-alpha-xstat.patch
new file mode 100644
index 0000000..6e4ab8f
--- /dev/null
+++ b/patches/glibc/ports-2.15/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.15/430-alpha-creat.patch b/patches/glibc/ports-2.15/430-alpha-creat.patch
new file mode 100644
index 0000000..da6ddda
--- /dev/null
+++ b/patches/glibc/ports-2.15/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.15/440-alpha-cache-shape.patch b/patches/glibc/ports-2.15/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..b3158da
--- /dev/null
+++ b/patches/glibc/ports-2.15/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.15/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.15/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..a54d823
--- /dev/null
+++ b/patches/glibc/ports-2.15/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.15.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.15/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.15/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.15/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..acf250d
--- /dev/null
+++ b/patches/glibc/ports-2.15/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -21,6 +21,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+ CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=0x80000000-__getpagesize()"
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.15/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.15/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..800a789
--- /dev/null
+++ b/patches/glibc/ports-2.15/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/alpha/Makefile glibc-2.15/glibc-ports-2.15/sysdeps/alpha/Makefile
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.15.orig/ports/sysdeps/alpha/Makefile glibc-2.15/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.15/560-ppc-atomic.patch b/patches/glibc/ports-2.15/560-ppc-atomic.patch
new file mode 100644
index 0000000..ee1cb90
--- /dev/null
+++ b/patches/glibc/ports-2.15/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.15/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch b/patches/glibc/ports-2.15/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
new file mode 100644
index 0000000..8a05574
--- /dev/null
+++ b/patches/glibc/ports-2.15/570-arm-cirrus-ep93xx-maverick-crunch-fpu.patch
@@ -0,0 +1,374 @@
+http://yann.poupet.free.fr/ep93xx/
+Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/bits/endian.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/bits/endian.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
+@@ -12,7 +12,7 @@
+ /* FPA floating point units are always big-endian, irrespective of the
+ CPU endianness. VFP floating point units use the same endianness
+ as the rest of the system. */
+-#ifdef __VFP_FP__
++#if defined __VFP_FP__ || defined __MAVERICK__
+ #define __FLOAT_WORD_ORDER __BYTE_ORDER
+ #else
+ #define __FLOAT_WORD_ORDER __BIG_ENDIAN
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/__longjmp.S glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/__longjmp.S
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -30,7 +30,33 @@
+ movs r0, r1 /* get the return value in place */
+ moveq r0, #1 /* can't let setjmp() return zero! */
+
++#ifdef __MAVERICK__
++ cfldrd mvd4, [ip], #8
++ nop
++ cfldrd mvd5, [ip], #8
++ nop
++ cfldrd mvd6, [ip], #8
++ nop
++ cfldrd mvd7, [ip], #8
++ nop
++ cfldrd mvd8, [ip], #8
++ nop
++ cfldrd mvd9, [ip], #8
++ nop
++ cfldrd mvd10, [ip], #8
++ nop
++ cfldrd mvd11, [ip], #8
++ nop
++ cfldrd mvd12, [ip], #8
++ nop
++ cfldrd mvd13, [ip], #8
++ nop
++ cfldrd mvd14, [ip], #8
++ nop
++ cfldrd mvd15, [ip], #8
++#else
+ lfmfd f4, 4, [ip] ! /* load the floating point regs */
++#endif
+
+ LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
+ END (__longjmp)
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/bits/fenv.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/bits/fenv.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
+@@ -20,6 +20,45 @@
+ # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+ #endif
+
++#if defined(__MAVERICK__)
++
++/* Define bits representing exceptions in the FPU status word. */
++enum
++ {
++ FE_INVALID = 1,
++#define FE_INVALID FE_INVALID
++ FE_OVERFLOW = 4,
++#define FE_OVERFLOW FE_OVERFLOW
++ FE_UNDERFLOW = 8,
++#define FE_UNDERFLOW FE_UNDERFLOW
++ FE_INEXACT = 16,
++#define FE_INEXACT FE_INEXACT
++ };
++
++/* Amount to shift by to convert an exception to a mask bit. */
++#define FE_EXCEPT_SHIFT 5
++
++/* All supported exceptions. */
++#define FE_ALL_EXCEPT \
++ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
++
++/* IEEE rounding modes. */
++enum
++ {
++ FE_TONEAREST = 0,
++#define FE_TONEAREST FE_TONEAREST
++ FE_TOWARDZERO = 0x400,
++#define FE_TOWARDZERO FE_TOWARDZERO
++ FE_DOWNWARD = 0x800,
++#define FE_DOWNWARD FE_DOWNWARD
++ FE_UPWARD = 0xc00,
++#define FE_UPWARD FE_UPWARD
++ };
++
++#define FE_ROUND_MASK (FE_UPWARD)
++
++#else /* FPA */
++
+ /* Define bits representing exceptions in the FPU status word. */
+ enum
+ {
+@@ -44,6 +83,8 @@
+ modes exist, but you have to encode them in the actual instruction. */
+ #define FE_TONEAREST 0
+
++#endif
++
+ /* Type representing exception flags. */
+ typedef unsigned long int fexcept_t;
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/bits/setjmp.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/bits/setjmp.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
+@@ -28,7 +28,11 @@
+ #ifndef _ASM
+ /* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
+ saved. */
++#ifdef __MAVERICK__
++typedef int __jmp_buf[34];
++#else
+ typedef int __jmp_buf[22];
+ #endif
++#endif
+
+ #endif
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fegetround.c glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fegetround.c
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,9 +18,21 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fegetround (void)
+ {
++#if defined(__MAVERICK__)
++
++ unsigned long temp;
++
++ _FPU_GETCW (temp);
++ return temp & FE_ROUND_MASK;
++
++#else /* FPA */
++
+ return FE_TONEAREST; /* Easy. :-) */
++
++#endif
+ }
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fesetround.c glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fesetround.c
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
+@@ -18,12 +18,28 @@
+ 02111-1307 USA. */
+
+ #include <fenv.h>
++#include <fpu_control.h>
+
+ int
+ fesetround (int round)
+ {
++#if defined(__MAVERICK__)
++ unsigned long temp;
++
++ if (round & ~FE_ROUND_MASK)
++ return 1;
++
++ _FPU_GETCW (temp);
++ temp = (temp & ~FE_ROUND_MASK) | round;
++ _FPU_SETCW (temp);
++ return 0;
++
++#else /* FPA */
++
+ /* We only support FE_TONEAREST, so there is no need for any work. */
+ return (round == FE_TONEAREST)?0:1;
++
++#endif
+ }
+
+ libm_hidden_def (fesetround)
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fpu_control.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fpu_control.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
+@@ -1,5 +1,6 @@
+ /* FPU control word definitions. ARM version.
+- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2005
++ 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
+@@ -20,6 +21,79 @@
+ #ifndef _FPU_CONTROL_H
+ #define _FPU_CONTROL_H
+
++#if defined(__MAVERICK__)
++
++/* DSPSC register: (from EP9312 User's Guide)
++ *
++ * bits 31..29 - DAID
++ * bits 28..26 - HVID
++ * bits 25..24 - RSVD
++ * bit 23 - ISAT
++ * bit 22 - UI
++ * bit 21 - INT
++ * bit 20 - AEXC
++ * bits 19..18 - SAT
++ * bits 17..16 - FCC
++ * bit 15 - V
++ * bit 14 - FWDEN
++ * bit 13 - Invalid
++ * bit 12 - Denorm
++ * bits 11..10 - RM
++ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
++ * bits 4..0 - IX, UF, OF, RSVD, IO
++ */
++
++/* masking of interrupts */
++#define _FPU_MASK_IM (1 << 5) /* invalid operation */
++#define _FPU_MASK_ZM 0 /* divide by zero */
++#define _FPU_MASK_OM (1 << 7) /* overflow */
++#define _FPU_MASK_UM (1 << 8) /* underflow */
++#define _FPU_MASK_PM (1 << 9) /* inexact */
++#define _FPU_MASK_DM 0 /* denormalized operation */
++
++#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
++
++#define _FPU_DEFAULT 0x00b00000 /* Default value. */
++#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t;
++
++/* Macros for accessing the hardware control word. */
++#define _FPU_GETCW(cw) ({ \
++ register int __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv32sc mvdx0, dspsc\n\t" \
++ "cfmvr64l %0, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
++ ); \
++})
++
++#define _FPU_SETCW(cw) ({ \
++ register int __t0, __t1, __t2; \
++ \
++ __asm__ volatile ( \
++ "cfmvr64l %1, mvdx0\n\t" \
++ "cfmvr64h %2, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %0\n\t" \
++ "cfmvsc32 dspsc, mvdx0\n\t" \
++ "cfmv64lr mvdx0, %1\n\t" \
++ "cfmv64hr mvdx0, %2" \
++ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
++ : "0" (cw) \
++ ); \
++})
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#else /* FPA */
++
+ /* We have a slight terminology confusion here. On the ARM, the register
+ * we're interested in is actually the FPU status word - the FPU control
+ * word is something different (which is implementation-defined and only
+@@ -99,4 +173,6 @@
+ /* Default control word set at startup. */
+ extern fpu_control_t __fpu_control;
+
++#endif
++
+ #endif /* _FPU_CONTROL_H */
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/jmpbuf-offsets.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,4 +17,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define __JMP_BUF_SP 32
++#else
+ #define __JMP_BUF_SP 20
++#endif
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/setjmp.S glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/setjmp.S
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
+@@ -24,11 +24,41 @@
+
+ ENTRY (__sigsetjmp)
+ /* Save registers */
++#ifdef __MAVERICK__
++ cfstrd mvd4, [r0], #8
++ nop
++ cfstrd mvd5, [r0], #8
++ nop
++ cfstrd mvd6, [r0], #8
++ nop
++ cfstrd mvd7, [r0], #8
++ nop
++ cfstrd mvd8, [r0], #8
++ nop
++ cfstrd mvd9, [r0], #8
++ nop
++ cfstrd mvd10, [r0], #8
++ nop
++ cfstrd mvd11, [r0], #8
++ nop
++ cfstrd mvd12, [r0], #8
++ nop
++ cfstrd mvd13, [r0], #8
++ nop
++ cfstrd mvd14, [r0], #8
++ nop
++ cfstrd mvd15, [r0], #8
++#else
+ sfmea f4, 4, [r0]!
++#endif
+ stmia r0, {v1-v6, sl, fp, sp, lr}
+
+ /* Restore pointer to jmp_buf */
++#ifdef __MAVERICK__
++ sub r0, r0, #96
++#else
+ sub r0, r0, #48
++#endif
+
+ /* Make a tail call to __sigjmp_save; it takes the same args. */
+ B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/gccframe.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/gccframe.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
+@@ -17,6 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#ifdef __MAVERICK__
++#define FIRST_PSEUDO_REGISTER 43
++#else
+ #define FIRST_PSEUDO_REGISTER 27
++#endif
+
+ #include <sysdeps/generic/gccframe.h>
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/gmp-mparam.h glibc-2.15/glibc-ports-2.15/sysdeps/arm/gmp-mparam.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
+@@ -29,7 +29,7 @@
+ #if defined(__ARMEB__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 1
+-#elif defined(__VFP_FP__)
++#elif defined(__VFP_FP__) || defined(__MAVERICK__)
+ # define IEEE_DOUBLE_MIXED_ENDIAN 0
+ # define IEEE_DOUBLE_BIG_ENDIAN 0
+ #else
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/bits/endian.h glibc-2.15/ports/sysdeps/arm/bits/endian.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.15/ports/sysdeps/arm/fpu/__longjmp.S
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.15/ports/sysdeps/arm/fpu/bits/fenv.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.15/ports/sysdeps/arm/fpu/bits/setjmp.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.15/ports/sysdeps/arm/fpu/fegetround.c
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.15/ports/sysdeps/arm/fpu/fesetround.c
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.15/ports/sysdeps/arm/fpu/fpu_control.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.15/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.15/ports/sysdeps/arm/fpu/setjmp.S
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/gccframe.h glibc-2.15/ports/sysdeps/arm/gccframe.h
+diff -durN glibc-2.15.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.15/ports/sysdeps/arm/gmp-mparam.h
diff --git a/patches/glibc/ports-2.15/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.15/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..a39e463
--- /dev/null
+++ b/patches/glibc/ports-2.15/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.15.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.15/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.15/610-fpu-cw-mips.patch b/patches/glibc/ports-2.15/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..8692a1f
--- /dev/null
+++ b/patches/glibc/ports-2.15/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.15.orig/glibc-ports-2.15/sysdeps/mips/fpu_control.h glibc-2.15/glibc-ports-2.15/sysdeps/mips/fpu_control.h
+--- glibc-2.15.orig/glibc-ports-2.15/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.15/glibc-ports-2.15/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.15.orig/ports/sysdeps/mips/fpu_control.h glibc-2.15/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.15/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.15/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..791d76c
--- /dev/null
+++ b/patches/glibc/ports-2.15/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
+--- glibc-2.13.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.13/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.15/640-alpha-atfcts.patch b/patches/glibc/ports-2.15/640-alpha-atfcts.patch
new file mode 100644
index 0000000..7a8a94a
--- /dev/null
+++ b/patches/glibc/ports-2.15/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.15/650-syslog.patch b/patches/glibc/ports-2.15/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.15/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.15/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.15/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.15/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/patches/glibc/ports-2.16.0/090-Fix-ARM-build-with-GCC-trunk.patch b/patches/glibc/ports-2.16.0/090-Fix-ARM-build-with-GCC-trunk.patch
new file mode 100644
index 0000000..59f95aa
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/090-Fix-ARM-build-with-GCC-trunk.patch
@@ -0,0 +1,54 @@
+From 175cef4163dd60f95106cfd5f593b8a4e09d02c9 Mon Sep 17 00:00:00 2001
+From: Joseph Myers <joseph@codesourcery.com>
+Date: Tue, 20 May 2014 21:27:13 +0000
+Subject: [PATCH] Fix ARM build with GCC trunk.
+
+sysdeps/unix/sysv/linux/arm/unwind-resume.c and
+sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c have static
+variables that are written in C code but only read from toplevel asms.
+Current GCC trunk now optimizes away such apparently write-only static
+variables, so causing a build failure. This patch marks those
+variables with __attribute_used__ to avoid that optimization.
+
+Tested that this fixes the build for ARM.
+
+ * sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+ (libgcc_s_resume): Use __attribute_used__.
+ * sysdeps/unix/sysv/linux/arm/unwind-resume.c (libgcc_s_resume):
+ Likewise.
+---
+ sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c | 3 ++-
+ sysdeps/unix/sysv/linux/arm/unwind-resume.c | 3 ++-
+ 3 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c b/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+index 6ccd9b4..660d148 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+@@ -22,7 +22,8 @@
+ #include <pthreadP.h>
+
+ static void *libgcc_s_handle;
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+ static _Unwind_Reason_Code (*libgcc_s_forcedunwind)
+diff --git a/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+index bff3e2b..1f1eb71 100644
+--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
++++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+@@ -20,7 +20,8 @@
+ #include <stdio.h>
+ #include <unwind.h>
+
+-static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
++static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
++ __attribute_used__;
+ static _Unwind_Reason_Code (*libgcc_s_personality)
+ (_Unwind_State, struct _Unwind_Exception *, struct _Unwind_Context *);
+
+--
+1.9.4
+
diff --git a/patches/glibc/ports-2.16.0/100-respect-env-CPPFLAGS.patch b/patches/glibc/ports-2.16.0/100-respect-env-CPPFLAGS.patch
new file mode 100644
index 0000000..dce491c
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/100-respect-env-CPPFLAGS.patch
@@ -0,0 +1,14 @@
+Respect environment CPPFLAGS when we run ./configure so we can inject
+random -D things without having to set CFLAGS/ASFLAGS
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
++++ glibc-2.13/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+@@ -668,6 +668,7 @@
+ $(foreach lib,$(libof-$(basename $(@F))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
++CPPFLAGS += $(CPPFLAGS-config)
+ override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) $(config-extra-cflags) \
+ $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+ $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff --git a/patches/glibc/ports-2.16.0/120-i386-x86_64-revert-clone-cfi.patch b/patches/glibc/ports-2.16.0/120-i386-x86_64-revert-clone-cfi.patch
new file mode 100644
index 0000000..c7f6182
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/120-i386-x86_64-revert-clone-cfi.patch
@@ -0,0 +1,55 @@
+revert cfi additions to clone on i386/x86_64 to workaround problems in
+gcc's unwinder code. this is not a bug in glibc, it triggers problems
+elsewhere. this cfi code does not gain us a whole lot anyways.
+
+http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
+
+Index: sysdeps/unix/sysv/linux/i386/clone.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
+retrieving revision 1.27
+retrieving revision 1.26
+diff -u -p -r1.27 -r1.26
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -120,9 +120,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (eip);
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
+ #ifdef RESET_PID
+@@ -155,7 +152,6 @@
+ jmp L(haspid)
+ .previous
+ #endif
+- cfi_endproc;
+
+ cfi_startproc
+ PSEUDO_END (BP_SYM (__clone))
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
+@@ -89,9 +89,6 @@
+ ret
+
+ L(thread_start):
+- cfi_startproc;
+- /* Clearing frame pointer is insufficient, use CFI. */
+- cfi_undefined (rip);
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ xorl %ebp, %ebp
+@@ -116,7 +113,6 @@
+ /* Call exit with return value from function call. */
+ movq %rax, %rdi
+ call HIDDEN_JUMPTARGET (_exit)
+- cfi_endproc;
+
+ cfi_startproc;
+ PSEUDO_END (BP_SYM (__clone))
diff --git a/patches/glibc/ports-2.16.0/140-disable-ldconfig.patch b/patches/glibc/ports-2.16.0/140-disable-ldconfig.patch
new file mode 100644
index 0000000..378e1df
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/140-disable-ldconfig.patch
@@ -0,0 +1,16 @@
+do not bother running ldconfig on DESTDIR. it wants to write the temp cache
+file outside of the chroot. doesnt matter anyways as we wont use the cache
+results (portage will rebuild cache), so running ldconfig is simply a waste
+of time.
+
+diff -durN glibc-2.13.orig/Makefile glibc-2.13/Makefile
+--- glibc-2.13.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
++++ glibc-2.13/Makefile 2009-11-13 00:49:49.000000000 +0100
+@@ -116,6 +116,7 @@
+ rm -f $(symbolic-link-list)
+
+ install:
++dont-bother-with-destdir:
+ -test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
+ $(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
+ $(slibdir) $(libdir)
diff --git a/patches/glibc/ports-2.16.0/150-queue-header-updates.patch b/patches/glibc/ports-2.16.0/150-queue-header-updates.patch
new file mode 100644
index 0000000..7cbe70e
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/150-queue-header-updates.patch
@@ -0,0 +1,85 @@
+grab some updates from FreeBSD
+
+http://bugs.gentoo.org/201979
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+
+diff -durN glibc-2.13.orig/misc/sys/queue.h glibc-2.13/misc/sys/queue.h
+--- glibc-2.13.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
++++ glibc-2.13/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
+@@ -136,6 +136,11 @@
+ (var); \
+ (var) = ((var)->field.le_next))
+
++#define LIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = LIST_FIRST((head)); \
++ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ /*
+ * List access methods.
+ */
+@@ -197,6 +202,16 @@
+ #define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
++#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = SLIST_FIRST((head)); \
++ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
++ (var) = (tvar))
++
++#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
++ for ((varp) = &SLIST_FIRST((head)); \
++ ((var) = *(varp)) != NULL; \
++ (varp) = &SLIST_NEXT((var), field))
++
+ /*
+ * Singly-linked List access methods.
+ */
+@@ -242,6 +257,12 @@
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ } while (/*CONSTCOND*/0)
+
++#define STAILQ_LAST(head, type, field) \
++ (STAILQ_EMPTY((head)) ? \
++ NULL : \
++ ((struct type *)(void *) \
++ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
+ #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+@@ -271,6 +292,11 @@
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
++#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = STAILQ_FIRST((head)); \
++ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+@@ -437,11 +463,21 @@
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
++#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
++ for ((var) = TAILQ_FIRST((head)); \
++ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
++#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
++ for ((var) = TAILQ_LAST((head), headname); \
++ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
++ (var) = (tvar))
++
+ #define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
diff --git a/patches/glibc/ports-2.16.0/170-localedef-fix-trampoline.patch b/patches/glibc/ports-2.16.0/170-localedef-fix-trampoline.patch
new file mode 100644
index 0000000..4784a07
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/170-localedef-fix-trampoline.patch
@@ -0,0 +1,69 @@
+#! /bin/sh -e
+
+# DP: Description: Fix localedef segfault when run under exec-shield,
+# PaX or similar. (#231438, #198099)
+# DP: Dpatch Author: James Troup <james@nocrew.org>
+# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
+# DP: Upstream status: Unknown
+# DP: Status Details: Unknown
+# DP: Date: 2004-03-16
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
+--- glibc-2.13.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
++++ glibc-2.13/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
+@@ -203,6 +203,42 @@
+ }
+ }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++ to inlined functions. Help it a little bit with this hack. */
++#define wchead_table_iterate(tp, fn) \
++do \
++ { \
++ struct wchead_table *t = (tp); \
++ uint32_t index1; \
++ for (index1 = 0; index1 < t->level1_size; index1++) \
++ { \
++ uint32_t lookup1 = t->level1[index1]; \
++ if (lookup1 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup1_shifted = lookup1 << t->q; \
++ uint32_t index2; \
++ for (index2 = 0; index2 < (1 << t->q); index2++) \
++ { \
++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
++ if (lookup2 != ((uint32_t) ~0)) \
++ { \
++ uint32_t lookup2_shifted = lookup2 << t->p; \
++ uint32_t index3; \
++ for (index3 = 0; index3 < (1 << t->p); index3++) \
++ { \
++ struct element_t *lookup3 \
++ = t->level3[index3 + lookup2_shifted]; \
++ if (lookup3 != NULL) \
++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
++ lookup3); \
++ } \
++ } \
++ } \
++ } \
++ } \
++ } while (0)
++
+ #endif
+
+ #ifndef NO_FINALIZE
diff --git a/patches/glibc/ports-2.16.0/180-resolv-dynamic.patch b/patches/glibc/ports-2.16.0/180-resolv-dynamic.patch
new file mode 100644
index 0000000..e916bce
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/180-resolv-dynamic.patch
@@ -0,0 +1,39 @@
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
+--- glibc-2.13.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
++++ glibc-2.13/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -95,6 +96,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0)
+ __res_iclose (resp, true);
diff --git a/patches/glibc/ports-2.16.0/200-fadvise64_64.patch b/patches/glibc/ports-2.16.0/200-fadvise64_64.patch
new file mode 100644
index 0000000..71bca38
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/200-fadvise64_64.patch
@@ -0,0 +1,28 @@
+ripped from Debian
+
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
diff --git a/patches/glibc/ports-2.16.0/260-assume-pipe2.patch b/patches/glibc/ports-2.16.0/260-assume-pipe2.patch
new file mode 100644
index 0000000..54f0382
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/260-assume-pipe2.patch
@@ -0,0 +1,40 @@
+http://bugs.gentoo.org/250342
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
+
+we cant assume sock_cloexec and pipe2 are bound together as the former defines
+are found in glibc only while the latter are a combo of kernel headers and
+glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
+inside of glibc, we hit a problem. for example:
+
+#include <grp.h>
+#include <stdio.h>
+main()
+{
+ getgrnam("portage");
+ if (!popen("ls", "r"))
+ perror("popen()");
+}
+
+getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
+__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
+older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
+stub for it. so popen() will always fail as glibc assumes pipe2() works.
+
+diff -durN glibc-2.16.0.orig/socket/have_sock_cloexec.c glibc-2.16.0/socket/have_sock_cloexec.c
+--- glibc-2.16.0.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
++++ glibc-2.16.0/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
+@@ -15,9 +15,14 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++#include <fcntl.h>
+ #include <sys/socket.h>
+ #include <kernel-features.h>
+
+ #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ int __have_sock_cloexec;
+ #endif
++
++#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
++int __have_pipe2;
++#endif
diff --git a/patches/glibc/ports-2.16.0/270-china.patch b/patches/glibc/ports-2.16.0/270-china.patch
new file mode 100644
index 0000000..41d7759
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/270-china.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/localedata/locales/zh_TW glibc-2.13/localedata/locales/zh_TW
+--- glibc-2.13.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
++++ glibc-2.13/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
+@@ -1,7 +1,7 @@
+ comment_char %
+ escape_char /
+ %
+-% Chinese language locale for Taiwan R.O.C.
++% Chinese language locale for Taiwan
+ % charmap: BIG5-CP950
+ %
+ % Original Author:
+@@ -17,7 +17,7 @@
+ % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
+
+ LC_IDENTIFICATION
+-title "Chinese locale for Taiwan R.O.C."
++title "Chinese locale for Taiwan"
+ source ""
+ address ""
+ contact ""
+@@ -25,7 +25,7 @@
+ tel ""
+ fax ""
+ language "Chinese"
+-territory "Taiwan R.O.C."
++territory "Taiwan"
+ revision "0.2"
+ date "2000-08-02"
+ %
diff --git a/patches/glibc/ports-2.16.0/280-new-valencian-locale.patch b/patches/glibc/ports-2.16.0/280-new-valencian-locale.patch
new file mode 100644
index 0000000..4cdd108
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/280-new-valencian-locale.patch
@@ -0,0 +1,115 @@
+http://bugs.gentoo.org/show_bug.cgi?id=131815
+http://sourceware.org/bugzilla/show_bug.cgi?id=2522
+
+diff -durN glibc-2.13.orig/localedata/SUPPORTED glibc-2.13/localedata/SUPPORTED
+--- glibc-2.13.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
++++ glibc-2.13/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
+@@ -72,6 +72,8 @@
+ ca_ES.UTF-8/UTF-8 \
+ ca_ES/ISO-8859-1 \
+ ca_ES@euro/ISO-8859-15 \
++ca_ES.UTF-8@valencia/UTF-8 \
++ca_ES@valencia/ISO-8859-15 \
+ ca_FR.UTF-8/UTF-8 \
+ ca_FR/ISO-8859-15 \
+ ca_IT.UTF-8/UTF-8 \
+diff -durN glibc-2.13.orig/localedata/locales/ca_ES@valencia glibc-2.13/localedata/locales/ca_ES@valencia
+--- glibc-2.13.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
+@@ -0,0 +1,96 @@
++comment_char %
++escape_char /
++%
++% Valencian (southern Catalan) locale for Spain with Euro
++%
++% Note that this locale is almost the same as ca_ES@euro. The point of having
++% a separate locale is only for PO translations, which have a lot of social
++% support and are very appreciated by the Valencian-speaking community.
++%
++% Contact: Jordi Mallach
++% Email: jordi@gnu.org
++% Tel:
++% Fax:
++% Language: ca
++% Territory: ES
++% Option: euro
++% Revision: 1.0
++% Date: 2006-04-06
++% Application: general
++% Users: general
++% Repertoiremap: mnemonic,ds
++% Charset: ISO-8859-15
++% Distribution and use is free, also
++% for commercial purposes.
++
++LC_IDENTIFICATION
++title "Valencian (southern Catalan) locale for Spain with Euro"
++source ""
++address ""
++contact "Jordi Mallach"
++email "jordi@gnu.org"
++tel ""
++fax ""
++language "Catalan"
++territory "Spain"
++revision "1.0"
++date "2006-04-06"
++%
++category "ca_ES@valencia:2006";LC_IDENTIFICATION
++category "ca_ES@valencia:2006";LC_CTYPE
++category "ca_ES@valencia:2006";LC_COLLATE
++category "ca_ES@valencia:2006";LC_MONETARY
++category "ca_ES@valencia:2006";LC_NUMERIC
++category "ca_ES@valencia:2006";LC_TIME
++category "ca_ES@valencia:2006";LC_MESSAGES
++category "ca_ES@valencia:2006";LC_PAPER
++category "ca_ES@valencia:2006";LC_NAME
++category "ca_ES@valencia:2006";LC_ADDRESS
++category "ca_ES@valencia:2006";LC_TELEPHONE
++category "ca_ES@valencia:2006";LC_MEASUREMENT
++
++END LC_IDENTIFICATION
++
++LC_CTYPE
++copy "i18n"
++END LC_CTYPE
++
++LC_COLLATE
++copy "ca_ES"
++END LC_COLLATE
++
++LC_MONETARY
++copy "ca_ES"
++END LC_MONETARY
++
++LC_NUMERIC
++copy "ca_ES"
++END LC_NUMERIC
++
++LC_TIME
++copy "ca_ES"
++END LC_TIME
++
++LC_MESSAGES
++copy "ca_ES"
++END LC_MESSAGES
++
++LC_PAPER
++copy "ca_ES"
++END LC_PAPER
++
++LC_NAME
++copy "ca_ES"
++END LC_NAME
++
++LC_ADDRESS
++copy "ca_ES"
++END LC_ADDRESS
++
++LC_TELEPHONE
++copy "ca_ES"
++END LC_TELEPHONE
++
++LC_MEASUREMENT
++copy "ca_ES"
++END LC_MEASUREMENT
diff --git a/patches/glibc/ports-2.16.0/300-nscd-one-fork.patch b/patches/glibc/ports-2.16.0/300-nscd-one-fork.patch
new file mode 100644
index 0000000..13b2861
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/300-nscd-one-fork.patch
@@ -0,0 +1,43 @@
+only fork one to assist in stop-start-daemon assumptions about daemon behavior
+
+http://bugs.gentoo.org/190785
+
+diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
+--- glibc-2.13.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
++++ glibc-2.13/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
+@@ -203,6 +203,9 @@
+ exit (0);
+ }
+
++ if (write_pid (_PATH_NSCDPID) < 0)
++ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
++
+ int nullfd = open (_PATH_DEVNULL, O_RDWR);
+ if (nullfd != -1)
+ {
+@@ -252,15 +255,6 @@
+ for (i = min_close_fd; i < getdtablesize (); i++)
+ close (i);
+
+- if (run_mode == RUN_DAEMONIZE)
+- {
+- pid = fork ();
+- if (pid == -1)
+- error (EXIT_FAILURE, errno, _("cannot fork"));
+- if (pid != 0)
+- exit (0);
+- }
+-
+ setsid ();
+
+ if (chdir ("/") != 0)
+@@ -245,9 +242,6 @@
+
+ openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
+
+- if (write_pid (_PATH_NSCDPID) < 0)
+- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+-
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
diff --git a/patches/glibc/ports-2.16.0/310-hppa-nptl-carlos.patch b/patches/glibc/ports-2.16.0/310-hppa-nptl-carlos.patch
new file mode 100644
index 0000000..11e8a65
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/310-hppa-nptl-carlos.patch
@@ -0,0 +1,246 @@
+
+
+diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
+--- glibc-2.13.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
++++ glibc-2.13/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
+@@ -392,14 +392,14 @@
+ know it is available. We do not have to clear the memory if we
+ do not have to use the temporary bootstrap_map. Global variables
+ are initialized to zero by default. */
+-#ifndef DONT_USE_BOOTSTRAP_MAP
++#if !defined DONT_USE_BOOTSTRAP_MAP
+ # ifdef HAVE_BUILTIN_MEMSET
+ __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
+ # else
+- for (size_t cnt = 0;
+- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
+- ++cnt)
+- bootstrap_map.l_info[cnt] = 0;
++ /* Clear the whole bootstrap_map structure */
++ for (char *cnt = (char *)&(bootstrap_map);
++ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
++ *cnt++ = '\0');
+ # endif
+ # if USE___THREAD
+ bootstrap_map.l_tls_modid = 0;
+diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
+--- glibc-2.13.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
++++ glibc-2.13/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
+@@ -185,7 +185,7 @@
+ __typeof (*(mem)) __atg5_value = (newvalue); \
+ \
+ do \
+- __atg5_oldval = *__atg5_memp; \
++ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
+@@ -206,7 +206,7 @@
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+- __atg6_oldval = *__atg6_memp; \
++ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+@@ -224,7 +224,7 @@
+ __typeof (*(mem)) __atg7_value = (value); \
+ \
+ do \
+- __atg7_oldv = *__atg7_memp; \
++ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+@@ -242,7 +242,7 @@
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+- __atg8_oldval = *__atg8_memp; \
++ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -259,7 +259,7 @@
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+- __atg9_oldv = *__atg9_memp; \
++ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -277,7 +277,7 @@
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+- __atg10_oldval = *__atg10_memp; \
++ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+@@ -361,7 +361,7 @@
+ \
+ do \
+ { \
+- __atg11_oldval = *__atg11_memp; \
++ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
+ break; \
+ } \
+@@ -400,7 +400,7 @@
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
+ \
+ do \
+- __atg14_old = (*__atg14_memp); \
++ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+@@ -418,7 +418,7 @@
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+- __atg15_old = (*__atg15_memp); \
++ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+@@ -450,7 +450,7 @@
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+- __atg16_old = (*__atg16_memp); \
++ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+@@ -468,7 +468,7 @@
+ __typeof (*(mem)) __atg17_mask = (mask); \
+ \
+ do \
+- __atg17_old = (*__atg17_memp); \
++ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+@@ -484,7 +484,7 @@
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+- __atg18_old = (*__atg18_memp); \
++ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+@@ -500,7 +500,7 @@
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+- __atg19_old = (*__atg19_memp); \
++ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
+--- glibc-2.13.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
++++ glibc-2.13/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -266,9 +266,9 @@
+ # Files which must not be linked with libpthread.
+ tests-nolibpthread = tst-unload
+
+-# This sets the stack resource limit to 1023kb, which is not a multiple
+-# of the page size since every architecture's page size is > 1k.
+-tst-oddstacklimit-ENV = ; ulimit -s 1023;
++# This sets the stack resource limit to 8193kb, which is not a multiple
++# of the page size since every architecture's page size is 4096 bytes.
++tst-oddstacklimit-ENV = ; ulimit -s 8193;
+
+ gen-as-const-headers = pthread-errnos.sym
+
+@@ -426,6 +426,35 @@
+ CFLAGS-tst-cleanupx4.c += -fexceptions
+ CFLAGS-tst-oncex3.c += -fexceptions
+ CFLAGS-tst-oncex4.c += -fexceptions
++
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
++
+ CFLAGS-tst-align.c += $(stack-align-test-flags)
+ CFLAGS-tst-align3.c += $(stack-align-test-flags)
+ CFLAGS-tst-initializers1.c = -W -Wall -Werror
+diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
+--- glibc-2.13.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
++++ glibc-2.13/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
+@@ -64,7 +64,7 @@
+ do
+ lll_futex_wait (&ibarrier->curr_event, event,
+ ibarrier->private ^ FUTEX_PRIVATE_FLAG);
+- while (event == ibarrier->curr_event);
++ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
+ }
+
+ /* Make sure the init_count is stored locally or in a register. */
+diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
+--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
++++ glibc-2.13/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -33,7 +33,9 @@
+
+ ifeq ($(have-forced-unwind),yes)
+ tests += tst-mqueue8x
++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+ CFLAGS-tst-mqueue8x.c += -fexceptions
++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
+ endif
+ endif
+
+diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
+--- glibc-2.13.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
++++ glibc-2.13/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
+@@ -82,7 +82,7 @@
+ $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
+ endif
+
+-CFLAGS-vfprintf.c = -Wno-uninitialized
++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
+ CFLAGS-vfwprintf.c = -Wno-uninitialized
+ CFLAGS-tst-printf.c = -Wno-format
+ CFLAGS-tstdiomisc.c = -Wno-format
+diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
+--- glibc-2.13.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
++++ glibc-2.13/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
+@@ -456,7 +456,7 @@
+ while (inlen < 0 && errno == EINTR);
+ if (inlen < 0)
+ {
+- if (errno == EWOULDBLOCK)
++ if (errno == EWOULDBLOCK || errno == EAGAIN)
+ continue;
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTRECV);
diff --git a/patches/glibc/ports-2.16.0/330-m68k-sys-user.patch b/patches/glibc/ports-2.16.0/330-m68k-sys-user.patch
new file mode 100644
index 0000000..f113996
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/330-m68k-sys-user.patch
@@ -0,0 +1,97 @@
+copied from kernel as it is sanitized now
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/m68k/sys/user.h
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
+@@ -1,3 +1,90 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++/* Core file format: The core file is written in such a way that gdb
++ can understand it and provide useful information to the user (under
++ linux we use the 'trad-core' bfd). There are quite a number of
++ obstacles to being able to view the contents of the floating point
++ registers, and until these are solved you will not be able to view the
++ contents of them. Actually, you can read in the core file and look at
++ the contents of the user struct to find out what the floating point
++ registers contain.
++ The actual file contents are as follows:
++ UPAGE: 1 page consisting of a user struct that tells gdb what is present
++ in the file. Directly after this is a copy of the task_struct, which
++ is currently not used by gdb, but it may come in useful at some point.
++ All of the registers are stored as part of the upage. The upage should
++ always be only one page.
++ DATA: The data area is stored. We use current->end_text to
++ current->brk to pick up all of the user variables, plus any memory
++ that may have been malloced. No attempt is made to determine if a page
++ is demand-zero or if a page is totally unused, we just cover the entire
++ range. All of the addresses are rounded in such a way that an integral
++ number of pages is written.
++ STACK: We need the stack information in order to get a meaningful
++ backtrace. We need to write the data from (esp) to
++ current->start_stack, so we round each of these off in order to be able
++ to write an integer number of pages.
++ The minimum core file size is 3 pages, or 12288 bytes.
++*/
++
++struct user_m68kfp_struct {
++ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
++ unsigned long fpcntl[3]; /* fp control regs */
++};
++
++/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
++ is still the layout used by user (the new pt_regs doesn't have
++ all registers). */
++struct user_regs_struct {
++ long d1,d2,d3,d4,d5,d6,d7;
++ long a0,a1,a2,a3,a4,a5,a6;
++ long d0;
++ long usp;
++ long orig_d0;
++ short stkadj;
++ short sr;
++ long pc;
++ short fmtvec;
++ short __fill;
++};
++
++
++/* When the kernel dumps core, it starts by dumping the user struct -
++ this will be used by gdb to figure out where the data and stack segments
++ are within the file, and what virtual addresses to use. */
++struct user{
++/* We start with the registers, to mimic the way that "memory" is returned
++ from the ptrace(3,...) function. */
++ struct user_regs_struct regs; /* Where the registers are actually stored */
++/* ptrace does not yet supply these. Someday.... */
++ int u_fpvalid; /* True if math co-processor being used. */
++ /* for this mess. Not yet used. */
++ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
++/* The rest of this junk is to help gdb figure out what goes where */
++ unsigned long int u_tsize; /* Text segment size (pages). */
++ unsigned long int u_dsize; /* Data segment size (pages). */
++ unsigned long int u_ssize; /* Stack segment size (pages). */
++ unsigned long start_code; /* Starting virtual address of text. */
++ unsigned long start_stack; /* Starting virtual address of stack area.
++ This is actually the bottom of the stack,
++ the top of the stack is always found in the
++ esp register. */
++ long int signal; /* Signal that caused the core dump. */
++ int reserved; /* No longer used */
++ struct user_regs_struct *u_ar0;
++ /* Used by gdb to help find the values for */
++ /* the registers. */
++ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
++ unsigned long magic; /* To uniquely identify a core file */
++ char u_comm[32]; /* User command that was responsible */
++};
++#define NBPG 4096
++#define UPAGES 1
++#define HOST_TEXT_START_ADDR (u.start_code)
++#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
++
++#endif
+ /* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+diff -durN glibc-2.16.0.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.16.0/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
diff --git a/patches/glibc/ports-2.16.0/340-dl_execstack-PaX-support.patch b/patches/glibc/ports-2.16.0/340-dl_execstack-PaX-support.patch
new file mode 100644
index 0000000..2402af0
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/340-dl_execstack-PaX-support.patch
@@ -0,0 +1,66 @@
+ With latest versions of glibc, a lot of apps failed on a PaX enabled
+ system with:
+ cannot enable executable stack as shared object requires: Permission denied
+
+ This is due to PaX 'exec-protecting' the stack, and ld.so then trying
+ to make the stack executable due to some libraries not containing the
+ PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
+
+ Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
+
+diff -durN glibc-2.13.orig/nptl/allocatestack.c glibc-2.13/nptl/allocatestack.c
+--- glibc-2.13.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
++++ glibc-2.13/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -329,7 +329,8 @@
+ # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+ #endif
+ if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+- return errno;
++ if (errno != EACCES) /* PAX is enabled */
++ return errno;
+
+ return 0;
+ }
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
+@@ -63,7 +63,10 @@
+ else
+ # endif
+ {
+- result = errno;
++ if (errno == EACCES) /* PAX is enabled */
++ result = 0;
++ else
++ result = errno;
+ goto out;
+ }
+ }
+@@ -89,7 +92,12 @@
+ page -= size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
+@@ -115,7 +123,12 @@
+ page += size;
+ else
+ {
+- if (errno != ENOMEM) /* Unexpected failure mode. */
++ if (errno == EACCES) /* PAX is enabled */
++ {
++ result = 0;
++ goto out;
++ }
++ else if (errno != ENOMEM) /* Unexpected failure mode. */
+ {
+ result = errno;
+ goto out;
diff --git a/patches/glibc/ports-2.16.0/350-pre20040117-pt_pax.patch b/patches/glibc/ports-2.16.0/350-pre20040117-pt_pax.patch
new file mode 100644
index 0000000..f8f6b83
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/350-pre20040117-pt_pax.patch
@@ -0,0 +1,32 @@
+
+
+diff -durN glibc-2.13.orig/elf/elf.h glibc-2.13/elf/elf.h
+--- glibc-2.13.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
++++ glibc-2.13/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
+@@ -580,6 +580,7 @@
+ #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
+ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
+ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
+ #define PT_LOSUNW 0x6ffffffa
+ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
+ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
+@@ -593,6 +594,18 @@
+ #define PF_X (1 << 0) /* Segment is executable */
+ #define PF_W (1 << 1) /* Segment is writable */
+ #define PF_R (1 << 2) /* Segment is readable */
++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
+ #define PF_MASKOS 0x0ff00000 /* OS-specific */
+ #define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
diff --git a/patches/glibc/ports-2.16.0/360-tests-sandbox-libdl-paths.patch b/patches/glibc/ports-2.16.0/360-tests-sandbox-libdl-paths.patch
new file mode 100644
index 0000000..9f78c52
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/360-tests-sandbox-libdl-paths.patch
@@ -0,0 +1,193 @@
+when glibc runs its tests, it does so by invoking the local library loader.
+in Gentoo, we build/run inside of our "sandbox" which itself is linked against
+libdl (so that it can load libraries and pull out symbols). the trouble
+is that when you upgrade from an older glibc to the new one, often times
+internal symbols change name or abi. this is normally OK as you cannot use
+libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
+we always say "keep all of the glibc libraries from the same build". but
+when glibc runs its tests, it uses dynamic paths to point to its new local
+copies of libraries. if the test doesnt use libdl, then glibc doesnt add
+its path, and when sandbox triggers the loading of libdl, glibc does so
+from the host system system. this gets us into the case of all libraries
+are from the locally compiled version of glibc except for libdl.so.
+
+Fix by Wormo
+
+http://bugs.gentoo.org/56898
+
+diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
+--- glibc-2.13.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
++++ glibc-2.13/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,7 +24,8 @@
+ rtld_installed_name=$1; shift
+
+ testout=${common_objpfx}/grp/tst_fgetgrent.out
+-library_path=${common_objpfx}
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+ result=0
+
+diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
+--- glibc-2.13.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
++++ glibc-2.13/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -34,7 +34,7 @@
+ export GCONV_PATH
+
+ # We have to have some directories in the library path.
+-LIBPATH=$codir:$codir/iconvdata
++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
+
+ # How the start the iconv(1) program.
+ ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
+diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
+--- glibc-2.13.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
++++ glibc-2.13/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -59,8 +59,11 @@
+ irreversible=${charset}.irreversible
+ fi
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # iconv in one direction.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-table-from ${charset} \
+ > ${objpfx}tst-${charset}.table
+
+diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
+--- glibc-2.13.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
++++ glibc-2.13/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -37,6 +37,9 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
+
+diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
+--- glibc-2.13.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
++++ glibc-2.13/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -51,9 +51,12 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+ MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
+--- glibc-2.13.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
++++ glibc-2.13/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -65,8 +65,11 @@
+ LOCPATH=${objpfx}domaindir
+ export LOCPATH
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ # Now run the test.
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
+ cmp ${objpfx}tst-gettext2.out - <<EOF
+ String1 - Lang1: 1st string
+diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
+--- glibc-2.13.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
++++ glibc-2.13/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -36,7 +36,10 @@
+ LOCPATH=${common_objpfx}localedata
+ export LOCPATH
+
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
+
+ exit $?
+diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
+--- glibc-2.13.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
++++ glibc-2.13/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -24,9 +24,12 @@
+ status=0
+ trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
+ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+-${common_objpfx}elf/ld.so --library-path $common_objpfx \
++${common_objpfx}elf/ld.so --library-path $library_path \
+ ${common_objpfx}malloc/tst-mtrace || status=1
+
+ if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
+diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
+--- glibc-2.13.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
++++ glibc-2.13/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -5,8 +5,8 @@
+ rtld_installed_name=$1; shift
+ logfile=$common_objpfx/nptl/tst-tls6.out
+
+-# We have to find libc and nptl
+-library_path=${common_objpfx}:${common_objpfx}nptl
++# We have to find libc and nptl (also libdl in case sandbox is in use)
++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
+ tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}/nptl/tst-tls5"
+
+diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
+--- glibc-2.13.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
++++ glibc-2.13/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -18,7 +18,7 @@
+ esac
+
+ # We have to find the libc and the NSS modules.
+-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
+
+ # Since we use `sort' we must make sure to use the same locale everywhere.
+ LC_ALL=C
+diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
+--- glibc-2.13.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
++++ glibc-2.13/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -10,7 +10,10 @@
+ else
+ rtld_installed_name=$1; shift
+ runit() {
+- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
++
++ # make sure libdl is also in path in case sandbox is in use
++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
+ }
+ fi
+
+diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
+--- glibc-2.13.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
++++ glibc-2.13/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
+@@ -19,8 +19,11 @@
+ "
+ export IFS
+
++# make sure libdl is also in path in case sandbox is in use
++library_path=${common_objpfx}:${common_objpfx}/dlfcn
++
+ failed=0
+-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
+ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
+ cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
+ wordexp returned 0
diff --git a/patches/glibc/ports-2.16.0/380-dont-build-timezone.patch b/patches/glibc/ports-2.16.0/380-dont-build-timezone.patch
new file mode 100644
index 0000000..11c358e
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/380-dont-build-timezone.patch
@@ -0,0 +1,14 @@
+timezone data has been split into the package sys-libs/timezone-data
+
+diff -durN glibc-2.13.orig/Makeconfig glibc-2.13/Makeconfig
+--- glibc-2.13.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
++++ glibc-2.13/Makeconfig 2009-11-13 00:50:41.000000000 +0100
+@@ -944,7 +944,7 @@
+ stdlib stdio-common libio malloc string wcsmbs time dirent \
+ grp pwd posix io termios resource misc socket sysvipc gmon \
+ gnulib iconv iconvdata wctype manual shadow gshadow po argp \
+- crypt nss localedata timezone rt conform debug \
++ crypt nss localedata rt conform debug \
+ $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ ifndef avoid-generated
diff --git a/patches/glibc/ports-2.16.0/400-alpha-xstat.patch b/patches/glibc/ports-2.16.0/400-alpha-xstat.patch
new file mode 100644
index 0000000..6e4ab8f
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/400-alpha-xstat.patch
@@ -0,0 +1,15 @@
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+@@ -386,6 +386,11 @@
+ # define __ASSUME_GETDENTS32_D_TYPE 1
+ #endif
+
++/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
++#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
++# define __ASSUME_STAT64_SYSCALL 1
++#endif
++
+ /* Starting with version 2.5.3, the initial location returned by `brk'
+ after exec is always rounded up to the next page. */
+ #if __LINUX_KERNEL_VERSION >= 132355
diff --git a/patches/glibc/ports-2.16.0/430-alpha-creat.patch b/patches/glibc/ports-2.16.0/430-alpha-creat.patch
new file mode 100644
index 0000000..da6ddda
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/430-alpha-creat.patch
@@ -0,0 +1,14 @@
+alpha does not have a __NR_creat
+
+http://bugs.gentoo.org/227275
+http://sourceware.org/bugzilla/show_bug.cgi?id=6650
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
+@@ -1 +1,5 @@
+ /* Defined as alias for the syscall. */
++#include <sysdep.h>
++#ifndef __NR_creat
++#include "../../../../../io/creat64.c"
++#endif
diff --git a/patches/glibc/ports-2.16.0/440-alpha-cache-shape.patch b/patches/glibc/ports-2.16.0/440-alpha-cache-shape.patch
new file mode 100644
index 0000000..5b1a298
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/440-alpha-cache-shape.patch
@@ -0,0 +1,13 @@
+older verisons of glibc would build dl-sysdep as shared-only and dl-support as
+static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
+glibc build dl-sysdep as both shared and static which means we now have symbol
+duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
+is both shared/static, there is no point in hooking dl-support anymore, so we
+can punt it.
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/dl-support.c
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
+@@ -1,2 +1,1 @@
+-#include "dl-auxv.h"
+ #include <elf/dl-support.c>
diff --git a/patches/glibc/ports-2.16.0/460-alpha-fix-gcc-4.1-warnings.patch b/patches/glibc/ports-2.16.0/460-alpha-fix-gcc-4.1-warnings.patch
new file mode 100644
index 0000000..f2ff04f
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/460-alpha-fix-gcc-4.1-warnings.patch
@@ -0,0 +1,56 @@
+2006-05-30 Falk Hueffner <falk@debian.org>
+
+ * sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
+ to ev6 in assembly code.
+
+{standard input}: Assembler messages:
+{standard input}:341: Error: macro requires $at register while noat in effect
+{standard input}:374: Error: macro requires $at register while noat in effect
+{standard input}:438: Error: macro requires $at register while noat in effect
+{standard input}:471: Error: macro requires $at register while noat in effect
+make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
+
+Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
+I cannot really think of anything better than
+
+ ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/ioperm.c
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
+@@ -178,13 +178,13 @@
+ static inline void
+ stb_mb(unsigned char val, unsigned long addr)
+ {
+- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
++ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ }
+
+ static inline void
+ stw_mb(unsigned short val, unsigned long addr)
+ {
+- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
++ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ }
+
+ static inline void
+@@ -356,7 +356,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned char r;
+
+- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
++ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ return r;
+ }
+
+@@ -366,7 +366,7 @@
+ unsigned long int addr = dense_port_to_cpu_addr (port);
+ unsigned short r;
+
+- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
++ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ return r;
+ }
+
+diff -durN glibc-2.16.0.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.16.0/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c
diff --git a/patches/glibc/ports-2.16.0/490-alpha_alpha-add-fdatasync-support.patch b/patches/glibc/ports-2.16.0/490-alpha_alpha-add-fdatasync-support.patch
new file mode 100644
index 0000000..acf250d
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/490-alpha_alpha-add-fdatasync-support.patch
@@ -0,0 +1,126 @@
+2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: define
+ __ASSUME_FDATASYNC.
+ * sysdeps/unix/sysv/linux/fdatasync.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
+ -fexceptions.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
+
+ sysdeps/unix/sysv/linux/Makefile | 1
+ sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
+ sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
+ sysdeps/unix/sysv/linux/syscalls.list | 1
+ 4 files changed, 76 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.13/sysdeps/unix/sysv/linux/Makefile
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
+@@ -21,6 +21,7 @@
+ setfsuid setfsgid makedev epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit
+
++CFLAGS-fdatasync.c = -fexceptions
+ CFLAGS-gethostid.c = -fexceptions
+ CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=0x80000000-__getpagesize()"
+
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
+@@ -0,0 +1,69 @@
++/* fdatasync -- synchronize at least the data part of a file with
++ the underlying media. Linux version.
++
++ Copyright (C) 2007 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, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <errno.h>
++#include <unistd.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++#include <bp-checks.h>
++
++#include <kernel-features.h>
++
++#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
++static int __have_no_fdatasync;
++#endif
++
++static int
++do_fdatasync (int fd)
++{
++#ifdef __ASSUME_FDATASYNC
++ return INLINE_SYSCALL (fdatasync, 1, fd);
++#elif defined __NR_fdatasync
++ if (!__builtin_expect (__have_no_fdatasync, 0))
++ {
++ int result = INLINE_SYSCALL (fdatasync, 1, fd);
++ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
++ return result;
++
++ __have_no_fdatasync = 1;
++ }
++#endif
++ return INLINE_SYSCALL (fsync, 1, fd);
++}
++
++int
++__fdatasync (int fd)
++{
++ if (SINGLE_THREAD_P)
++ return do_fdatasync (fd);
++
++ int oldtype = LIBC_CANCEL_ASYNC ();
++
++ int result = do_fdatasync (fd);
++
++ LIBC_CANCEL_RESET (oldtype);
++
++ return result;
++}
++
++weak_alias (__fdatasync, fdatasync)
++
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
+@@ -459,6 +459,12 @@
+ # define __ASSUME_FUTEX_LOCK_PI 1
+ #endif
+
++/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
++ was already present in 2.0 kernels on other architectures. */
++#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
++# define __ASSUME_FDATASYNC 1
++#endif
++
+ /* Support for utimensat syscall was added in 2.6.22, on SH
+ only after 2.6.22-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020616 \
+diff -durN glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list
+--- glibc-2.13.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
++++ glibc-2.13/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
+@@ -11,7 +11,6 @@
+ epoll_create1 EXTRA epoll_create1 i:i epoll_create1
+ epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
+ epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
+-fdatasync - fdatasync Ci:i fdatasync
+ flock - flock i:ii __flock flock
+ fork - fork i: __libc_fork __fork fork
+ get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms
diff --git a/patches/glibc/ports-2.16.0/530-alpha-fix-rtld-fPIC.patch b/patches/glibc/ports-2.16.0/530-alpha-fix-rtld-fPIC.patch
new file mode 100644
index 0000000..42faaa5
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/530-alpha-fix-rtld-fPIC.patch
@@ -0,0 +1,21 @@
+2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
+
+ ports/sysdeps/alpha/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/alpha/Makefile glibc-2.16.0/glibc-ports-2.16.0/sysdeps/alpha/Makefile
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
+@@ -35,7 +35,8 @@
+
+ ifeq ($(subdir),elf)
+ # The ld.so startup code cannot use literals until it self-relocates.
+-CFLAGS-rtld.c = -mbuild-constants
++# It uses more than 64k for the small data area.
++CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
+ endif
+
+ # Build everything with full IEEE math support, and with dynamic rounding;
+diff -durN glibc-2.16.0.orig/ports/sysdeps/alpha/Makefile glibc-2.16.0/ports/sysdeps/alpha/Makefile
diff --git a/patches/glibc/ports-2.16.0/560-ppc-atomic.patch b/patches/glibc/ports-2.16.0/560-ppc-atomic.patch
new file mode 100644
index 0000000..ee1cb90
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/560-ppc-atomic.patch
@@ -0,0 +1,415 @@
+sniped from suse
+
+Index: sysdeps/powerpc/bits/atomic.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
+retrieving revision 1.17
+diff -u -a -p -r1.17 atomic.h
+
+diff -durN glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h glibc-2.13/sysdeps/powerpc/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -85,14 +85,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -102,14 +102,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpw %0,%2\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -118,12 +118,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -132,11 +132,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stwcx. %3,0,%2\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stwcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -144,12 +144,12 @@
+ #define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stwcx. %1,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -157,12 +157,12 @@
+ #define __arch_atomic_increment_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -170,27 +170,27 @@
+ #define __arch_atomic_decrement_val_32(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: lwarx %0,0,%2\n" \
++ __asm __volatile ("1: lwarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stwcx. %0,0,%2\n" \
++ " stwcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: lwarx %0,0,%3\n" \
++ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " cmpwi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stwcx. %1,0,%3\n" \
++ " stwcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile ( \
+- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -60,14 +60,14 @@
+ ({ \
+ unsigned int __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %3,0,%1\n" \
++ " stwcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+diff -durN glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h
+--- glibc-2.13.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
++++ glibc-2.13/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
+@@ -44,14 +44,14 @@
+ ({ \
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (" clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -61,14 +61,14 @@
+ unsigned int __tmp, __tmp2; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+ " clrldi %1,%1,32\n" \
+- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
+ " subf. %0,%1,%0\n" \
+ " bne 2f\n" \
+- " stwcx. %4,0,%2\n" \
++ " stwcx. %4,%y2\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp), "=r" (__tmp2) \
+- : "b" (mem), "1" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
++ : "1" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -82,14 +82,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -98,14 +98,14 @@
+ ({ \
+ unsigned long __tmp; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " subf. %0,%2,%0\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (mem), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp != 0; \
+ })
+@@ -115,14 +115,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ( \
+- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -132,14 +132,14 @@
+ __typeof (*(mem)) __tmp; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " cmpd %0,%2\n" \
+ " bne 2f\n" \
+- " stdcx. %3,0,%1\n" \
++ " stdcx. %3,%y1\n" \
+ " bne- 1b\n" \
+ "2: " \
+- : "=&r" (__tmp) \
+- : "b" (__memp), "r" (oldval), "r" (newval) \
++ : "=&r" (__tmp), "+Z" (*__memp) \
++ : "r" (oldval), "r" (newval) \
+ : "cr0", "memory"); \
+ __tmp; \
+ })
+@@ -148,12 +148,12 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b\n" \
+ " " __ARCH_ACQ_INSTR \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -162,11 +162,11 @@
+ ({ \
+ __typeof (*mem) __val; \
+ __asm __volatile (__ARCH_REL_INSTR "\n" \
+- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+- " stdcx. %3,0,%2\n" \
++ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
++ " stdcx. %2,%y1\n" \
+ " bne- 1b" \
+- : "=&r" (__val), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&r" (__val), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -174,12 +174,12 @@
+ #define __arch_atomic_exchange_and_add_64(mem, value) \
+ ({ \
+ __typeof (*mem) __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
+- " add %1,%0,%4\n" \
+- " stdcx. %1,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
++ " add %1,%0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "r" (value), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : "r" (value) \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -187,12 +187,12 @@
+ #define __arch_atomic_increment_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " addi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+@@ -200,27 +200,27 @@
+ #define __arch_atomic_decrement_val_64(mem) \
+ ({ \
+ __typeof (*(mem)) __val; \
+- __asm __volatile ("1: ldarx %0,0,%2\n" \
++ __asm __volatile ("1: ldarx %0,%y1\n" \
+ " subi %0,%0,1\n" \
+- " stdcx. %0,0,%2\n" \
++ " stdcx. %0,%y1\n" \
+ " bne- 1b" \
+- : "=&b" (__val), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
+
+ #define __arch_atomic_decrement_if_positive_64(mem) \
+ ({ int __val, __tmp; \
+- __asm __volatile ("1: ldarx %0,0,%3\n" \
++ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " cmpdi 0,%0,0\n" \
+ " addi %1,%0,-1\n" \
+ " ble 2f\n" \
+- " stdcx. %1,0,%3\n" \
++ " stdcx. %1,%y2\n" \
+ " bne- 1b\n" \
+ "2: " __ARCH_ACQ_INSTR \
+- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
+- : "b" (mem), "m" (*mem) \
++ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
++ : \
+ : "cr0", "memory"); \
+ __val; \
+ })
diff --git a/patches/glibc/ports-2.16.0/580-nptl-lowlevellock.patch b/patches/glibc/ports-2.16.0/580-nptl-lowlevellock.patch
new file mode 100644
index 0000000..185331c
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/580-nptl-lowlevellock.patch
@@ -0,0 +1,23 @@
+fix build error on arm like on hppa:
+
+arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
+In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
+../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <atomic.h>
+ #include <sysdep.h>
+ #include <kernel-features.h>
++#include <tls.h> /* Need THREAD_*, and header.*. */
+
+ #define FUTEX_WAIT 0
+ #define FUTEX_WAKE 1
+diff -durN glibc-2.16.0.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.16.0/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
diff --git a/patches/glibc/ports-2.16.0/610-fpu-cw-mips.patch b/patches/glibc/ports-2.16.0/610-fpu-cw-mips.patch
new file mode 100644
index 0000000..0c0daf3
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/610-fpu-cw-mips.patch
@@ -0,0 +1,15 @@
+http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
+
+diff -durN glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/mips/fpu_control.h glibc-2.16.0/glibc-ports-2.16.0/sysdeps/mips/fpu_control.h
+--- glibc-2.16.0.orig/glibc-ports-2.16.0/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
++++ glibc-2.16.0/glibc-ports-2.16.0/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
+@@ -86,7 +86,7 @@
+ #define _FPU_RC_UP 0x2
+ #define _FPU_RC_DOWN 0x3
+
+-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
++#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
+
+
+ /* The fdlibm code requires strict IEEE double precision arithmetic,
+diff -durN glibc-2.16.0.orig/ports/sysdeps/mips/fpu_control.h glibc-2.16.0/ports/sysdeps/mips/fpu_control.h
diff --git a/patches/glibc/ports-2.16.0/630-mips_shn_undef-hack.patch b/patches/glibc/ports-2.16.0/630-mips_shn_undef-hack.patch
new file mode 100644
index 0000000..791d76c
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/630-mips_shn_undef-hack.patch
@@ -0,0 +1,16 @@
+diff -durN glibc-2.13.orig/elf/dl-lookup.c glibc-2.13/elf/dl-lookup.c
+--- glibc-2.13.orig/elf/dl-lookup.c 2009-03-30 23:14:32.000000000 +0200
++++ glibc-2.13/elf/dl-lookup.c 2009-11-13 00:51:36.000000000 +0100
+@@ -301,6 +301,12 @@
+ /* FALLTHROUGH */
+ case STB_GLOBAL:
+ success:
++#ifdef __mips__
++ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
++ symbols, we skip them. */
++ if (sym->st_shndx == SHN_UNDEF)
++ break;
++#endif
+ /* Global definition. Just what we need. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
diff --git a/patches/glibc/ports-2.16.0/640-alpha-atfcts.patch b/patches/glibc/ports-2.16.0/640-alpha-atfcts.patch
new file mode 100644
index 0000000..7a8a94a
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/640-alpha-atfcts.patch
@@ -0,0 +1,12 @@
+--- glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h 2010-07-27 14:34:39.000000000 +0300
++++ glibc-2.13/sysdeps/unix/sysv/linux/kernel-features.h.new 2011-03-10 18:54:37.686795979 +0200
+@@ -437,7 +437,8 @@
+ the code. On PPC they were introduced in 2.6.17-rc1,
+ on SH in 2.6.19-rc1. */
+ #if __LINUX_KERNEL_VERSION >= 0x020611 \
+- && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613)
++ && (!defined __sh__ || __LINUX_KERNEL_VERSION >= 0x020613) \
++ && (!defined __alpha__)
+ # define __ASSUME_ATFCTS 1
+ #endif
+
diff --git a/patches/glibc/ports-2.16.0/650-syslog.patch b/patches/glibc/ports-2.16.0/650-syslog.patch
new file mode 100644
index 0000000..c20cafc
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/650-syslog.patch
@@ -0,0 +1,12 @@
+diff -durN glibc-cvs-2.9.orig/misc/syslog.c glibc-cvs-2.9/misc/syslog.c
+--- glibc-cvs-2.9.orig/misc/syslog.c 2009-06-01 10:16:50.000000000 +0200
++++ glibc-cvs-2.9/misc/syslog.c 2009-06-01 10:17:20.000000000 +0200
+@@ -152,7 +152,7 @@
+ #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+- syslog(INTERNALLOG,
++ __syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
diff --git a/patches/glibc/ports-2.16.0/660-debug-readlink_chk-readklinkat_chk.patch b/patches/glibc/ports-2.16.0/660-debug-readlink_chk-readklinkat_chk.patch
new file mode 100644
index 0000000..a5a7052
--- /dev/null
+++ b/patches/glibc/ports-2.16.0/660-debug-readlink_chk-readklinkat_chk.patch
@@ -0,0 +1,24 @@
+diff -dur glibc-cvs-2.9.orig/debug/readlink_chk.c glibc-cvs-2.9/debug/readlink_chk.c
+--- glibc-cvs-2.9.orig/debug/readlink_chk.c 2005-03-01 01:41:15.000000000 +0100
++++ glibc-cvs-2.9/debug/readlink_chk.c 2009-06-01 10:59:37.000000000 +0200
+@@ -25,7 +25,7 @@
+
+
+ ssize_t
+-__readlink_chk (const char *path, void *buf, size_t len, size_t buflen)
++__readlink_chk (const char *path, char *buf, size_t len, size_t buflen)
+ {
+ if (len > buflen)
+ __chk_fail ();
+diff -dur glibc-cvs-2.9.orig/debug/readlinkat_chk.c glibc-cvs-2.9/debug/readlinkat_chk.c
+--- glibc-cvs-2.9.orig/debug/readlinkat_chk.c 2006-04-24 18:56:12.000000000 +0200
++++ glibc-cvs-2.9/debug/readlinkat_chk.c 2009-06-01 11:07:26.000000000 +0200
+@@ -21,7 +21,7 @@
+
+
+ ssize_t
+-__readlinkat_chk (int fd, const char *path, void *buf, size_t len,
++__readlinkat_chk (int fd, const char *path, char *buf, size_t len,
+ size_t buflen)
+ {
+ if (len > buflen)
diff --git a/samples/armv6-nommu-linux-uclibcgnueabi/crosstool.config b/samples/armv6-nommu-linux-uclibcgnueabi/crosstool.config
index e3d625f..398a550 100644
--- a/samples/armv6-nommu-linux-uclibcgnueabi/crosstool.config
+++ b/samples/armv6-nommu-linux-uclibcgnueabi/crosstool.config
@@ -5,16 +5,10 @@ CT_TARGET_VENDOR="nommu"
CT_KERNEL_linux=y
# CT_SHARED_LIBS is not set
# CT_KERNEL_LINUX_INSTALL_CHECK is not set
-CT_BINUTILS_LINKER_LD_GOLD=y
-CT_BINUTILS_GOLD_THREADS=y
-CT_BINUTILS_LD_WRAPPER=y
CT_BINUTILS_PLUGINS=y
+CT_THREADS_NONE=y
CT_CC_GCC_SHOW_LINARO=y
CT_CC_GCC_DISABLE_PCH=y
CT_CC_GCC_BUILD_ID=y
CT_CC_GCC_LNK_HASH_STYLE_BOTH=y
-CT_CC_LANG_CXX=y
-CT_DEBUG_gdb=y
-# CT_GDB_CROSS_PYTHON is not set
-CT_GDB_GDBSERVER=y
CT_GETTEXT=y
diff --git a/samples/i686-centos6-linux-gnu/crosstool.config b/samples/i686-centos6-linux-gnu/crosstool.config
new file mode 100644
index 0000000..204f9fb
--- /dev/null
+++ b/samples/i686-centos6-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_ARCH="i686"
+CT_TARGET_VENDOR="centos6"
+CT_KERNEL_linux=y
+CT_KERNEL_V_2_6_32=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_12_2=y
+CT_CC_LANG_CXX=y
diff --git a/samples/i686-centos6-linux-gnu/reported.by b/samples/i686-centos6-linux-gnu/reported.by
new file mode 100644
index 0000000..89b1435
--- /dev/null
+++ b/samples/i686-centos6-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="i686 config with kernel/libc versions matching CentOS 6.x."
diff --git a/samples/i686-centos7-linux-gnu/crosstool.config b/samples/i686-centos7-linux-gnu/crosstool.config
new file mode 100644
index 0000000..bb9f007
--- /dev/null
+++ b/samples/i686-centos7-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_ARCH="i686"
+CT_TARGET_VENDOR="centos7"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_10=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_17=y
+CT_CC_LANG_CXX=y
diff --git a/samples/i686-centos7-linux-gnu/reported.by b/samples/i686-centos7-linux-gnu/reported.by
new file mode 100644
index 0000000..92ea67d
--- /dev/null
+++ b/samples/i686-centos7-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="i686 config with kernel/libc versions matching CentOS 7.x."
diff --git a/samples/i686-ubuntu12.04-linux-gnu/crosstool.config b/samples/i686-ubuntu12.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..030c109
--- /dev/null
+++ b/samples/i686-ubuntu12.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_ARCH="i686"
+CT_TARGET_VENDOR="ubuntu12.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_2=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_15=y
+CT_CC_LANG_CXX=y
diff --git a/samples/i686-ubuntu12.04-linux-gnu/reported.by b/samples/i686-ubuntu12.04-linux-gnu/reported.by
new file mode 100644
index 0000000..97ae2f8
--- /dev/null
+++ b/samples/i686-ubuntu12.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="i686 kernel/libc matching Ubuntu 12.04 LTS."
diff --git a/samples/i686-ubuntu14.04-linux-gnu/crosstool.config b/samples/i686-ubuntu14.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..a67103a
--- /dev/null
+++ b/samples/i686-ubuntu14.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_ARCH="i686"
+CT_TARGET_VENDOR="ubuntu14.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_13=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_19=y
+CT_CC_LANG_CXX=y
diff --git a/samples/i686-ubuntu14.04-linux-gnu/reported.by b/samples/i686-ubuntu14.04-linux-gnu/reported.by
new file mode 100644
index 0000000..eda97ef
--- /dev/null
+++ b/samples/i686-ubuntu14.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="i686 kernel/libc matching Ubuntu 14.04 LTS."
diff --git a/samples/i686-ubuntu16.04-linux-gnu/crosstool.config b/samples/i686-ubuntu16.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..3ceac41
--- /dev/null
+++ b/samples/i686-ubuntu16.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_ARCH="i686"
+CT_TARGET_VENDOR="ubuntu16.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_4_4=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_23=y
+CT_CC_LANG_CXX=y
diff --git a/samples/i686-ubuntu16.04-linux-gnu/reported.by b/samples/i686-ubuntu16.04-linux-gnu/reported.by
new file mode 100644
index 0000000..bf87e70
--- /dev/null
+++ b/samples/i686-ubuntu16.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="i686 kernel/libc matching Ubuntu 16.04 LTS."
diff --git a/samples/x86_64-centos6-linux-gnu/crosstool.config b/samples/x86_64-centos6-linux-gnu/crosstool.config
new file mode 100644
index 0000000..4eb4611
--- /dev/null
+++ b/samples/x86_64-centos6-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_64=y
+CT_TARGET_VENDOR="centos6"
+CT_KERNEL_linux=y
+CT_KERNEL_V_2_6_32=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_12_2=y
+CT_CC_LANG_CXX=y
diff --git a/samples/x86_64-centos6-linux-gnu/reported.by b/samples/x86_64-centos6-linux-gnu/reported.by
new file mode 100644
index 0000000..d4c3d10
--- /dev/null
+++ b/samples/x86_64-centos6-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="x86_64 config with kernel/libc versions matching CentOS 6.x."
diff --git a/samples/x86_64-centos7-linux-gnu/crosstool.config b/samples/x86_64-centos7-linux-gnu/crosstool.config
new file mode 100644
index 0000000..4a441ef
--- /dev/null
+++ b/samples/x86_64-centos7-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_64=y
+CT_TARGET_VENDOR="centos7"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_10=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_17=y
+CT_CC_LANG_CXX=y
diff --git a/samples/x86_64-centos7-linux-gnu/reported.by b/samples/x86_64-centos7-linux-gnu/reported.by
new file mode 100644
index 0000000..02a7073
--- /dev/null
+++ b/samples/x86_64-centos7-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="x86_64 config with kernel/libc versions matching CentOS 7.x."
diff --git a/samples/x86_64-ubuntu12.04-linux-gnu/crosstool.config b/samples/x86_64-ubuntu12.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..c09ab9d
--- /dev/null
+++ b/samples/x86_64-ubuntu12.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_64=y
+CT_TARGET_VENDOR="ubuntu12.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_2=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_15=y
+CT_CC_LANG_CXX=y
diff --git a/samples/x86_64-ubuntu12.04-linux-gnu/reported.by b/samples/x86_64-ubuntu12.04-linux-gnu/reported.by
new file mode 100644
index 0000000..d060e03
--- /dev/null
+++ b/samples/x86_64-ubuntu12.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="x86_64 kernel/libc matching Ubuntu 12.04 LTS."
diff --git a/samples/x86_64-ubuntu14.04-linux-gnu/crosstool.config b/samples/x86_64-ubuntu14.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..68b3102
--- /dev/null
+++ b/samples/x86_64-ubuntu14.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_64=y
+CT_TARGET_VENDOR="ubuntu14.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_3_13=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_19=y
+CT_CC_LANG_CXX=y
diff --git a/samples/x86_64-ubuntu14.04-linux-gnu/reported.by b/samples/x86_64-ubuntu14.04-linux-gnu/reported.by
new file mode 100644
index 0000000..fd1df39
--- /dev/null
+++ b/samples/x86_64-ubuntu14.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="x86_64 kernel/libc matching Ubuntu 14.04 LTS."
diff --git a/samples/x86_64-ubuntu16.04-linux-gnu/crosstool.config b/samples/x86_64-ubuntu16.04-linux-gnu/crosstool.config
new file mode 100644
index 0000000..fc10edb
--- /dev/null
+++ b/samples/x86_64-ubuntu16.04-linux-gnu/crosstool.config
@@ -0,0 +1,9 @@
+CT_OBSOLETE=y
+CT_ARCH_x86=y
+CT_ARCH_64=y
+CT_TARGET_VENDOR="ubuntu16.04"
+CT_KERNEL_linux=y
+CT_KERNEL_V_4_4=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_LIBC_GLIBC_V_2_23=y
+CT_CC_LANG_CXX=y
diff --git a/samples/x86_64-ubuntu16.04-linux-gnu/reported.by b/samples/x86_64-ubuntu16.04-linux-gnu/reported.by
new file mode 100644
index 0000000..724921e
--- /dev/null
+++ b/samples/x86_64-ubuntu16.04-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="x86_64 kernel/libc matching Ubuntu 16.04 LTS."
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 2370964..a5ac7f9 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -1,7 +1,5 @@
# Build script for the gdb debug facility
-if [ "${CT_GDB_CROSS}" = y -o "${CT_GDB_GDBSERVER}" = "y" -o "${CT_GDB_NATIVE}" = "y" ]; then
-
do_debug_gdb_get() {
local linaro_version=""
local linaro_series=""
@@ -179,6 +177,9 @@ do_debug_gdb_build() {
native_extra_config=("${extra_config[@]}")
+ # We may not have C++ language configured for target
+ native_extra_config+=("--disable-build-with-cxx")
+
# GDB on Mingw depends on PDcurses, not ncurses
if [ "${CT_MINGW32}" != "y" ]; then
native_extra_config+=("--with-curses")
@@ -293,6 +294,9 @@ do_debug_gdb_build() {
gdbserver_extra_config=("${extra_config[@]}")
+ # We may not have C++ language configured for target
+ gdbserver_extra_config+=("--disable-build-with-cxx")
+
if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then
if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then
gdbserver_extra_config+=( --enable-inprocess-agent )
@@ -340,5 +344,3 @@ do_debug_gdb_build() {
CT_EndStep
fi
}
-
-fi
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 87f63d4..348c35a 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -5,6 +5,9 @@
do_libc_get() {
local date
local version
+ local -a addons_list
+
+ addons_list=($(do_libc_add_ons_list " "))
# Main source
if [ "${CT_LIBC_GLIBC_CUSTOM}" = "y" ]; then
@@ -23,16 +26,77 @@ do_libc_get() {
esac
fi
+ # C library addons
+ for addon in "${addons_list[@]}"; do
+ # Never ever try to download these add-ons,
+ # they've always been internal
+ case "${addon}" in
+ nptl) continue;;
+ esac
+
+ case "${addon}:${CT_LIBC_GLIBC_PORTS_EXTERNAL}" in
+ ports:y) ;;
+ ports:*) continue;;
+ esac
+
+ if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
+ http://mirrors.kernel.org/sourceware/glibc \
+ {http,ftp,https}://ftp.gnu.org/gnu/glibc \
+ ftp://{sourceware.org,gcc.gnu.org}/pub/glibc/{releases,snapshots}
+ then
+ # Some add-ons are bundled with glibc, others are
+ # bundled in their own tarball. Eg. NPTL is internal,
+ # while LinuxThreads was external. Also, for old
+ # versions of glibc, the libidn add-on was external,
+ # but with version >=2.10, it is internal.
+ CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
+ CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
+ fi
+ done
+
return 0
}
do_libc_extract() {
+ local addon
+
CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
# Custom glibc won't get patched, because CT_GetCustom
# marks custom glibc as patched.
CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
+ for addon in $(do_libc_add_ons_list " "); do
+ # If the addon was bundled with the main archive, we do not
+ # need to extract it. Worse, if we were to try to extract
+ # it, we'd get an error.
+ if [ -d "${addon}" ]; then
+ CT_DoLog DEBUG "Add-on '${addon}' already present, skipping extraction"
+ continue
+ fi
+
+ CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
+
+ CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
+ -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
+
+ # Some addons have the 'long' name, while others have the
+ # 'short' name, but patches are non-uniformly built with
+ # either the 'long' or 'short' name, whatever the addons name
+ # but we prefer the 'short' name and avoid duplicates.
+ if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then
+ CT_DoExecLog FILE mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}"
+ fi
+
+ CT_DoExecLog FILE ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
+
+ CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}"
+
+ # Remove the long name since it can confuse configure scripts to run
+ # the same source twice.
+ rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
+ done
+
# The configure files may be older than the configure.in files
# if using a snapshot (or even some tarballs). Fake them being
# up to date.