[packages/dietlibc] - added git patch updating to current devel state - removed patches obsoleted by git update - added
baggins
baggins at pld-linux.org
Thu Jan 1 16:26:30 CET 2015
commit f5ffcb6a8fd3d0d40c63c908b47a28fb9a9ecc80
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Thu Jan 1 15:24:57 2015 +0000
- added git patch updating to current devel state
- removed patches obsoleted by git update
- added x32 fixes
dietlibc-_syscall-no-arch.patch | 18 -
dietlibc-dynamic.patch | 73 -
dietlibc-fflush-null.patch | 12 -
dietlibc-gcc4.patch | 35 -
dietlibc-nice.patch | 20 -
dietlibc-strcoll.patch | 12 -
dietlibc.spec | 29 +-
git.patch | 14478 ++++++++++++++++++++++++++++++++++++++
x32-fixes.patch | 68 +
9 files changed, 14559 insertions(+), 186 deletions(-)
---
diff --git a/dietlibc.spec b/dietlibc.spec
index 19ea4eb..f8ee3b1 100644
--- a/dietlibc.spec
+++ b/dietlibc.spec
@@ -21,23 +21,18 @@ Source0: http://www.fefe.de/dietlibc/%{name}-%{version}.tar.bz2
Patch0: %{name}-ppc.patch
Patch1: %{name}-opt.patch
Patch2: %{name}-platform.patch
-# workaround for http://gcc.gnu.org/PR26374
-Patch3: %{name}-gcc4.patch
Patch4: %{name}-guard.patch
Patch5: %{name}-arm.patch
Patch6: %{name}-diet-m.patch
-Patch7: %{name}-nice.patch
Patch8: %{name}-nostrip.patch
Patch9: %{name}-stackgap-instead-of-ssp.patch
-Patch10: %{name}-fflush-null.patch
-Patch11: %{name}-_syscall-no-arch.patch
-Patch12: %{name}-dynamic.patch
-Patch13: %{name}-strcoll.patch
Patch14: umount-arch.patch
Patch15: %{name}-memalign.patch
Patch16: %{name}-getsubopt.patch
Patch17: %{name}-devmacros.patch
Patch19: %{name}-notify.patch
+Patch20: x32-fixes.patch
+Patch100: git.patch
URL: http://www.fefe.de/dietlibc/
BuildRequires: rpmbuild(macros) >= 1.566
BuildRequires: sed >= 4.0
@@ -106,33 +101,26 @@ statyczne.
%prep
%setup -q
%undos arm/md5asm.S
+%patch100 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
-%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
-%patch7 -p1
%patch8 -p1
%{!?with_ssp:%patch9 -p1}
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch19 -p1
+%patch20 -p1
%if "%{cc_version}" < "3.4"
%{__sed} -i -e '/CFLAGS/ s/-Wextra//' Makefile
%endif
-# there is unconditional nice.c already; __nice.c breaks x86_64 build
-%{__rm} lib/__nice.c
-
%build
export OPTFLAGS="%{rpmcflags}%{?with_ssp: -fno-stack-protector} -fno-strict-aliasing -Wa,--noexecstack"
CC="%{__cc}"
@@ -140,12 +128,18 @@ CC="%{__cc}"
sparc32 \
%endif
%{__make} -j1 all \
+%ifarch x32
+ MYARCH=x32 \
+%endif
prefix=%{dietprefix} \
CC="${CC#*ccache }"
%if %{with dynamic}
# 'dyn' target is not SMP safe
%{__make} -j1 dyn \
+%ifarch x32
+ MYARCH=x32 \
+%endif
prefix=%{dietprefix} \
CC="${CC}"
%endif
@@ -158,6 +152,9 @@ install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_bindir},%{_mandir}/man1}
sparc32 \
%endif
%{__make} install \
+%ifarch x32
+ MYARCH=x32 \
+%endif
DESTDIR=$RPM_BUILD_ROOT \
prefix=%{dietprefix}
diff --git a/dietlibc-_syscall-no-arch.patch b/dietlibc-_syscall-no-arch.patch
deleted file mode 100644
index 8abcc8e..0000000
--- a/dietlibc-_syscall-no-arch.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: dietlibc-0.30/libcompat/syscall.S
-===================================================================
---- dietlibc-0.30.orig/libcompat/syscall.S
-+++ dietlibc-0.30/libcompat/syscall.S
-@@ -130,6 +130,12 @@ syscall:
- b __unified_syscall
-
- #else
-- /* arch not implemented yet */
-+#include <endian.h>
-+ .section .note
-+#if (__WORDSIZE == 64)
-+ .quad __syscall_2_not_implemented_for_this_arch
-+#else
-+ .long __syscall_2_not_implemented_for_this_arch
-+#endif
- #endif
- .size syscall, . - syscall
diff --git a/dietlibc-dynamic.patch b/dietlibc-dynamic.patch
deleted file mode 100644
index 2bf946c..0000000
--- a/dietlibc-dynamic.patch
+++ /dev/null
@@ -1,73 +0,0 @@
---- dietlibc-0.33/i386/dyn_syscalls.S.orig 2014-01-28 17:41:38.966558564 +0100
-+++ dietlibc-0.33/i386/dyn_syscalls.S 2014-01-28 17:58:01.516517331 +0100
-@@ -195,7 +195,6 @@
- #include "../syscalls.s/n_sigpending.S"
- #include "../syscalls.s/n_sigprocmask.S"
- #include "../syscalls.s/n_sigsuspend.S"
--#include "../syscalls.s/nice.S"
- #include "../syscalls.s/pause.S"
- #include "../syscalls.s/personality.S"
- #include "../syscalls.s/query_module.S"
-@@ -400,4 +401,3 @@
- #include "__longjmp.S"
- #include "setjmp.S"
-
--#include "syscalls.s/__guard.S"
---- dietlibc-0.33/x86_64/dyn_syscalls.S.orig 2012-01-24 19:24:30.000000000 +0100
-+++ dietlibc-0.33/x86_64/dyn_syscalls.S 2014-01-28 17:58:08.859850356 +0100
-@@ -141,7 +141,6 @@
- #include "../syscalls.s/n_sigprocmask.S"
- #include "../syscalls.s/n_sigsuspend.S"
- #include "../syscalls.s/nanosleep.S"
--#include "../syscalls.s/nice.S"
- #include "../syscalls.s/open.S"
- #include "../syscalls.s/pause.S"
- #include "../syscalls.s/personality.S"
---- dietlibc-0.33/x86_64/clock_gettime.S.orig 2012-01-26 07:19:31.000000000 +0100
-+++ dietlibc-0.33/x86_64/clock_gettime.S 2014-01-28 20:34:23.670685222 +0100
-@@ -11,9 +11,16 @@
- .L1:
- push %rsi
- push %rdi
-+#ifdef __PIC__
-+ movq __vdso at GOTPCREL(%rip), %rax
-+ movq (%rax),%rdi
-+ movq funcname at GOTPCREL(%rip), %rsi
-+ call vdso_dlsym at PLT
-+#else
- movq __vdso(%rip),%rdi
- movq $funcname, %rsi
- call vdso_dlsym
-+#endif
- pop %rdi
- pop %rsi
- jmp .L2
---- dietlibc-0.33/x86_64/gettimeofday.S.orig 2012-01-24 19:24:30.000000000 +0100
-+++ dietlibc-0.33/x86_64/gettimeofday.S 2014-01-28 20:35:10.746157117 +0100
-@@ -11,9 +11,16 @@
- .L1:
- push %rsi
- push %rdi
-+#ifdef __PIC__
-+ movq __vdso at GOTPCREL(%rip), %rax
-+ movq (%rax),%rdi
-+ movq funcname at GOTPCREL(%rip), %rsi
-+ call vdso_dlsym at PLT
-+#else
- movq __vdso(%rip),%rdi
- movq $funcname, %rsi
- call vdso_dlsym
-+#endif
- pop %rdi
- pop %rsi
- jmp .L2
---- dietlibc-0.33/arm/dyn_syscalls.S.orig 2012-01-24 19:24:24.000000000 +0100
-+++ dietlibc-0.33/arm/dyn_syscalls.S 2014-01-28 20:58:27.842943864 +0100
-@@ -104,7 +104,6 @@
- #include "../syscalls.s/n_sigprocmask.S"
- #include "../syscalls.s/n_sigsuspend.S"
- #include "../syscalls.s/nanosleep.S"
--#include "../syscalls.s/nice.S"
- #include "../syscalls.s/open.S"
- #include "../syscalls.s/pause.S"
- #include "../syscalls.s/personality.S"
diff --git a/dietlibc-fflush-null.patch b/dietlibc-fflush-null.patch
deleted file mode 100644
index f09615e..0000000
--- a/dietlibc-fflush-null.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: dietlibc-0.30/libstdio/fflush.c
-===================================================================
---- dietlibc-0.30.orig/libstdio/fflush.c
-+++ dietlibc-0.30/libstdio/fflush.c
-@@ -17,7 +17,6 @@ int fflush_unlocked(FILE *stream) {
- if (stream==0) {
- int res;
- FILE *f;
-- __fflush_stdin();
- __fflush_stdout();
- __fflush_stderr();
- for (res=0, f=__stdio_root; f; f=f->next)
diff --git a/dietlibc-gcc4.patch b/dietlibc-gcc4.patch
deleted file mode 100644
index 1ffd816..0000000
--- a/dietlibc-gcc4.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- dietlibc-0.29/libm/gamma.c.orig 2005-03-15 08:51:23.000000000 +0000
-+++ dietlibc-0.29/libm/gamma.c 2006-02-24 21:09:59.000000000 +0000
-@@ -33,19 +33,19 @@
- #include <stdlib.h>
- #include <math.h>
-
--#define B0 + 1.0l/ 6/ 1/ 2
--#define B1 - 1.0l/ 30/ 3/ 4
--#define B2 + 1.0l/ 42/ 5/ 6
--#define B3 - 1.0l/ 30/ 7/ 8
--#define B4 + 5.0l/ 66/ 9/10
--#define B5 - 691.0l/2730/11/12
--#define B6 + 7.0l/ 6/13/14
--#define B7 - 3617.0l/ 510/15/16
--#define B8 + 43867.0l/ 798/17/18
--#define B9 - 174611.0l/ 330/19/20
--#define B10 + 854513.0l/ 138/21/22
--#define B11 - 236364091.0l/2730/23/24
--#define B12 + 8553103.0l/ 6/25/26
-+#define B0 + 1.0/ 6/ 1/ 2
-+#define B1 - 1.0/ 30/ 3/ 4
-+#define B2 + 1.0/ 42/ 5/ 6
-+#define B3 - 1.0/ 30/ 7/ 8
-+#define B4 + 5.0/ 66/ 9/10
-+#define B5 - 691.0/2730/11/12
-+#define B6 + 7.0/ 6/13/14
-+#define B7 - 3617.0/ 510/15/16
-+#define B8 + 43867.0/ 798/17/18
-+#define B9 - 174611.0/ 330/19/20
-+#define B10 + 854513.0/ 138/21/22
-+#define B11 - 236364091.0/2730/23/24
-+#define B12 + 8553103.0/ 6/25/26
-
- static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 };
- int signgam;
diff --git a/dietlibc-nice.patch b/dietlibc-nice.patch
deleted file mode 100644
index 641e6c3..0000000
--- a/dietlibc-nice.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: dietlibc-0.29/lib/__nice.c
-===================================================================
---- dietlibc-0.29.orig/lib/__nice.c
-+++ dietlibc-0.29/lib/__nice.c
-@@ -1,9 +1,14 @@
- #include "syscalls.h"
- #include <sys/time.h>
- #include <sys/resource.h>
-+#include <errno.h>
-
- #ifndef __NR_nice
- int nice(int i) {
-- return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i);
-+ if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) {
-+ errno=EPERM;
-+ return -1;
-+ }
-+ return getpriority(PRIO_PROCESS,0);
- }
- #endif
diff --git a/dietlibc-strcoll.patch b/dietlibc-strcoll.patch
deleted file mode 100644
index 6c52c49..0000000
--- a/dietlibc-strcoll.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -urN dietlibc-0.30.org/sparc/strcmp.S dietlibc-0.30/sparc/strcmp.S
---- dietlibc-0.30.org/sparc/strcmp.S 2003-09-04 03:50:50.000000000 +0200
-+++ dietlibc-0.30/sparc/strcmp.S 2007-06-14 12:16:41.325010165 +0200
-@@ -11,6 +11,8 @@
-
- .text
- .globl strcmp
-+.weak strcoll
-+strcoll:
- strcmp:
- clr %o4
- .Lloop:
diff --git a/git.patch b/git.patch
new file mode 100644
index 0000000..c647298
--- /dev/null
+++ b/git.patch
@@ -0,0 +1,14478 @@
+diff -urN -x .git dietlibc-0.33/alpha/Makefile.add dietlibc/alpha/Makefile.add
+--- dietlibc-0.33/alpha/Makefile.add 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/alpha/Makefile.add 2015-01-01 12:14:43.454938895 +0000
+@@ -3,3 +3,5 @@
+ VPATH:=alpha:syscalls.s:$(VPATH)
+
+ LIBOBJ+=$(patsubst %,$(OBJDIR)/%,divq.o divl.o remq.o reml.o __time.o __alarm.o __CAS.o)
++
++$(OBJDIR)/__pause.o: include/signal.h
+diff -urN -x .git dietlibc-0.33/alpha/start.S dietlibc/alpha/start.S
+--- dietlibc-0.33/alpha/start.S 2006-05-29 16:30:53.000000000 +0000
++++ dietlibc/alpha/start.S 2015-01-01 12:14:43.454938895 +0000
+@@ -24,6 +24,15 @@
+
+ stq $18, environ
+
++#ifdef WANT_ELFINFO
++# warning "MAKE ME alpha ASSEMBLER!"
++1: ldq $19, $18 ; load *envp into $19
++ addq $18, 1, $18 ; increment *envp
++ orr $19, $19, $19
++ jne 1b
++ stq $18, __elfinfo
++#endif
++
+ #ifdef WANT_DYNAMIC
+ /* in v0 ($0) is the ld.so _fini pointer */
+ mov $0, $19 /* mov v0(dynload) to a3 */
+diff -urN -x .git dietlibc-0.33/alpha/syscalls.h dietlibc/alpha/syscalls.h
+--- dietlibc-0.33/alpha/syscalls.h 2008-05-06 17:18:34.000000000 +0000
++++ dietlibc/alpha/syscalls.h 2015-01-01 12:14:43.454938895 +0000
+@@ -412,7 +412,38 @@
+ #define __NR_signalfd 476
+ #define __NR_timerfd 477
+ #define __NR_eventfd 478
+-
++#define __NR_recvmmsg 479
++#define __NR_fallocate 480
++#define __NR_timerfd_create 481
++#define __NR_timerfd_settime 482
++#define __NR_timerfd_gettime 483
++#define __NR_signalfd4 484
++#define __NR_eventfd2 485
++#define __NR_epoll_create1 486
++#define __NR_dup3 487
++#define __NR_pipe2 488
++#define __NR_inotify_init1 489
++#define __NR_preadv 490
++#define __NR_pwritev 491
++#define __NR_rt_tgsigqueueinfo 492
++#define __NR_perf_event_open 493
++#define __NR_fanotify_init 494
++#define __NR_fanotify_mark 495
++#define __NR_prlimit64 496
++#define __NR_name_to_handle_at 497
++#define __NR_open_by_handle_at 498
++#define __NR_clock_adjtime 499
++#define __NR_syncfs 500
++#define __NR_setns 501
++#define __NR_accept4 502
++#define __NR_sendmmsg 503
++#define __NR_process_vm_readv 504
++#define __NR_process_vm_writev 505
++#define __NR_kcmp 506
++#define __NR_finit_module 507
++#define __NR_sched_setattr 508
++#define __NR_sched_getattr 509
++#define __NR_renameat2 510
+
+ #define syscall_weak(name,wsym,sym) \
+ .text ; \
+diff -urN -x .git dietlibc-0.33/arm/__aeabi_read_tp.S dietlibc/arm/__aeabi_read_tp.S
+--- dietlibc-0.33/arm/__aeabi_read_tp.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/arm/__aeabi_read_tp.S 2015-01-01 12:14:43.454938895 +0000
+@@ -0,0 +1,13 @@
++#include "arm-features.h"
++
++FUNC_START __aeabi_read_tp
++
++#if __ARM_ARCH__ < 6
++ mvn r0, #0xf000
++ sub pc, r0, #31
++#else
++ mrc 15, 0, r0, cr13, cr0, 3
++ bx lr
++#endif
++
++FUNC_END __aeabi_read_tp
+diff -urN -x .git dietlibc-0.33/arm/__aeabi_unwind_cpp.S dietlibc/arm/__aeabi_unwind_cpp.S
+--- dietlibc-0.33/arm/__aeabi_unwind_cpp.S 2008-04-11 22:51:11.000000000 +0000
++++ dietlibc/arm/__aeabi_unwind_cpp.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,21 +1,14 @@
+-.text
+-.global __aeabi_unwind_cpp_pr0
+-.hidden __aeabi_unwind_cpp_pr0
+-.type __aeabi_unwind_cpp_pr0, %function
++#include "arm-features.h"
+
+-.global __aeabi_unwind_cpp_pr1
++FUNC_START __aeabi_unwind_cpp_pr0
++FUNC_START __aeabi_unwind_cpp_pr1
++FUNC_START __aeabi_unwind_cpp_pr2
++.hidden __aeabi_unwind_cpp_pr0
+ .hidden __aeabi_unwind_cpp_pr1
+-.type __aeabi_unwind_cpp_pr1, %function
+-
+-.global __aeabi_unwind_cpp_pr2
+ .hidden __aeabi_unwind_cpp_pr2
+-.type __aeabi_unwind_cpp_pr2, %function
+
+-__aeabi_unwind_cpp_pr0:
+-__aeabi_unwind_cpp_pr1:
+-__aeabi_unwind_cpp_pr2:
+- mov pc, lr @ return from subroutine
++ RET
+
+-.size __aeabi_unwind_cpp_pr0,.-__aeabi_unwind_cpp_pr0
+-.size __aeabi_unwind_cpp_pr1,.-__aeabi_unwind_cpp_pr1
+-.size __aeabi_unwind_cpp_pr2,.-__aeabi_unwind_cpp_pr2
++FUNC_END __aeabi_unwind_cpp_pr2
++FUNC_END __aeabi_unwind_cpp_pr1
++FUNC_END __aeabi_unwind_cpp_pr0
+diff -urN -x .git dietlibc-0.33/arm/arm-features.h dietlibc/arm/arm-features.h
+--- dietlibc-0.33/arm/arm-features.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/arm/arm-features.h 2015-01-01 12:14:43.454938895 +0000
+@@ -0,0 +1,110 @@
++/* --*- asm -*-- */
++
++#ifndef H_DIETLIBC_ARM_FEATURES_H
++#define H_DIETLIBC_ARM_FEATURES_H
++
++/* Stolen from gcc (gcc/config/arm/lib1funcs.asm) */
++#if defined(__ARM_ARCH_2__)
++# define __ARM_ARCH__ 2
++#endif
++
++#if defined(__ARM_ARCH_3__)
++# define __ARM_ARCH__ 3
++#endif
++
++#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \
++ || defined(__ARM_ARCH_4T__)
++# define __ARM_ARCH__ 4
++#endif
++
++#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
++ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
++ || defined(__ARM_ARCH_5TEJ__)
++# define __ARM_ARCH__ 5
++#endif
++
++#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
++ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
++ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
++ || defined(__ARM_ARCH_6M__)
++# define __ARM_ARCH__ 6
++#endif
++
++#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
++ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)
++# define __ARM_ARCH__ 7
++#endif
++
++#ifndef __ARM_ARCH__
++#error Unable to determine architecture.
++#endif
++
++#define DIET_JMPBUFSZ_REGS_REGULAR 10*32/8 /* r4-r11, sp, pc */
++#define DIET_JMPBUFSZ_REGS_FPv4 16*64/8 /* d0-d15 */
++
++#if !defined(__SOFTFP__) || defined(__IWMMXT__)
++# define DIET_HAVE_COPROC_REGS 1
++#else
++# undef DIET_HAVE_COPROC_REGS
++#endif
++
++#ifdef __ASSEMBLER__
++
++.macro FUNC_START name
++ .text
++ .align 0
++ .global \name
++ .type \name, %function
++\name:
++.endm
++
++.macro FUNC_START_WEAK name
++ .text
++ .align 0
++ .weak \name
++ .type \name, %function
++\name:
++.endm
++
++.macro FUNC_END name
++ .size \name, . - \name
++.endm
++
++.macro RET
++#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__)
++ bx lr
++#else
++ mov pc, lr
++#endif
++.endm
++
++.macro SWI_UNIFIED name
++#ifdef __ARM_EABI__
++ b __unified_syscall_swi
++#else
++ swi \name
++ b __unified_syscall
++#endif
++.endm
++
++.macro SWI_UNIFIED4
++#ifdef __ARM_EABI__
++ b __unified_syscall_swi
++#else
++ swi \name
++ b __unified_syscall4
++#endif
++.endm
++
++.macro LOAD_ARG4_5
++#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__)
++ ldr r4, [sp,#16]
++ ldr r5, [sp,#20]
++#else
++ ldrd r4, [sp,#16]
++#endif
++.endm
++
++#endif /* __ASSEMBLER__ */
++
++#endif /* H_DIETLIBC_ARM_FEATURES_H */
+diff -urN -x .git dietlibc-0.33/arm/arm_set_tls.S dietlibc/arm/arm_set_tls.S
+--- dietlibc-0.33/arm/arm_set_tls.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/arm/arm_set_tls.S 2015-01-01 12:14:43.454938895 +0000
+@@ -0,0 +1,27 @@
++#include "syscalls.h"
++#include "arm-features.h"
++
++#ifdef __ARM_EABI__
++
++@ Calling convention:
++@ r0 ... thread data
++@ Returns:
++@ r0 ... low-level error code
++FUNC_START __arm_set_tls
++ mov ip, r7
++ ldr r7, =__ARM_NR_set_tls
++ swi 0
++ mov r7, ip
++
++ @ we do not have much options here to handle errors because
++ @ errno might not be available yet. Return error code as-is
++ @ and let it handle by the caller
++
++ RET
++FUNC_END __arm_set_tls
++
++#else
++
++#warning "setup-tls only implemented for ARM_EABI!"
++
++#endif
+diff -urN -x .git dietlibc-0.33/arm/clone.S dietlibc/arm/clone.S
+--- dietlibc-0.33/arm/clone.S 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/arm/clone.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,11 +1,7 @@
+-
+ #include <errno.h>
+ #include "syscalls.h"
++#include "arm-features.h"
+
+- .text
+- .weak clone
+- .global __clone
+-
+ @
+ @ Some slightly tricky stuff here... edit with care :-)
+ @
+@@ -15,13 +11,12 @@
+
+ #define CLONE_VM 0x00000100
+ #define CLONE_THREAD 0x00010000
+-
++
+ @ ; don't do this yet
+ @#define RESET_PID
+
+-
+-clone:
+-__clone:
++FUNC_START_WEAK clone
++FUNC_START __clone
+ @ ; start with a sanity check
+ cmp r0, #0
+ cmpne r1, #0
+@@ -31,13 +26,13 @@
+ @ ; insert args into stack
+ str r3, [r1, #-4]!
+ str r0, [r1, #-4]!
+-
++
+ @ ; do the system call
+ @ ; get the flags
+ mov r0, r2
+-#ifdef RESET_PID
++#ifdef RESET_PID
+ mov ip, r2
+-#endif
++#endif
+ @ ; child sp is already in r1
+ stmfd sp!, {r4, r7}
+ @stmdb sp!, {r4, r7}
+@@ -46,14 +41,14 @@
+ ldr r4, [sp, #16]
+ ldr r7, =__NR_clone
+ swi 0
+-
++
+ cmp r0, #0
+ beq 1f
+- ldmfd sp!, {r4, r7}
++ ldmfd sp!, {r4, r7}
+ blt __unified_syscall @ (return code < 0): handle as an error
+- bx lr
+-1:
+-#ifdef RESET_PID
++ RET
++1:
++#ifdef RESET_PID
+ tst ip, #CLONE_THREAD
+ bne 3f
+
+@@ -67,21 +62,22 @@
+ swi 0
+ str r0, [r1, #PID_OFFSET] @ ; not defined yet ??
+ str r0, [r1, #TID_OFFSET] @ ; not defined yet ??
+-3:
++3:
+ #endif
+ @ ; pick the function arg and call address off the stack and execute
+ ldr r0, [sp, #4]
+ mov lr, pc
+ ldr pc, [sp], #8
+-
++
+ @ ; and we're done, passing return value through r0
+ b _exit @ branch to _exit (PIC safe)
++FUNC_END __clone
++FUNC_END clone
+
+-
+ #else
+-
+-clone:
+-__clone:
++
++FUNC_START_WEAK clone
++FUNC_START __clone
+ movs r12, r0 @ check function pointer
+ cmpne r1, #0 @ if function check for stack pointer
+ moveq r0, #-EINVAL @ if one is not available set errno value
+@@ -101,5 +97,7 @@
+ ldmia sp!, { r0, pc } @ load function param and jump to thread function
+
+ 1: b _exit @ branch to _exit (PIC safe)
++FUNC_END __clone
++FUNC_END clone
+
+ #endif
+diff -urN -x .git dietlibc-0.33/arm/dyn_syscalls.S dietlibc/arm/dyn_syscalls.S
+--- dietlibc-0.33/arm/dyn_syscalls.S 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/arm/dyn_syscalls.S 2015-01-01 12:14:43.454938895 +0000
+@@ -3,16 +3,21 @@
+ * Olaf Dreesen
+ */
+
++#include "arm-features.h"
++
+ #include "../syscalls.s/environ.S"
+ #include "../syscalls.s/errno.S"
+
+ #include <dietfeatures.h>
+ #include "syscalls.h"
+
+-.text
+-__unified_syscall4:
++#ifdef __ARM_EABI__
++# error "dyn_syscall.S not ported for EABI yet"
++#endif
++
++FUNC_START __unified_syscall4
+ ldmfd sp!, {r4, r5, r6}
+-__unified_syscall:
++FUNC_START __unified_syscall
+ cmn r0, #4096
+ movcc pc, lr
+ rsb r1, r0, #0
+@@ -25,7 +30,9 @@
+
+ mvn r0, #0
+ #include "dietuglyweaks.h"
+- mov pc, lr
++ RET
++FUNC_END __unified_syscall
++FUNC_END __unified_syscall4
+
+ /* ok now include all syscalls.s (*.S) and sysdep *.S */
+ #include "mmap.S"
+@@ -104,7 +111,6 @@
+ #include "../syscalls.s/n_sigprocmask.S"
+ #include "../syscalls.s/n_sigsuspend.S"
+ #include "../syscalls.s/nanosleep.S"
+-#include "../syscalls.s/nice.S"
+ #include "../syscalls.s/open.S"
+ #include "../syscalls.s/pause.S"
+ #include "../syscalls.s/personality.S"
+@@ -280,9 +286,11 @@
+ #include "../syscalls.s/fgetxattr.S"
+
+ /* other asm-files w.o. changes ... */
+-__exit:
++FUNC_START __exit
+ swi $__NR_exit
+ eor pc,lr,lr
++FUNC_END __exit
++
+ #define _exit __exit
+ #include "clone.S"
+ #undef _exit
+diff -urN -x .git dietlibc-0.33/arm/__fadvise.c dietlibc/arm/__fadvise.c
+--- dietlibc-0.33/arm/__fadvise.c 2011-03-03 18:40:05.000000000 +0000
++++ dietlibc/arm/__fadvise.c 2015-01-01 12:14:43.454938895 +0000
+@@ -1,5 +1,7 @@
+-#include <fcntl.h>
+ #include "syscalls.h"
++#define _LINUX_SOURCE
++#include <fcntl.h>
++#include <unistd.h>
+
+ #ifndef __NR_fadvise64
+ long fadvise64_64(int fd, off64_t offset, off64_t len, int advice)
+diff -urN -x .git dietlibc-0.33/arm/__guard.S dietlibc/arm/__guard.S
+--- dietlibc-0.33/arm/__guard.S 2006-06-21 19:55:25.000000000 +0000
++++ dietlibc/arm/__guard.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,4 +1,5 @@
+ .data
++.align 2
+ .type __guard,#object
+ .global __guard
+ .type __stack_chk_guard,#object
+@@ -7,3 +8,5 @@
+ __stack_chk_guard:
+ .long 0xaff00
+
++.size __guard, . - __guard
++.size __stack_chk_guard, . - __stack_chk_guard
+diff -urN -x .git dietlibc-0.33/arm/__longjmp.S dietlibc/arm/__longjmp.S
+--- dietlibc-0.33/arm/__longjmp.S 2001-07-02 16:06:48.000000000 +0000
++++ dietlibc/arm/__longjmp.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,11 +1,23 @@
+-.text
+-.global __longjmp
+-.type __longjmp,function
+-__longjmp:
++#include "arm-features.h"
++
++FUNC_START __longjmp
+ mov ip, r0
+ movs r0, r1
+ moveq r0, #1
+-#ifndef __SOFTFP__
+- lfm f4, 4, [ip], #48
++#ifndef __SOFTFP__
++# if __ARM_ARCH__ == 7
++ vldm ip!, {d0-d15}
++# ifdef __ARM_NEON__
++ vldm ip!, {d16-d31}
++# endif
++# else
++ lfm f4, 4, [ip]!
++# endif
+ #endif
+- ldmia ip, {r4-r11, sp, pc}
++
++#ifdef __IWMMXT__
++# warning "sigjmp will not restore iwmmxt coprocessor registers"
++#endif
++
++ ldmia ip!, {r4-r11, sp, pc}
++FUNC_END __longjmp
+diff -urN -x .git dietlibc-0.33/arm/Makefile.add dietlibc/arm/Makefile.add
+--- dietlibc-0.33/arm/Makefile.add 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/arm/Makefile.add 2015-01-01 12:14:43.454938895 +0000
+@@ -1,6 +1,7 @@
+
+ LIBOBJ+=$(OBJDIR)/md5asm.o $(OBJDIR)/__aeabi_unwind_cpp.o
+ LIBOBJ+=$(OBJDIR)/__fadvise.o $(OBJDIR)/arm_fadvise.o
++LIBOBJ+=$(OBJDIR)/__aeabi_read_tp.o $(OBJDIR)/arm_set_tls.o
+ CFLAGS+=-Os -fomit-frame-pointer -fstrict-aliasing
+ #ifdef __ARM_EABI__
+ #CFLAGS+=-mabi=aapcs-linux -mno-thumb-interwork
+diff -urN -x .git dietlibc-0.33/arm/mcount.S dietlibc/arm/mcount.S
+--- dietlibc-0.33/arm/mcount.S 2002-05-09 03:50:17.000000000 +0000
++++ dietlibc/arm/mcount.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,4 +1,4 @@
+-
++#include "arm-features.h"
+ @
+ @ mcount.S: ARM assembler implementation of mcount
+ @
+@@ -27,11 +27,7 @@
+ @
+ @
+
+-.text
+-
+-.global mcount
+-
+-mcount:
++FUNC_START mcount
+ mov ip, sp
+ stmdb sp!, { r0 - r3, fp, ip, lr, pc } @ build stack frame
+ sub fp, ip, #4 @ setup new fp
+@@ -43,4 +39,4 @@
+ bl __mcount @ call __mcount
+
+ ldmdb fp, { r0 - r3, fp, sp, pc } @ restore context from stack frame and return.
+-
++FUNC_END mcount
+diff -urN -x .git dietlibc-0.33/arm/md5asm.S dietlibc/arm/md5asm.S
+--- dietlibc-0.33/arm/md5asm.S 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/arm/md5asm.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,400 +1,394 @@
+-/*****************************************************************************
+-* Copyright (C) 2002 Andre McCurdy <armccurdy at yahoo.co.uk>
+-*
+-* "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm"
+-*
+-* This program is free software. you can redistribute it and/or modify
+-* it under the terms of the GNU General Public License as published by
+-* the Free Software Foundation; either version 2 of the License, or
+-* (at your option) any later version.
+-*
+-* This program is distributed in the hope that it will be useful,
+-* but WITHOUT ANY WARRANTY, without even the implied warranty of
+-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-* GNU General Public License for more details.
+-*
+-* You should have received a copy of the GNU General Public License
+-* along with this program; if not, write to the Free Software
+-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-*
+-******************************************************************************
+-*
+-* History:
+-*
+-* 2002/02/12: Andre McCurdy <armccurdy at yahoo.co.uk>
+-* - Original created.
+-*
+-* 2002/02/13: Andre McCurdy <armccurdy at yahoo.co.uk>
+-* - Rewrote MD5Update in assembler (saves 52 bytes).
+-* - Added guard so we don't compile anything for Big-Endian targets.
+-*
+-* 2002/02/22: Andre McCurdy <armccurdy at yahoo.co.uk>
+-* - Added new function MD5Update (a wrapper for the original version) which
+-* checks for correct 32bit alignment of the input data pointer.
+-* - Original MD5Update function renamed __MD5Update.
+-* - __MD5Transform symbol no longer exported.
+-*
+-* 2002/02/25: Andre McCurdy <armccurdy at yahoo.co.uk>
+-* - MD5Update re-written in assembler (saves 12 bytes + lots of cycles :-)
+-*
+-* 2002/03/07: Andre McCurdy <armccurdy at yahoo.co.uk>
+-* - _Finally_ fixed hashing from an unaligned buffer in all cases :-)
+-*
+-******************************************************************************
+-*
+-* Notes:
+-*
+-* This code is believed to be Position Independent (ie can be safely used
+-* as part of a shared library).
+-*
+-*****************************************************************************/
+-
+-#include <endian.h>
+-
+-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+-
+- .global MD5Init
+- .global MD5Update
+-
+- .text
+-#ifdef __ARM_EABI__
+- .align 4
+-#else
+- .align 2
+-#endif
+-
+- @ --
+- @ void MD5Init (MD5_CTX* context);
+- @ --
+-
+-MD5Init:
+-
+- adr r1, 1f @ r1 = base address of MD5InitData array
+- ldmia r1, { r1 - r3, r12 } @ load 4 elements from MD5InitData array
+- stmia r0, { r1 - r3, r12 } @ store into MD5 context->state[0..3]
+- mov r1, #0
+- str r1, [r0, #0x10] @ initial count[0] = 0
+- str r1, [r0, #0x14] @ initial count[1] = 0
+- mov pc, lr @ return
+-
+-1: .word 0x67452301 @ initial MD5 context->state[0]
+- .word 0xefcdab89 @ initial MD5 context->state[1]
+- .word 0x98badcfe @ initial MD5 context->state[2]
+- .word 0x10325476 @ initial MD5 context->state[3]
+-
+-
+- @ --
+- @ void MD5Update (MD5_CTX* context, const uint8_t* buf, signed int len);
+- @ --
+-
+-MD5Update:
+-
+- stmdb sp!, { r4 - r8, lr }
+- add r4, r0, #(6 * 4) @ r4 = &context->buffer[0]
+- ldmdb r4, { r0, r3 } @ r0 = count[0], r3 = count[1]
+- mov r5, r1 @ r5 = input
+- mov r6, r0, lsr #3 @ r6 = (context->count[0] >> 3)
+- and r6, r6, #0x3f @ r6 = byteIndex = ((context->count[0] >> 3) & 0x3f)
+- adds r0, r0, r2, lsl #3
+- adc r3, r3, r2, lsr #29
+- stmdb r4, { r0, r3 } @ context->count += (inputBytes * 8)
+- rsb r7, r6, #64 @ r7 = (64 - byteIndex) == partLen
+- subs r8, r2, r7 @ r8 = (inputBytes - partLen)
+- add r0, r4, r6
+- bcc 2f
+- mov r2, r7
+- bl memcpy @ memcpy (&context->buffer[byteIndex], input, partLen);
+- sub r0, r4, #(6 * 4)
+- mov r1, r4
+- mov r2, #1
+- bl __MD5Transform @ __MD5Transform (context->state, context->buffer, 1);
+- sub r0, r4, #(6 * 4)
+- add r1, r5, r7
+- mov r2, r8, lsr #6 @ r2 = len = ((inputBytes - partLen) / 64)
+- tst r1, #3 @ if (input & 0x03)
+- adr lr, 1f
+- beq __MD5Transform @ __MD5Transform (context->state, &input[partLen], len);
+- bne __UnalignedMD5Transform @ else __UnalignedMD5Transform (context->state, &input[partLen], len);
+-1: mov r0, r4
+- bic r2, r8, #0x3f
+- add r1, r2, r7
+- add r1, r1, r5
+- sub r2, r8, r2
+-2: ldmia sp!, { r4 - r8, lr }
+- b memcpy @ classic tail-call optimisation...
+-
+-
+- @ --
+- @ static void __MD5Transform (uint32_t *buf, const uint32_t *in, int repeat);
+- @ --
+-
+-MD5MagicData:
+-
+-1: .word 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee
+- .word 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, ( 3f- 4f-4)
+- .word 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, ( 3f- 4f-4)
+- .word 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, ( 3f- 4f-4)
+- .word 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, ( 4f- 4f-4)
+- .word 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, ( 5f- 9f-4)
+- .word 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, ( 6f- 9f-4)
+- .word 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, ( 7f- 9f-4)
+- .word 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, ( 9f- 9f-4)
+- .word 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, (10f-14f-4)
+- .word 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, (11f-14f-4)
+- .word 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, (12f-14f-4)
+- .word 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, (14f-14f-4)
+- .word 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, (15f-19f-4)
+- .word 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, (16f-19f-4)
+- .word 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, (17f-19f-4)
+- .word 0x6e4120A9, 0x20657264, 0x7543634d, 0x00796472, (19f-19f-4)
+-
+-__MD5Transform:
+-
+- cmp r2, #0
+- moveq pc, lr @ return if (repeat == 0)
+- stmdb sp!, { r0, r2, r4 - r11, lr } @ stack 'buf', 'repeat' and all callee saved registers
+- ldmia r0, { r2 - r5 } @ r2 = a, r3 = b, r4 = c, r5 = d
+-2: adr r0, 1b @ r0 = base address of MD5MagicData
+- ldmia r0!, { r6 - r9 } @ load first 4 elements from MD5MagicData
+-3: ldmia r1!, { r10 - r12, lr } @ r10 = in[i], r11 = in[i+1], r12 = in[i+2], lr = in[i+3]
+-
+- add r10, r10, r6 @ r10 = in[i] + MD5MagicData[i]
+- eor r6, r4, r5 @ r6 = (c ^ d)
+- and r6, r6, r3 @ r6 = ((c ^ d) & b)
+- eor r6, r6, r5 @ r6 = (((c ^ d) & b) ^ d)
+- add r2, r2, r6 @ a = (((c ^ d) & b) ^ d) + a
+- add r2, r2, r10 @ a = (((c ^ d) & b) ^ d) + a + (in[i] + MD5MagicData[i])
+- add r2, r3, r2, ROR #(32 - 7) @ a = b + (a rotated left by 7 places)
+-
+- add r11, r11, r7 @ r11 = in[i+1] + MD5MagicData[i+1]
+- eor r7, r3, r4 @ r7 = (b ^ c)
+- and r7, r7, r2 @ r7 = ((b ^ c) & a)
+- eor r7, r7, r4 @ r7 = (((b ^ c) & a) ^ c)
+- add r5, r5, r7 @ d = (((b ^ c) & a) ^ c) + d
+- add r5, r5, r11 @ d = (((b ^ c) & a) ^ c) + d + (in[i+1] + MD5MagicData[i+1])
+- add r5, r2, r5, ROR #(32 - 12) @ d = a + (d rotated left by 12 places)
+-
+- add r12, r12, r8 @ r12 = in[i+2] + MD5MagicData[i+2]
+- eor r8, r2, r3 @ r8 = (a ^ b)
+- and r8, r8, r5 @ r8 = ((a ^ b) & d)
+- eor r8, r8, r3 @ r8 = (((a ^ b) & d) ^ b)
+- add r4, r4, r8 @ c = (((a ^ b) & d) ^ b) + c
+- add r4, r4, r12 @ c = (((a ^ b) & d) ^ b) + c + (in[i+2] + MD5MagicData[i+2])
+- add r4, r5, r4, ROR #(32 - 17) @ c = d + (c rotated left by 17 places)
+-
+- add lr, lr, r9 @ lr = in[i+3] + MD5MagicData[i+3]
+- eor r9, r5, r2 @ r9 = (d ^ a)
+- and r9, r9, r4 @ r9 = ((d ^ a) & c)
+- eor r9, r9, r2 @ r9 = (((d ^ a) & c) ^ a)
+- add r3, r3, r9 @ b = (((d ^ a) & c) ^ a) + b
+- add r3, r3, lr @ b = (((d ^ a) & c) ^ a) + b + (in[i+3] + MD5MagicData[i+3])
+- add r3, r4, r3, ROR #(32 - 22) @ b = c + (b rotated left by 22 places)
+-
+- ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
+- add pc, pc, r10 @ and branch to next state
+-
+-4: ldr r10, [r1, #-(15*4)] @ r10 = in[ 1]
+- ldr r11, [r1, #-(10*4)] @ r11 = in[ 6]
+- ldr r12, [r1, #-( 5*4)] @ r12 = in[11]
+- ldr lr, [r1, #-(16*4)] @ lr = in[ 0]
+- b 8f
+-5: ldr r10, [r1, #-(11*4)] @ r10 = in[ 5]
+- ldr r11, [r1, #-( 6*4)] @ r11 = in[10]
+- ldr r12, [r1, #-( 1*4)] @ r12 = in[15]
+- ldr lr, [r1, #-(12*4)] @ lr = in[ 4]
+- b 8f
+-6: ldr r10, [r1, #-( 7*4)] @ r10 = in[ 9]
+- ldr r11, [r1, #-( 2*4)] @ r11 = in[14]
+- ldr r12, [r1, #-(13*4)] @ r12 = in[ 3]
+- ldr lr, [r1, #-( 8*4)] @ lr = in[ 8]
+- b 8f
+-7: ldr r10, [r1, #-( 3*4)] @ r10 = in[13]
+- ldr r11, [r1, #-(14*4)] @ r11 = in[ 2]
+- ldr r12, [r1, #-( 9*4)] @ r12 = in[ 7]
+- ldr lr, [r1, #-( 4*4)] @ lr = in[12]
+-
+-8: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
+- eor r6, r3, r4 @ r6 = (b ^ c)
+- and r6, r6, r5 @ r6 = ((b ^ c) & d)
+- eor r6, r6, r4 @ r6 = (((b ^ c) & d) ^ c)
+- add r2, r2, r6 @ a = (((b ^ c) & d) ^ c) + a
+- add r2, r2, r10 @ a = (((b ^ c) & d) ^ c) + a + (in[x] + MD5MagicData[i])
+- add r2, r3, r2, ROR #(32 - 5) @ a = b + (a rotated left by 5 places)
+-
+- add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i+1]
+- eor r7, r2, r3 @ r7 = (a ^ b)
+- and r7, r7, r4 @ r7 = ((a ^ b) & c)
+- eor r7, r7, r3 @ r7 = (((a ^ b) & c) ^ b)
+- add r5, r5, r7 @ d = (((a ^ b) & c) ^ b) + d
+- add r5, r5, r11 @ d = (((a ^ b) & c) ^ b) + d + (in[x] + MD5MagicData[i+1])
+- add r5, r2, r5, ROR #(32 - 9) @ d = a + (d rotated left by 9 places)
+-
+- add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i+2]
+- eor r8, r5, r2 @ r8 = (d ^ a)
+- and r8, r8, r3 @ r8 = ((d ^ a) & b)
+- eor r8, r8, r2 @ r8 = (((d ^ a) & b) ^ a)
+- add r4, r4, r8 @ c = (((d ^ a) & b) ^ a) + c
+- add r4, r4, r12 @ c = (((d ^ a) & b) ^ a) + c + (in[x] + MD5MagicData[i+2])
+- add r4, r5, r4, ROR #(32 - 14) @ c = d + (c rotated left by 14 places)
+-
+- add lr, lr, r9 @ lr = in[x] + MD5MagicData[i+3]
+- eor r9, r4, r5 @ r9 = (c ^ d)
+- and r9, r9, r2 @ r9 = ((c ^ d) & a)
+- eor r9, r9, r5 @ r9 = (((c ^ d) & a) ^ d)
+- add r3, r3, r9 @ b = (((c ^ d) & a) ^ d) + b
+- add r3, r3, lr @ b = (((c ^ d) & a) ^ d) + b + (in[x] + MD5MagicData[i+3])
+- add r3, r4, r3, ROR #(32 - 20) @ b = c + (b rotated left by 20 places)
+-
+- ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
+- add pc, pc, r10 @ and branch to next state
+-
+-9: ldr r10, [r1, #-(11*4)] @ r10 = in[ 5]
+- ldr r11, [r1, #-( 8*4)] @ r11 = in[ 8]
+- ldr r12, [r1, #-( 5*4)] @ r12 = in[11]
+- ldr lr, [r1, #-( 2*4)] @ lr = in[14]
+- b 13f
+-10: ldr r10, [r1, #-(15*4)] @ r10 = in[ 1]
+- ldr r11, [r1, #-(12*4)] @ r11 = in[ 4]
+- ldr r12, [r1, #-( 9*4)] @ r12 = in[ 7]
+- ldr lr, [r1, #-( 6*4)] @ lr = in[10]
+- b 13f
+-11: ldr r10, [r1, #-( 3*4)] @ r10 = in[13]
+- ldr r11, [r1, #-(16*4)] @ r11 = in[ 0]
+- ldr r12, [r1, #-(13*4)] @ r12 = in[ 3]
+- ldr lr, [r1, #-(10*4)] @ lr = in[ 6]
+- b 13f
+-12: ldr r10, [r1, #-( 7*4)] @ r10 = in[ 9]
+- ldr r11, [r1, #-( 4*4)] @ r11 = in[12]
+- ldr r12, [r1, #-( 1*4)] @ r12 = in[15]
+- ldr lr, [r1, #-(14*4)] @ lr = in[ 2]
+-
+-13: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
+- add r2, r2, r10 @ a += in[x] + MD5MagicData[i]
+- eor r6, r3, r4 @ r6 = (b ^ c)
+- eor r10, r6, r5 @ r10 = (b ^ c ^ d)
+- add r2, r2, r10 @ a += (b ^ c ^ d)
+- add r2, r3, r2, ROR #(32 - 4) @ a = b + (a rotated left by 4 places)
+-
+- add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i+1]
+- eor r7, r2, r6 @ r7 = (a ^ b ^ c)
+- add r5, r5, r7 @ d = (a ^ b ^ c) + d
+- add r5, r5, r11 @ d = (a ^ b ^ c) + d + (in[x] + MD5MagicData[i+1])
+- add r5, r2, r5, ROR #(32 - 11) @ d = a + (d rotated left by 11 places)
+-
+- add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i+2]
+- add r4, r4, r12 @ c += in[x] + MD5MagicData[i+2]
+- eor r8, r5, r2 @ r8 = (d ^ a)
+- eor r12, r8, r3 @ r12 = (d ^ a ^ b)
+- add r4, r4, r12 @ c += (d ^ a ^ b)
+- add r4, r5, r4, ROR #(32 - 16) @ c = d + (c rotated left by 16 places)
+-
+- add lr, lr, r9 @ lr = in[x] + MD5MagicData[i+3]
+- eor r9, r4, r8 @ r9 = (c ^ d ^ a)
+- add r3, r3, r9 @ b = (c ^ d ^ a) + b
+- add r3, r3, lr @ b = (c ^ d ^ a) + b + (in[x] + MD5MagicData[i+3])
+- add r3, r4, r3, ROR #(32 - 23) @ b = c + (b rotated left by 23 places)
+-
+- ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
+- add pc, pc, r10 @ and branch to next state
+-
+-14: ldr r10, [r1, #-(16*4)] @ r10 = in[ 0]
+- ldr r11, [r1, #-( 9*4)] @ r11 = in[ 7]
+- ldr r12, [r1, #-( 2*4)] @ r12 = in[14]
+- ldr lr, [r1, #-(11*4)] @ lr = in[ 5]
+- b 18f
+-15: ldr r10, [r1, #-( 4*4)] @ r10 = in[12]
+- ldr r11, [r1, #-(13*4)] @ r11 = in[ 3]
+- ldr r12, [r1, #-( 6*4)] @ r12 = in[10]
+- ldr lr, [r1, #-(15*4)] @ lr = in[ 1]
+- b 18f
+-16: ldr r10, [r1, #-( 8*4)] @ r10 = in[ 8]
+- ldr r11, [r1, #-( 1*4)] @ r11 = in[15]
+- ldr r12, [r1, #-(10*4)] @ r12 = in[ 6]
+- ldr lr, [r1, #-( 3*4)] @ lr = in[13]
+- b 18f
+-17: ldr r10, [r1, #-(12*4)] @ r10 = in[ 4]
+- ldr r11, [r1, #-( 5*4)] @ r11 = in[11]
+- ldr r12, [r1, #-(14*4)] @ r12 = in[ 2]
+- ldr lr, [r1, #-( 7*4)] @ lr = in[ 9]
+-
+-18: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
+- add r2, r2, r10 @ a += in[x] + MD5MagicData[i]
+- mvn r6, r5 @ r6 = ( ~d)
+- orr r6, r6, r3 @ r6 = (b | ~d)
+- eor r6, r6, r4 @ r6 = (c ^ (b | ~d))
+- add r2, r2, r6 @ a += (c ^ (b | ~d))
+- add r2, r3, r2, ROR #(32 - 6) @ a = b + (a rotated left by 6 places)
+-
+- add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i]
+- add r5, r5, r11 @ d += in[x] + MD5MagicData[i]
+- mvn r7, r4 @ r7 = ( ~c)
+- orr r7, r7, r2 @ r7 = (a | ~c)
+- eor r7, r7, r3 @ r7 = (b ^ (a | ~c))
+- add r5, r5, r7 @ d += (b ^ (a | ~c))
+- add r5, r2, r5, ROR #(32 - 10) @ d = a + (d rotated left by 10 places)
+-
+- add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i]
+- add r4, r4, r12 @ c += in[x] + MD5MagicData[i]
+- mvn r8, r3 @ r8 = ( ~b)
+- orr r8, r8, r5 @ r8 = (d | ~b)
+- eor r8, r8, r2 @ r8 = (a ^ (d | ~b))
+- add r4, r4, r8 @ c += (a ^ (d | ~b))
+- add r4, r5, r4, ROR #(32 - 15) @ c = d + (c rotated left by 15 places)
+-
+- add lr, lr, r9 @ lr = in[x] + MD5MagicData[i]
+- add r3, r3, lr @ b += in[x] + MD5MagicData[i]
+- mvn r9, r2 @ r9 = ( ~a)
+- orr r9, r9, r4 @ r9 = (c | ~a)
+- eor r9, r9, r5 @ r9 = (d ^ (c | ~a))
+- add r3, r3, r9 @ b += (d ^ (c | ~a))
+- add r3, r4, r3, ROR #(32 - 21) @ b = c + (b rotated left by 21 places)
+-
+- ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
+- add pc, pc, r10 @ and branch to next state
+-
+-19: ldmia sp, { r0, r10 } @ fetch 'buf' and 'repeat' from the stack
+- ldmia r0, { r6 - r9 } @ r6 = buf[0], r7 = buf[1], r8 = buf[2], r9 = buf[3] (original values..)
+- subs r10, r10, #1
+- strne r10, [sp, #4]
+- add r2, r6, r2
+- add r3, r7, r3
+- add r4, r8, r4
+- add r5, r9, r5
+- stmia r0, { r2 - r5 }
+- bne 2b
+- ldmia sp!, { r0, r2, r4 - r11, pc } @ restore all callee saved registers and return
+-
+-
+- @ --
+- @ static void __UnalignedMD5Transform (uint32_t *buf, const uint8_t *in, int repeat);
+- @ --
+-
+-__UnalignedMD5Transform:
+-
+- stmdb sp!, { r4 - r7, lr }
+- movs r4, r2, lsl #6 @ r4 = (repeat * 64)
+- ldmeqia sp!, { r4 - r7, pc } @ if ((repeat * 64) == 0) return;
+- mov r5, r0 @ r5 = state
+- mov r6, r1 @ r6 = in
+- sub sp, sp, #256 @ create 256 byte temp buffer
+-1: cmp r4, #256
+- mov r0, sp
+- movcc r7, r4
+- movcs r7, #256 @ r7 = (blockCount * 64) = min((repeat * 64), (4 * 64))
+- mov r1, r6
+- mov r2, r7
+- bl memcpy @ memcpy (blockBuffer, in, (blockCount * 64));
+- mov r0, r5
+- mov r1, sp
+- mov r2, r7, lsr #6
+- bl __MD5Transform @ __MD5Transform (state, blockBuffer, blockCount);
+- subs r4, r4, #256 @ (repeat * 64) -= (4 * 64);
+- add r6, r6, #256 @ in += (4 * 64);
+- bgt 1b @ loop while (repeat > 0)
+- add sp, sp, #256 @ return temp buffer to stack
+- ldmia sp!, { r4 - r7, pc } @ return
+-
+-
+-#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
+-
+-
++#include "arm-features.h"
++
++/*****************************************************************************
++* Copyright (C) 2002 Andre McCurdy <armccurdy at yahoo.co.uk>
++*
++* "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm"
++*
++* This program is free software. you can redistribute it and/or modify
++* it under the terms of the GNU General Public License as published by
++* the Free Software Foundation; either version 2 of the License, or
++* (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY, without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public License
++* along with this program; if not, write to the Free Software
++* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++*
++******************************************************************************
++*
++* History:
++*
++* 2002/02/12: Andre McCurdy <armccurdy at yahoo.co.uk>
++* - Original created.
++*
++* 2002/02/13: Andre McCurdy <armccurdy at yahoo.co.uk>
++* - Rewrote MD5Update in assembler (saves 52 bytes).
++* - Added guard so we don't compile anything for Big-Endian targets.
++*
++* 2002/02/22: Andre McCurdy <armccurdy at yahoo.co.uk>
++* - Added new function MD5Update (a wrapper for the original version) which
++* checks for correct 32bit alignment of the input data pointer.
++* - Original MD5Update function renamed __MD5Update.
++* - __MD5Transform symbol no longer exported.
++*
++* 2002/02/25: Andre McCurdy <armccurdy at yahoo.co.uk>
++* - MD5Update re-written in assembler (saves 12 bytes + lots of cycles :-)
++*
++* 2002/03/07: Andre McCurdy <armccurdy at yahoo.co.uk>
++* - _Finally_ fixed hashing from an unaligned buffer in all cases :-)
++*
++******************************************************************************
++*
++* Notes:
++*
++* This code is believed to be Position Independent (ie can be safely used
++* as part of a shared library).
++*
++*****************************************************************************/
++
++#include <endian.h>
++#include "arm-features.h"
++
++#if (__BYTE_ORDER == __LITTLE_ENDIAN)
++
++ @ --
++ @ void MD5Init (MD5_CTX* context);
++ @ --
++
++FUNC_START MD5Init
++ adr r1, 1f @ r1 = base address of MD5InitData array
++ ldmia r1, { r1 - r3, r12 } @ load 4 elements from MD5InitData array
++ stmia r0, { r1 - r3, r12 } @ store into MD5 context->state[0..3]
++ mov r1, #0
++ str r1, [r0, #0x10] @ initial count[0] = 0
++ str r1, [r0, #0x14] @ initial count[1] = 0
++ RET
++
++ .align 3
++1: .word 0x67452301 @ initial MD5 context->state[0]
++ .word 0xefcdab89 @ initial MD5 context->state[1]
++ .word 0x98badcfe @ initial MD5 context->state[2]
++ .word 0x10325476 @ initial MD5 context->state[3]
++FUNC_END MD5Init
++
++ @ --
++ @ void MD5Update (MD5_CTX* context, const uint8_t* buf, signed int len);
++ @ --
++
++FUNC_START MD5Update
++ stmdb sp!, { r4 - r8, lr }
++ add r4, r0, #(6 * 4) @ r4 = &context->buffer[0]
++ ldmdb r4, { r0, r3 } @ r0 = count[0], r3 = count[1]
++ mov r5, r1 @ r5 = input
++ mov r6, r0, lsr #3 @ r6 = (context->count[0] >> 3)
++ and r6, r6, #0x3f @ r6 = byteIndex = ((context->count[0] >> 3) & 0x3f)
++ adds r0, r0, r2, lsl #3
++ adc r3, r3, r2, lsr #29
++ stmdb r4, { r0, r3 } @ context->count += (inputBytes * 8)
++ rsb r7, r6, #64 @ r7 = (64 - byteIndex) == partLen
++ subs r8, r2, r7 @ r8 = (inputBytes - partLen)
++ add r0, r4, r6
++ bcc 2f
++ mov r2, r7
++ bl memcpy @ memcpy (&context->buffer[byteIndex], input, partLen);
++ sub r0, r4, #(6 * 4)
++ mov r1, r4
++ mov r2, #1
++ bl __MD5Transform @ __MD5Transform (context->state, context->buffer, 1);
++ sub r0, r4, #(6 * 4)
++ add r1, r5, r7
++ mov r2, r8, lsr #6 @ r2 = len = ((inputBytes - partLen) / 64)
++ tst r1, #3 @ if (input & 0x03)
++ adr lr, 1f
++ beq __MD5Transform @ __MD5Transform (context->state, &input[partLen], len);
++ bne __UnalignedMD5Transform @ else __UnalignedMD5Transform (context->state, &input[partLen], len);
++1: mov r0, r4
++ bic r2, r8, #0x3f
++ add r1, r2, r7
++ add r1, r1, r5
++ sub r2, r8, r2
++2: ldmia sp!, { r4 - r8, lr }
++ b memcpy @ classic tail-call optimisation...
++FUNC_END MD5Update
++
++ @ --
++ @ static void __MD5Transform (uint32_t *buf, const uint32_t *in, int repeat);
++ @ --
++
++.align 3
++MD5MagicData:
++
++1: .word 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee
++ .word 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, ( 3f- 4f-4)
++ .word 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, ( 3f- 4f-4)
++ .word 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, ( 3f- 4f-4)
++ .word 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, ( 4f- 4f-4)
++ .word 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, ( 5f- 9f-4)
++ .word 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, ( 6f- 9f-4)
++ .word 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, ( 7f- 9f-4)
++ .word 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, ( 9f- 9f-4)
++ .word 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, (10f-14f-4)
++ .word 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, (11f-14f-4)
++ .word 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, (12f-14f-4)
++ .word 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, (14f-14f-4)
++ .word 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, (15f-19f-4)
++ .word 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, (16f-19f-4)
++ .word 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, (17f-19f-4)
++ .word 0x6e4120A9, 0x20657264, 0x7543634d, 0x00796472, (19f-19f-4)
++
++.align 2
++__MD5Transform:
++
++ cmp r2, #0
++ moveq pc, lr @ return if (repeat == 0)
++ stmdb sp!, { r0, r2, r4 - r11, lr } @ stack 'buf', 'repeat' and all callee saved registers
++ ldmia r0, { r2 - r5 } @ r2 = a, r3 = b, r4 = c, r5 = d
++2: adr r0, 1b @ r0 = base address of MD5MagicData
++ ldmia r0!, { r6 - r9 } @ load first 4 elements from MD5MagicData
++3: ldmia r1!, { r10 - r12, lr } @ r10 = in[i], r11 = in[i+1], r12 = in[i+2], lr = in[i+3]
++
++ add r10, r10, r6 @ r10 = in[i] + MD5MagicData[i]
++ eor r6, r4, r5 @ r6 = (c ^ d)
++ and r6, r6, r3 @ r6 = ((c ^ d) & b)
++ eor r6, r6, r5 @ r6 = (((c ^ d) & b) ^ d)
++ add r2, r2, r6 @ a = (((c ^ d) & b) ^ d) + a
++ add r2, r2, r10 @ a = (((c ^ d) & b) ^ d) + a + (in[i] + MD5MagicData[i])
++ add r2, r3, r2, ROR #(32 - 7) @ a = b + (a rotated left by 7 places)
++
++ add r11, r11, r7 @ r11 = in[i+1] + MD5MagicData[i+1]
++ eor r7, r3, r4 @ r7 = (b ^ c)
++ and r7, r7, r2 @ r7 = ((b ^ c) & a)
++ eor r7, r7, r4 @ r7 = (((b ^ c) & a) ^ c)
++ add r5, r5, r7 @ d = (((b ^ c) & a) ^ c) + d
++ add r5, r5, r11 @ d = (((b ^ c) & a) ^ c) + d + (in[i+1] + MD5MagicData[i+1])
++ add r5, r2, r5, ROR #(32 - 12) @ d = a + (d rotated left by 12 places)
++
++ add r12, r12, r8 @ r12 = in[i+2] + MD5MagicData[i+2]
++ eor r8, r2, r3 @ r8 = (a ^ b)
++ and r8, r8, r5 @ r8 = ((a ^ b) & d)
++ eor r8, r8, r3 @ r8 = (((a ^ b) & d) ^ b)
++ add r4, r4, r8 @ c = (((a ^ b) & d) ^ b) + c
++ add r4, r4, r12 @ c = (((a ^ b) & d) ^ b) + c + (in[i+2] + MD5MagicData[i+2])
++ add r4, r5, r4, ROR #(32 - 17) @ c = d + (c rotated left by 17 places)
++
++ add lr, lr, r9 @ lr = in[i+3] + MD5MagicData[i+3]
++ eor r9, r5, r2 @ r9 = (d ^ a)
++ and r9, r9, r4 @ r9 = ((d ^ a) & c)
++ eor r9, r9, r2 @ r9 = (((d ^ a) & c) ^ a)
++ add r3, r3, r9 @ b = (((d ^ a) & c) ^ a) + b
++ add r3, r3, lr @ b = (((d ^ a) & c) ^ a) + b + (in[i+3] + MD5MagicData[i+3])
++ add r3, r4, r3, ROR #(32 - 22) @ b = c + (b rotated left by 22 places)
++
++ ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
++ add pc, pc, r10 @ and branch to next state
++
++4: ldr r10, [r1, #-(15*4)] @ r10 = in[ 1]
++ ldr r11, [r1, #-(10*4)] @ r11 = in[ 6]
++ ldr r12, [r1, #-( 5*4)] @ r12 = in[11]
++ ldr lr, [r1, #-(16*4)] @ lr = in[ 0]
++ b 8f
++5: ldr r10, [r1, #-(11*4)] @ r10 = in[ 5]
++ ldr r11, [r1, #-( 6*4)] @ r11 = in[10]
++ ldr r12, [r1, #-( 1*4)] @ r12 = in[15]
++ ldr lr, [r1, #-(12*4)] @ lr = in[ 4]
++ b 8f
++6: ldr r10, [r1, #-( 7*4)] @ r10 = in[ 9]
++ ldr r11, [r1, #-( 2*4)] @ r11 = in[14]
++ ldr r12, [r1, #-(13*4)] @ r12 = in[ 3]
++ ldr lr, [r1, #-( 8*4)] @ lr = in[ 8]
++ b 8f
++7: ldr r10, [r1, #-( 3*4)] @ r10 = in[13]
++ ldr r11, [r1, #-(14*4)] @ r11 = in[ 2]
++ ldr r12, [r1, #-( 9*4)] @ r12 = in[ 7]
++ ldr lr, [r1, #-( 4*4)] @ lr = in[12]
++
++8: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
++ eor r6, r3, r4 @ r6 = (b ^ c)
++ and r6, r6, r5 @ r6 = ((b ^ c) & d)
++ eor r6, r6, r4 @ r6 = (((b ^ c) & d) ^ c)
++ add r2, r2, r6 @ a = (((b ^ c) & d) ^ c) + a
++ add r2, r2, r10 @ a = (((b ^ c) & d) ^ c) + a + (in[x] + MD5MagicData[i])
++ add r2, r3, r2, ROR #(32 - 5) @ a = b + (a rotated left by 5 places)
++
++ add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i+1]
++ eor r7, r2, r3 @ r7 = (a ^ b)
++ and r7, r7, r4 @ r7 = ((a ^ b) & c)
++ eor r7, r7, r3 @ r7 = (((a ^ b) & c) ^ b)
++ add r5, r5, r7 @ d = (((a ^ b) & c) ^ b) + d
++ add r5, r5, r11 @ d = (((a ^ b) & c) ^ b) + d + (in[x] + MD5MagicData[i+1])
++ add r5, r2, r5, ROR #(32 - 9) @ d = a + (d rotated left by 9 places)
++
++ add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i+2]
++ eor r8, r5, r2 @ r8 = (d ^ a)
++ and r8, r8, r3 @ r8 = ((d ^ a) & b)
++ eor r8, r8, r2 @ r8 = (((d ^ a) & b) ^ a)
++ add r4, r4, r8 @ c = (((d ^ a) & b) ^ a) + c
++ add r4, r4, r12 @ c = (((d ^ a) & b) ^ a) + c + (in[x] + MD5MagicData[i+2])
++ add r4, r5, r4, ROR #(32 - 14) @ c = d + (c rotated left by 14 places)
++
++ add lr, lr, r9 @ lr = in[x] + MD5MagicData[i+3]
++ eor r9, r4, r5 @ r9 = (c ^ d)
++ and r9, r9, r2 @ r9 = ((c ^ d) & a)
++ eor r9, r9, r5 @ r9 = (((c ^ d) & a) ^ d)
++ add r3, r3, r9 @ b = (((c ^ d) & a) ^ d) + b
++ add r3, r3, lr @ b = (((c ^ d) & a) ^ d) + b + (in[x] + MD5MagicData[i+3])
++ add r3, r4, r3, ROR #(32 - 20) @ b = c + (b rotated left by 20 places)
++
++ ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
++ add pc, pc, r10 @ and branch to next state
++
++9: ldr r10, [r1, #-(11*4)] @ r10 = in[ 5]
++ ldr r11, [r1, #-( 8*4)] @ r11 = in[ 8]
++ ldr r12, [r1, #-( 5*4)] @ r12 = in[11]
++ ldr lr, [r1, #-( 2*4)] @ lr = in[14]
++ b 13f
++10: ldr r10, [r1, #-(15*4)] @ r10 = in[ 1]
++ ldr r11, [r1, #-(12*4)] @ r11 = in[ 4]
++ ldr r12, [r1, #-( 9*4)] @ r12 = in[ 7]
++ ldr lr, [r1, #-( 6*4)] @ lr = in[10]
++ b 13f
++11: ldr r10, [r1, #-( 3*4)] @ r10 = in[13]
++ ldr r11, [r1, #-(16*4)] @ r11 = in[ 0]
++ ldr r12, [r1, #-(13*4)] @ r12 = in[ 3]
++ ldr lr, [r1, #-(10*4)] @ lr = in[ 6]
++ b 13f
++12: ldr r10, [r1, #-( 7*4)] @ r10 = in[ 9]
++ ldr r11, [r1, #-( 4*4)] @ r11 = in[12]
++ ldr r12, [r1, #-( 1*4)] @ r12 = in[15]
++ ldr lr, [r1, #-(14*4)] @ lr = in[ 2]
++
++13: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
++ add r2, r2, r10 @ a += in[x] + MD5MagicData[i]
++ eor r6, r3, r4 @ r6 = (b ^ c)
++ eor r10, r6, r5 @ r10 = (b ^ c ^ d)
++ add r2, r2, r10 @ a += (b ^ c ^ d)
++ add r2, r3, r2, ROR #(32 - 4) @ a = b + (a rotated left by 4 places)
++
++ add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i+1]
++ eor r7, r2, r6 @ r7 = (a ^ b ^ c)
++ add r5, r5, r7 @ d = (a ^ b ^ c) + d
++ add r5, r5, r11 @ d = (a ^ b ^ c) + d + (in[x] + MD5MagicData[i+1])
++ add r5, r2, r5, ROR #(32 - 11) @ d = a + (d rotated left by 11 places)
++
++ add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i+2]
++ add r4, r4, r12 @ c += in[x] + MD5MagicData[i+2]
++ eor r8, r5, r2 @ r8 = (d ^ a)
++ eor r12, r8, r3 @ r12 = (d ^ a ^ b)
++ add r4, r4, r12 @ c += (d ^ a ^ b)
++ add r4, r5, r4, ROR #(32 - 16) @ c = d + (c rotated left by 16 places)
++
++ add lr, lr, r9 @ lr = in[x] + MD5MagicData[i+3]
++ eor r9, r4, r8 @ r9 = (c ^ d ^ a)
++ add r3, r3, r9 @ b = (c ^ d ^ a) + b
++ add r3, r3, lr @ b = (c ^ d ^ a) + b + (in[x] + MD5MagicData[i+3])
++ add r3, r4, r3, ROR #(32 - 23) @ b = c + (b rotated left by 23 places)
++
++ ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
++ add pc, pc, r10 @ and branch to next state
++
++14: ldr r10, [r1, #-(16*4)] @ r10 = in[ 0]
++ ldr r11, [r1, #-( 9*4)] @ r11 = in[ 7]
++ ldr r12, [r1, #-( 2*4)] @ r12 = in[14]
++ ldr lr, [r1, #-(11*4)] @ lr = in[ 5]
++ b 18f
++15: ldr r10, [r1, #-( 4*4)] @ r10 = in[12]
++ ldr r11, [r1, #-(13*4)] @ r11 = in[ 3]
++ ldr r12, [r1, #-( 6*4)] @ r12 = in[10]
++ ldr lr, [r1, #-(15*4)] @ lr = in[ 1]
++ b 18f
++16: ldr r10, [r1, #-( 8*4)] @ r10 = in[ 8]
++ ldr r11, [r1, #-( 1*4)] @ r11 = in[15]
++ ldr r12, [r1, #-(10*4)] @ r12 = in[ 6]
++ ldr lr, [r1, #-( 3*4)] @ lr = in[13]
++ b 18f
++17: ldr r10, [r1, #-(12*4)] @ r10 = in[ 4]
++ ldr r11, [r1, #-( 5*4)] @ r11 = in[11]
++ ldr r12, [r1, #-(14*4)] @ r12 = in[ 2]
++ ldr lr, [r1, #-( 7*4)] @ lr = in[ 9]
++
++18: add r10, r10, r6 @ r10 = in[x] + MD5MagicData[i]
++ add r2, r2, r10 @ a += in[x] + MD5MagicData[i]
++ mvn r6, r5 @ r6 = ( ~d)
++ orr r6, r6, r3 @ r6 = (b | ~d)
++ eor r6, r6, r4 @ r6 = (c ^ (b | ~d))
++ add r2, r2, r6 @ a += (c ^ (b | ~d))
++ add r2, r3, r2, ROR #(32 - 6) @ a = b + (a rotated left by 6 places)
++
++ add r11, r11, r7 @ r11 = in[x] + MD5MagicData[i]
++ add r5, r5, r11 @ d += in[x] + MD5MagicData[i]
++ mvn r7, r4 @ r7 = ( ~c)
++ orr r7, r7, r2 @ r7 = (a | ~c)
++ eor r7, r7, r3 @ r7 = (b ^ (a | ~c))
++ add r5, r5, r7 @ d += (b ^ (a | ~c))
++ add r5, r2, r5, ROR #(32 - 10) @ d = a + (d rotated left by 10 places)
++
++ add r12, r12, r8 @ r12 = in[x] + MD5MagicData[i]
++ add r4, r4, r12 @ c += in[x] + MD5MagicData[i]
++ mvn r8, r3 @ r8 = ( ~b)
++ orr r8, r8, r5 @ r8 = (d | ~b)
++ eor r8, r8, r2 @ r8 = (a ^ (d | ~b))
++ add r4, r4, r8 @ c += (a ^ (d | ~b))
++ add r4, r5, r4, ROR #(32 - 15) @ c = d + (c rotated left by 15 places)
++
++ add lr, lr, r9 @ lr = in[x] + MD5MagicData[i]
++ add r3, r3, lr @ b += in[x] + MD5MagicData[i]
++ mvn r9, r2 @ r9 = ( ~a)
++ orr r9, r9, r4 @ r9 = (c | ~a)
++ eor r9, r9, r5 @ r9 = (d ^ (c | ~a))
++ add r3, r3, r9 @ b += (d ^ (c | ~a))
++ add r3, r4, r3, ROR #(32 - 21) @ b = c + (b rotated left by 21 places)
++
++ ldmia r0!, { r6 - r10 } @ load next 4 elements from MD5MagicData
++ add pc, pc, r10 @ and branch to next state
++
++19: ldmia sp, { r0, r10 } @ fetch 'buf' and 'repeat' from the stack
++ ldmia r0, { r6 - r9 } @ r6 = buf[0], r7 = buf[1], r8 = buf[2], r9 = buf[3] (original values..)
++ subs r10, r10, #1
++ strne r10, [sp, #4]
++ add r2, r6, r2
++ add r3, r7, r3
++ add r4, r8, r4
++ add r5, r9, r5
++ stmia r0, { r2 - r5 }
++ bne 2b
++ ldmia sp!, { r0, r2, r4 - r11, pc } @ restore all callee saved registers and return
++
++
++ @ --
++ @ static void __UnalignedMD5Transform (uint32_t *buf, const uint8_t *in, int repeat);
++ @ --
++
++__UnalignedMD5Transform:
++
++ stmdb sp!, { r4 - r7, lr }
++ movs r4, r2, lsl #6 @ r4 = (repeat * 64)
++ ldmeqia sp!, { r4 - r7, pc } @ if ((repeat * 64) == 0) return;
++ mov r5, r0 @ r5 = state
++ mov r6, r1 @ r6 = in
++ sub sp, sp, #256 @ create 256 byte temp buffer
++1: cmp r4, #256
++ mov r0, sp
++ movcc r7, r4
++ movcs r7, #256 @ r7 = (blockCount * 64) = min((repeat * 64), (4 * 64))
++ mov r1, r6
++ mov r2, r7
++ bl memcpy @ memcpy (blockBuffer, in, (blockCount * 64));
++ mov r0, r5
++ mov r1, sp
++ mov r2, r7, lsr #6
++ bl __MD5Transform @ __MD5Transform (state, blockBuffer, blockCount);
++ subs r4, r4, #256 @ (repeat * 64) -= (4 * 64);
++ add r6, r6, #256 @ in += (4 * 64);
++ bgt 1b @ loop while (repeat > 0)
++ add sp, sp, #256 @ return temp buffer to stack
++ ldmia sp!, { r4 - r7, pc } @ return
++
++
++#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
++
++
+diff -urN -x .git dietlibc-0.33/arm/mmap.S dietlibc/arm/mmap.S
+--- dietlibc-0.33/arm/mmap.S 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/arm/mmap.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,3 +1,5 @@
++#include "arm-features.h"
++
+ #include <errno.h>
+ #include "syscalls.h"
+
+@@ -28,7 +30,7 @@
+ ldr r4, [sp], #4
+ ldr r5, [sp], #4
+ cmn r0, #4096
+- mov pc, lr @ return
++ RET
+
+ #else
+
+diff -urN -x .git dietlibc-0.33/arm/setjmp.S dietlibc/arm/setjmp.S
+--- dietlibc-0.33/arm/setjmp.S 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/arm/setjmp.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,17 +1,41 @@
+-.text
+-.weak setjmp
+-setjmp:
+-.global __setjmp
+-__setjmp:
++#include "arm-features.h"
++
++FUNC_START_WEAK setjmp
++FUNC_START __setjmp
+ mov r1, #0
+-.global __sigsetjmp
+-__sigsetjmp:
+-.weak sigsetjmp
+-sigsetjmp:
+-#ifndef __SOFTFP__
+- sfm f4, 4, [r0], #48
++FUNC_END __setjmp
++FUNC_END setjmp
++
++FUNC_START_WEAK sigsetjmp
++FUNC_START __sigsetjmp
++
++#ifdef DIET_HAVE_COPROC_REGS
++ /* we have to work on a copy of 'r0' (jmpbuf *) */
++ mov ip, r0
++#endif
++
++#ifndef __SOFTFP__
++# if __ARM_ARCH__ >= 7
++ vstmia ip!, {d0-d15}
++# ifdef __ARM_NEON__
++ vstmia ip!, {d16-d31}
++# endif
++# else
++ sfm f4, 4, [ip]!
++# endif
++#endif
++
++#ifdef __IWMMXT__
++# warning "setjmp will not save iwmmxt coprocessor registers"
+ #endif
++
++#ifndef DIET_HAVE_COPROC_REGS
+ stmia r0, {r4-r11, sp, lr}
+- sub r0, r0, #48
+- b __sigjmp_save
+
++#else
++ stmia ip!, {r4-r11, sp, lr}
++#endif
++
++ b __sigjmp_save
++FUNC_END __sigsetjmp
++FUNC_END sigsetjmp
+diff -urN -x .git dietlibc-0.33/arm/start.S dietlibc/arm/start.S
+--- dietlibc-0.33/arm/start.S 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/arm/start.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,23 +1,10 @@
+-
+ #include "dietfeatures.h"
+ #include "syscalls.h"
+-
+- .text
+-#ifdef __ARM_EABI__
+- .align 4
+-#else
+- .align 2
+-#endif
+-
+- .global _start
+- .weak exit
+- .global _exit
+-
++#include "arm-features.h"
+
+ #ifdef __ARM_EABI__
+
+-_start:
+-
++FUNC_START _start
+ mov fp, #0 @ clear the frame pointer
+ ldr a1, [sp] @ argc
+ add a2, sp, #4 @ argv
+@@ -25,27 +12,40 @@
+ add a3, a2, a1, lsl #2 @ &argv[argc]
+ add a3, a3, #4 @ envp
+ str a3, [ip, #0] @ environ = envp
+- bl main
+-
++
++#ifdef WANT_ELFINFO
++ mov r6, a3 @ work on a copy of a3 so that common
++ @ 'main(argc, argv, envp)' function
++ @ stays valid
++1: ldr r5, [r6], #4 @ load *envp and increment it
++ cmp r5, #0 @ read value==0?
++ bne 1b
++ str r6, [ip, #4] @ __elfinfo = envp
++#endif
++
++ bl CALL_IN_STARTCODE
++
+ @
+ @ The exit status from main() is already in r0.
+ @ We need to branch to 'exit' in case we have linked with 'atexit'.
+ @
+ bl exit
++FUNC_END _start
+
+-exit:
+-_exit:
+-
++FUNC_START _exit
++FUNC_START_WEAK exit
+ mov r7, #__NR_exit
+ swi 0 @ never returns.
+
++ .align 2
+ .L3: .word environ
+
+-
+-#else
++FUNC_END exit
++FUNC_END _exit
++
++#else
+
+-
+-_start:
++FUNC_START _start
+
+ #ifdef WANT_DYNAMIC
+ mov a4, a1 @ save dynamic ld.so _fini
+@@ -59,11 +59,25 @@
+ #ifdef __DYN_LIB
+ ldr sl, .L4
+ 1: add sl, pc, sl
+- str a3, [sl, ip] @ environ = envp
++ str a3, [ip, sl]! @ environ = envp; ip = GOT(environ)
+ #else
+ str a3, [ip, #0] @ environ = envp
+ #endif
+
++#ifdef WANT_ELFINFO
++ mov r6, a3 @ work on a copy of a3 so that common
++ @ 'main(argc, argv, envp)' function
++ @ stays valid
++1: ldr r5, [r6], #4 @ load *envp and increment it
++ cmp r5, #0 @ read value==0?
++ bne 1b
++#ifdef __DYN_LIB
++ str r6, [ip, sl] @ __elfinfo = envp
++#else
++ str r6, [ip, #4] @ __elfinfo = envp
++#endif
++#endif
++
+ #ifdef PROFILING
+ stmdb sp!, { r0 - r3 }
+ ldr r0, .L5
+@@ -83,18 +97,20 @@
+ @ We need to branch to 'exit' in case we have linked with 'atexit'.
+ @
+ bl exit
++FUNC_END _start
+
+-exit:
+-_exit:
+-
++FUNC_START _exit
++FUNC_START_WEAK exit
+ #ifdef PROFILING
+ mov r4, r0 @ save a copy of exit status
+ bl _stop_monitor
+ mov r0, r4
+ #endif
+ swi $__NR_exit @ never returns.
++FUNC_END exit
++FUNC_END _exit
+
+-
++ .align 2
+ #ifdef __DYN_LIB
+ .L3: .word environ(GOT)
+ .L4: .word _GLOBAL_OFFSET_TABLE_-(1b+8)
+diff -urN -x .git dietlibc-0.33/arm/strcpy.S dietlibc/arm/strcpy.S
+--- dietlibc-0.33/arm/strcpy.S 2005-08-05 00:29:18.000000000 +0000
++++ dietlibc/arm/strcpy.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,10 +1,7 @@
+ #include "dietfeatures.h"
++#include "arm-features.h"
+
+-.text
+- .align 2
+- .global strcpy
+-
+-strcpy:
++FUNC_START strcpy
+ #ifndef WANT_SMALL_STRING_ROUTINES
+ mov ip, r0
+ ands r2, r1, #3
+@@ -61,6 +58,5 @@
+ ldrneb r2, [r1], #1
+ #endif
+ bne .Lloop
+- mov pc, lr
+-.Lfe1:
+- .size strcpy,.Lfe1-strcpy
++ RET
++FUNC_END strcpy
+diff -urN -x .git dietlibc-0.33/arm/strlen.S dietlibc/arm/strlen.S
+--- dietlibc-0.33/arm/strlen.S 2005-08-05 00:29:18.000000000 +0000
++++ dietlibc/arm/strlen.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,12 +1,7 @@
+ #include "dietfeatures.h"
++#include "arm-features.h"
+
+- .text
+- .align 2
+-
+- .global strlen
+-
+-strlen:
+-
++FUNC_START strlen
+ #if 0
+ teq a1, #0 @ is string pointer NULL ??
+ moveq pc, lr @ if so, return 0
+@@ -61,12 +56,10 @@
+ sub a1, a1, a2
+ #endif
+
+- mov pc, lr
++ RET
+
+ #ifndef WANT_SMALL_STRING_ROUTINES
+ .Lmagic:
+ .word 0x01010101
+ #endif
+-
+-.Lstrlen:
+- .size strlen,.Lstrlen-strlen
++FUNC_END strlen
+diff -urN -x .git dietlibc-0.33/arm/syscalls.h dietlibc/arm/syscalls.h
+--- dietlibc-0.33/arm/syscalls.h 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/arm/syscalls.h 2015-01-01 12:14:43.454938895 +0000
+@@ -365,6 +365,38 @@
+ #define __NR_fallocate (__NR_SYSCALL_BASE+352)
+ #define __NR_timerfd_settime (__NR_SYSCALL_BASE+353)
+ #define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354)
++#define __NR_signalfd4 (__NR_SYSCALL_BASE+355)
++#define __NR_eventfd2 (__NR_SYSCALL_BASE+356)
++#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357)
++#define __NR_dup3 (__NR_SYSCALL_BASE+358)
++#define __NR_pipe2 (__NR_SYSCALL_BASE+359)
++#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360)
++#define __NR_preadv (__NR_SYSCALL_BASE+361)
++#define __NR_pwritev (__NR_SYSCALL_BASE+362)
++#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
++#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)
++#define __NR_recvmmsg (__NR_SYSCALL_BASE+365)
++#define __NR_accept4 (__NR_SYSCALL_BASE+366)
++#define __NR_fanotify_init (__NR_SYSCALL_BASE+367)
++#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368)
++#define __NR_prlimit64 (__NR_SYSCALL_BASE+369)
++#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370)
++#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371)
++#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372)
++#define __NR_syncfs (__NR_SYSCALL_BASE+373)
++#define __NR_sendmmsg (__NR_SYSCALL_BASE+374)
++#define __NR_setns (__NR_SYSCALL_BASE+375)
++#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376)
++#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
++#define __NR_kcmp (__NR_SYSCALL_BASE+378)
++#define __NR_finit_module (__NR_SYSCALL_BASE+379)
++#define __NR_sched_setattr (__NR_SYSCALL_BASE+380)
++#define __NR_sched_getattr (__NR_SYSCALL_BASE+381)
++#define __NR_renameat2 (__NR_SYSCALL_BASE+382)
++#define __NR_seccomp (__NR_SYSCALL_BASE+383)
++#define __NR_getrandom (__NR_SYSCALL_BASE+384)
++#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
++
+
+ /*
+ * The following SWIs are ARM private.
+@@ -700,9 +732,9 @@
+ #define __ARGS_getpeername 0
+ #define __ARGS_socketpair 0
+ #define __ARGS_send 0
+-#define __ARGS_sendto 0
++#define __ARGS_sendto 6
+ #define __ARGS_recv 0
+-#define __ARGS_recvfrom 0
++#define __ARGS_recvfrom 6
+ #define __ARGS_shutdown 0
+ #define __ARGS_setsockopt 0
+ #define __ARGS_getsockopt 0
+@@ -768,73 +800,59 @@
+ #define __ARGS_timerfd_settime 0
+ #define __ARGS_timerfd_gettime 0
+
++#define __ARGS_signalfd4 0
++#define __ARGS_eventfd2 0
++#define __ARGS_epoll_create1 0
++#define __ARGS_dup3 0
++#define __ARGS_pipe2 0
++#define __ARGS_inotify_init1 0
++#define __ARGS_preadv 0
++#define __ARGS_pwritev 0
++#define __ARGS_rt_tgsigqueueinfo 0
++#define __ARGS_perf_event_open 1
++#define __ARGS_recvmmsg 1
++#define __ARGS_accept4 0
++#define __ARGS_fanotify_init 0
++#define __ARGS_fanotify_mark 1
++#define __ARGS_prlimit64 0
++#define __ARGS_name_to_handle_at 1
++#define __ARGS_open_by_handle_at 0
++#define __ARGS_clock_adjtime 0
++#define __ARGS_syncfs 0
++#define __ARGS_sendmmsg 0
++#define __ARGS_setns 0
++#define __ARGS_process_vm_readv 1
++#define __ARGS_process_vm_writev 1
++#define __ARGS_kcmp 1
++#define __ARGS_finit_module 0
++
+
+ #ifdef __ASSEMBLER__
+
+-#ifdef __ARM_EABI__
++#include "arm-features.h"
+
+ #define syscall_weak(name,wsym,sym) __syscall_weak __NR_##name, wsym, sym, __ARGS_##name
+ .macro __syscall_weak name wsym sym typ
+-.text
+-.type \wsym,function
+-.weak \wsym
+-\wsym:
+-.type \sym,function
+-.global \sym
+-\sym:
+- stmfd sp!,{r4,r5,r7,lr}
+- ldr r4, [sp,#16]
+- ldr r5, [sp,#20]
+- ldr r7, =\name
+- swi 0
+- b __unified_syscall
++FUNC_START_WEAK \wsym
++__syscall \name, \sym, \typ
++FUNC_END \wsym
+ .endm
+
++#ifdef __ARM_EABI__
+
+ #define syscall(name,sym) __syscall __NR_##name, sym, __ARGS_##name
+ .macro __syscall name sym typ
+-.text
+-.type \sym,function
+-.global \sym
+-\sym:
+- stmfd sp!,{r4,r5,r7,lr}
+- ldr r4, [sp,#16]
+- ldr r5, [sp,#20]
+- ldr r7, =\name
+- swi 0
+- b __unified_syscall
++FUNC_START \sym
++ ldr ip, =\name
++ b __unified_syscall_swi
++FUNC_END \sym
+ .endm
+
+ #else
+
+-#define syscall_weak(name,wsym,sym) __syscall_weak $__NR_##name, wsym, sym, __ARGS_##name
+-.macro __syscall_weak name wsym sym typ
+-.text
+-.type \wsym,function
+-.weak \wsym
+-\wsym:
+-.type \sym,function
+-.global \sym
+-\sym:
+-.ifgt \typ
+- mov ip, sp
+- stmfd sp!,{r4, r5, r6}
+- ldmia ip, {r4, r5, r6}
+-.endif
+- swi \name
+-.ifgt \typ
+- b __unified_syscall4
+-.else
+- b __unified_syscall
+-.endif
+-.endm
+-
+ #define syscall(name,sym) __syscall $__NR_##name, sym, __ARGS_##name
+ .macro __syscall name sym typ
+-.text
+-.type \sym,function
+-.global \sym
+-\sym:
++FUNC_START \sym
+ .ifgt \typ
+ mov ip, sp
+ stmfd sp!,{r4, r5, r6}
+@@ -846,6 +864,7 @@
+ .else
+ b __unified_syscall
+ .endif
++FUNC_END \sym
+ .endm
+
+ #endif
+diff -urN -x .git dietlibc-0.33/arm/__testandset.S dietlibc/arm/__testandset.S
+--- dietlibc-0.33/arm/__testandset.S 2001-03-09 19:30:52.000000000 +0000
++++ dietlibc/arm/__testandset.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,7 +1,15 @@
+-.text
+-.global __testandset
+-__testandset:
++#include "arm-features.h"
++
++FUNC_START __testandset
+ mov r2, r0
+ mov r1, #1
++# if __ARM_ARCH__ < 6
+ swp r0, r1, [r2]
+- mov pc, lr
++# else
++1: ldrex r0, [r2]
++ strex r3, r1, [r2]
++ cmp r3, #0
++ bne 1b
++# endif
++ RET
++FUNC_END __testandset
+diff -urN -x .git dietlibc-0.33/arm/unified.S dietlibc/arm/unified.S
+--- dietlibc-0.33/arm/unified.S 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/arm/unified.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,22 +1,29 @@
+-
+ #include <dietfeatures.h>
+-
+- .text
+-#ifdef __ARM_EABI__
+- .align 4
+-#else
+- .align 2
+-#endif
+- .global __unified_syscall
+- .global __unified_syscall4
+-
++#include "arm-features.h"
+
+ #ifdef __ARM_EABI__
+
+-__unified_syscall4:
+-__unified_syscall:
+-
++/* expects:
++ * r0-r3 ... syscall arguments 0-3
++ * ip ... syscall number
++ */
++FUNC_START __unified_syscall_swi
++ .hidden __unified_syscall_swi
++ stmfd sp!,{r4,r5,r7,lr}
++ mov r7, ip
++ LOAD_ARG4_5
++ swi 0
++ /* fallthrough to __unified4_syscall */
++FUNC_END __unified_syscall_swi
++
++/* expects:
++ * r0 ... syscall return value
++ * original r4-r7 + lr on stack
++ */
++FUNC_START __unified_syscall
++ .hidden __unified_syscall
+ cmn r0, #4096
++#ifndef WANT_THREAD_SAFE
+ rsbcs r2, r0, #0
+ ldrcs r3, 1f
+ mvncs r0, #0
+@@ -25,17 +32,28 @@
+ .balign 4
+ 1:
+ .word errno
+-
++#else
++ bcc 1f
++ rsb r4, r0, #0
++ bl __errno_location
++ str r4, [r0]
++ mvn r0, #0
++1:
++ ldmfd sp!,{r4,r5,r7,pc}
++#endif
++FUNC_END __unified_syscall
++
+ /* here we go and "reuse" the return for weak-void functions */
+ #include "dietuglyweaks.h"
+
+- mov pc, lr @ return
++ RET
+
+-#else
+-
+-__unified_syscall4:
++#else
++
++FUNC_START __unified_syscall4
+ ldmia sp!, {r4, r5, r6}
+-__unified_syscall:
++
++FUNC_START __unified_syscall
+ cmn r0, #4096
+ movcc pc, lr @ return value comes direct from kernel.
+
+@@ -53,10 +71,13 @@
+ /* here we go and "reuse" the return for weak-void functions */
+ #include "dietuglyweaks.h"
+
+- mov pc, lr @ return
++ RET
+
+ #ifndef WANT_THREAD_SAFE
++.align 2
+ .L0: .long errno
+ #endif
++FUNC_END __unified_syscall
++FUNC_END __unified_syscall4
+
+ #endif
+diff -urN -x .git dietlibc-0.33/arm/waitpid.S dietlibc/arm/waitpid.S
+--- dietlibc-0.33/arm/waitpid.S 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/arm/waitpid.S 2015-01-01 12:14:43.454938895 +0000
+@@ -1,15 +1,8 @@
+-.text
+-#ifdef __ARM_EABI__
+-.align 4
+-#else
+-.align 2
+-#endif
+-.weak waitpid
+-.type waitpid, %function
+-waitpid:
+-.global __libc_waitpid
+-.type __libc_waitpid, %function
+-__libc_waitpid:
+- mov r3, #0
+- b wait4
+- .size waitpid, .-waitpid
++#include "arm-features.h"
++
++FUNC_START_WEAK waitpid
++FUNC_START __libc_waitpid
++ mov r3, #0
++ b wait4
++FUNC_END __libc_waitpid
++FUNC_END waitpid
+diff -urN -x .git dietlibc-0.33/CHANGES dietlibc/CHANGES
+--- dietlibc-0.33/CHANGES 2012-11-02 11:17:28.000000000 +0000
++++ dietlibc/CHANGES 2015-01-01 12:14:43.451605563 +0000
+@@ -1,3 +1,19 @@
++0.34:
++ move stpcpy from libcompat to lib as it is now part of POSIX (Enrico Scholz)
++ add linux/seccomp.h linux/prctl.h linux/audit.h linux/elf-em.h linux/filter.h
++ SECURITY: make sure all assembler files mark the stack non-executable so
++ the kernel can map the stack of the whole program as non-executable
++ support compiling with clang (no cross compiling yet, and the resulting
++ binary code is significantly larger than with gcc)
++ implement experimental C11 threads
++ fix fgets (Andreas Förster)
++ add eventfd, inotify_init1, epoll_init1, accept4, recvmmsg, sendmmsg
++ add dup3, fanotify_init, fanotify_mark, signalfd4, timerfd_settime
++ add timerfd_gettime, setns, memfd_create, getrandom, syncfs
++ add preadv, pwritev
++ add getcontext, setcontext, makecontext, swapcontext (i386 and x86_64 only for now)
++ add implementation of hsearch and friends
++
+ 0.33:
+ first stab at getting TLS to work in actual threads
+ use fs: to find current thread on x86_64
+diff -urN -x .git dietlibc-0.33/contrib/dnsd.c dietlibc/contrib/dnsd.c
+--- dietlibc-0.33/contrib/dnsd.c 2010-09-25 17:03:25.000000000 +0000
++++ dietlibc/contrib/dnsd.c 2015-01-01 12:14:43.458272230 +0000
+@@ -281,55 +281,54 @@
+ }
+
+ static void init_sockets(int* sock6,int* sock4,int port,char* v6ip,char* v4ip) {
+- int s4,s6;
++ int _s4,_s6;
+ int one=1;
+ *sock6=-1; *sock4=-1;
+- s6=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP);
+- s4=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
+- if (s4==-1 && s6==-1) {
++ _s6=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP);
++ _s4=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
++ if (_s4==-1 && _s6==-1) {
+ perror("socket");
+ return;
+ }
+- if (s6!=-1) {
+- setsockopt(s6,SOL_SOCKET,SO_REUSEADDR,&one,sizeof(one));
++ if (_s6!=-1) {
++ setsockopt(_s6,SOL_SOCKET,SO_REUSEADDR,&one,sizeof(one));
+ memset(&sa6,0,sizeof(sa6));
+ sa6.sin6_family=PF_INET6;
+ sa6.sin6_port=htons(port);
+- if (bind(s6,(struct sockaddr*)&sa6,sizeof(struct sockaddr_in6))==-1) {
++ if (bind(_s6,(struct sockaddr*)&sa6,sizeof(struct sockaddr_in6))==-1) {
+ perror("bind IPv6");
+- close(s6);
+- s6=-1;
++ close(_s6);
++ _s6=-1;
+ }
+ }
+- if (s4!=-1) {
+- setsockopt(s4,SOL_SOCKET,SO_REUSEADDR,&one,sizeof(one));
++ if (_s4!=-1) {
++ setsockopt(_s4,SOL_SOCKET,SO_REUSEADDR,&one,sizeof(one));
+ memset(&sa4,0,sizeof(sa4));
+ sa4.sin_family=PF_INET;
+ sa4.sin_port=htons(port);
+- if (bind(s4,(struct sockaddr*)&sa4,sizeof(struct sockaddr_in))==-1) {
+- if (errno!=EADDRINUSE || s6==-1)
++ if (bind(_s4,(struct sockaddr*)&sa4,sizeof(struct sockaddr_in))==-1) {
++ if (errno!=EADDRINUSE || _s6==-1)
+ perror("bind IPv4");
+- close(s4);
+- s4=-1;
++ close(_s4);
++ _s4=-1;
+ }
+ }
+- if (s4==-1 && s6==-1) return;
++ if (_s4==-1 && _s6==-1) return;
+
+ {
+ int val=255;
+- int one=1;
+- if (s6!=-1) {
++ if (_s6!=-1) {
+ struct ipv6_mreq opt;
+- setsockopt(s6,IPPROTO_IPV6,IPV6_UNICAST_HOPS,&val,sizeof(val));
+- setsockopt(s6,IPPROTO_IPV6,IPV6_MULTICAST_LOOP,&one,sizeof(one));
++ setsockopt(_s6,IPPROTO_IPV6,IPV6_UNICAST_HOPS,&val,sizeof(val));
++ setsockopt(_s6,IPPROTO_IPV6,IPV6_MULTICAST_LOOP,&one,sizeof(one));
+ memcpy(&opt.ipv6mr_multiaddr,v6ip,16);
+ opt.ipv6mr_interface=0;
+- setsockopt(s6,IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP,&opt,sizeof opt);
+- setsockopt(s6,IPPROTO_IPV6,IPV6_PKTINFO,&one,sizeof one);
++ setsockopt(_s6,IPPROTO_IPV6,IPV6_ADD_MEMBERSHIP,&opt,sizeof opt);
++ setsockopt(_s6,IPPROTO_IPV6,IPV6_PKTINFO,&one,sizeof one);
+ }
+ {
+ struct ip_mreq opt;
+- int s=(s4==-1?s6:s4);
++ int s=(_s4==-1?_s6:_s4);
+ setsockopt(s,SOL_IP,IP_TTL,&val,sizeof(val));
+ memcpy(&opt.imr_multiaddr.s_addr,v4ip,4);
+ opt.imr_interface.s_addr=0;
+@@ -338,8 +337,8 @@
+ }
+ }
+
+- *sock4=s4;
+- *sock6=s6;
++ *sock4=_s4;
++ *sock6=_s6;
+ }
+
+ int main() {
+diff -urN -x .git dietlibc-0.33/.cvsignore dietlibc/.cvsignore
+--- dietlibc-0.33/.cvsignore 2007-03-09 13:42:12.000000000 +0000
++++ dietlibc/.cvsignore 2015-01-01 12:14:43.451605563 +0000
+@@ -28,3 +28,5 @@
+ bin-x86_64
+ pic-x86_64
+ cycles
++include/errno_definition.h
++bin-x32
+diff -urN -x .git dietlibc-0.33/diet.c dietlibc/diet.c
+--- dietlibc-0.33/diet.c 2012-11-02 11:17:28.000000000 +0000
++++ dietlibc/diet.c 2015-01-01 12:14:43.461605562 +0000
+@@ -25,10 +25,11 @@
+ }
+
+ static const char* Os[] = {
+- "i386","-Os","-mpreferred-stack-boundary=2",
++ "i386","-Os","-mpreferred-stack-boundary=4",
+ "-falign-functions=1","-falign-jumps=1",
+ "-falign-loops=1","-fomit-frame-pointer",0,
+ "x86_64","-Os",0,
++ "x32","-Os",0,
+ "sparc","-Os","-mcpu=supersparc",0,
+ "sparc64","-Os","-m64","-mhard-quad-float",0,
+ "alpha","-Os","-fomit-frame-pointer",0,
+@@ -41,7 +42,6 @@
+ "s390x","-Os","-fomit-frame-pointer",0,
+ "sh","-Os","-fomit-frame-pointer",0,
+ "ia64","-Os","-fno-omit-frame-pointer",0,
+- "x86_64","-Os","-fstrict-aliasing","-momit-leaf-frame-pointer","-mfancy-math-387",0,
+ 0};
+
+ static void usage(void) {
+@@ -120,7 +120,6 @@
+ } else break;
+ } while (1);
+ {
+- int i;
+ m=0;
+ for (i=1; i<argc; ++i) {
+ if (!strcmp(argv[i],"-m32")) m=32; else
+@@ -144,6 +143,10 @@
+ memmove(shortplatform,argv[1],(size_t)(tmp2-cc));
+ platform[tmp2-cc+len]=0;
+ if (shortplatform[0]=='i' && shortplatform[2]=='8' && shortplatform[3]=='6') shortplatform[1]='3';
++ else if (strcmp(shortplatform, "powerpc") == 0)
++ strcpy(shortplatform, "ppc");
++ else if (strcmp(shortplatform, "powerpc64") == 0)
++ strcpy(shortplatform, "ppc64");
+ } else {
+ #ifdef __sparc__
+ #ifdef __arch64__
+@@ -193,15 +196,14 @@
+ shortplatform="ia64";
+ #endif
+ {
+- char *tmp=platform+strlen(platform);
+- strcpy(tmp,shortplatform);
+- shortplatform=tmp;
++ char *tmp4=platform+strlen(platform);
++ strcpy(tmp4,shortplatform);
++ shortplatform=tmp4;
+ }
+ }
+ /* MIPS needs special handling. If argv contains -EL, change
+ * platform name to mipsel */
+ if (!strcmp(shortplatform,"mips")) {
+- int i;
+ for (i=1; i<argc; ++i)
+ if (!strcmp(argv[i],"-EL"))
+ strcpy(shortplatform,"mipsel");
+@@ -328,7 +330,7 @@
+ }
+ if (mangleopts)
+ if (argv[i][0]=='-' && (argv[i][1]=='O' || argv[i][1]=='f' ||
+- (argv[i][1]=='m' && argv[i][2]!='3' && argv[i][2]!='6'))) {
++ (argv[i][1]=='m' && argv[i][2]!='3' && argv[i][2]!='6' && argv[i][2]!='x'))) {
+ if (strcmp(argv[i],"-fpic") && strcmp(argv[i],"-fno-pic"))
+ continue;
+ }
+@@ -351,7 +353,7 @@
+
+ {
+ int fd;
+- char* tmp=getenv("HOME");
++ tmp=getenv("HOME");
+ if (tmp) {
+ if (strlen(tmp)+strlen(cc)<900) {
+ strcpy(manglebuf,tmp);
+@@ -362,7 +364,6 @@
+ if ((fd=open(manglebuf,O_RDONLY))>=0) {
+ int len=read(fd,manglebuf,1023);
+ if (len>0) {
+- int i;
+ manglebuf[len]=0;
+ *dest++=manglebuf;
+ for (i=1; i<len; ++i) {
+@@ -416,7 +417,6 @@
+ #endif
+ *dest=0;
+ if (verbose) {
+- int i;
+ for (i=0; newargv[i]; i++) {
+ __write2(newargv[i]);
+ __write2(" ");
+diff -urN -x .git dietlibc-0.33/dietdirent.h dietlibc/dietdirent.h
+--- dietlibc-0.33/dietdirent.h 2002-07-03 20:33:37.000000000 +0000
++++ dietlibc/dietdirent.h 2015-01-01 12:14:43.461605562 +0000
+@@ -1,8 +1,28 @@
+ #include <sys/shm.h>
+
++#include "dietpagesize.h"
++
+ struct __dirstream {
+ int fd;
+- char buf[PAGE_SIZE-(sizeof (int)*3)];
+ unsigned int num;
+ unsigned int cur;
++ unsigned char is_64;
++ char buf[] __attribute__((__aligned__(8)));
+ }; /* stream data from opendir() */
++
++struct linux_dirent {
++ unsigned long d_ino;
++ unsigned long d_off;
++ unsigned short d_reclen;
++ char d_name[1];
++};
++
++struct linux_dirent64 {
++ uint64_t d_ino;
++ int64_t d_off;
++ unsigned short d_reclen;
++ unsigned char d_type;
++ char d_name[0];
++};
++
++#define __DIRSTREAM_BUF_SIZE (__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf))
+diff -urN -x .git dietlibc-0.33/dietelfinfo.h dietlibc/dietelfinfo.h
+--- dietlibc-0.33/dietelfinfo.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/dietelfinfo.h 2015-01-01 12:14:43.461605562 +0000
+@@ -0,0 +1,20 @@
++#include "dietfeatures.h"
++
++#ifdef WANT_ELFINFO
++#include <elf.h>
++#include <endian.h>
++#include <stdint.h>
++
++/* TODO: exported interface from <linux/elf.h> has been changed in 2.6.25 so
++ * the 'elf_addr_t' type is not available anymore. Hence, derive it from
++ * __WORDSIZE__. */
++
++#if __WORDSIZE == 64
++typedef uint64_t __diet_elf_addr_t;
++#elif __WORDSIZE == 32
++typedef uint32_t __diet_elf_addr_t;
++#endif
++
++__diet_elf_addr_t const * __get_elf_aux_value(unsigned int tag)
++ __attribute__((__visibility__("hidden"),__const__)) __pure;
++#endif
+diff -urN -x .git dietlibc-0.33/dietfeatures.h dietlibc/dietfeatures.h
+--- dietlibc-0.33/dietfeatures.h 2012-11-02 11:17:28.000000000 +0000
++++ dietlibc/dietfeatures.h 2015-01-01 12:14:43.461605562 +0000
+@@ -29,7 +29,7 @@
+ #define WANT_TLS
+
+ /* make the startcode, etc. dynamic aware ({con,de}structors) */
+-/* #define WANT_DYNAMIC */
++// #define WANT_DYNAMIC
+
+ /* GDB support in the dynamic linker */
+ #define WANT_LD_SO_GDB_SUPPORT
+@@ -142,6 +142,16 @@
+ #define WANT_SSP
+ #endif
+
++/* Some platforms like x86_64, ppc* or mips do not have a fixed PAGE_SIZE.
++ * Select WANT_DYN_PAGESIZE to detect the current PAGE_SIZE at runtime. Else,
++ * define WANT_STATIC_PAGESIZE to a proper value (must be a power of 2)
++ * matching the configured pagesize of the kernel where your binaries are
++ * running on.
++ *
++ * Selecting WANT_DYN_PAGESIZE enlarges the startup code by around 1-3
++ * instructions and might add an additional __elfinfo symbol */
++#define WANT_DYN_PAGESIZE
++/* #define WANT_STATIC_PAGESIZE 0x10000UL */
+
+
+ /* stop uncommenting here ;-) */
+@@ -161,13 +171,6 @@
+ #define WANT_SMALL_STRING_ROUTINES
+ #endif
+
+-#ifdef WANT_THREAD_SAFE
+-#ifndef __ASSEMBLER__
+-#define errno (*__errno_location())
+-#define _REENTRANT
+-#endif
+-#endif
+-
+ #ifdef __DYN_LIB
+ /* with shared libraries you MUST have a dynamic aware startcode */
+ #ifndef WANT_DYNAMIC
+@@ -179,4 +182,12 @@
+ #endif
+ #endif
+
++#if defined(__x86_64__) && defined(__ILP32__)
++#undef WANT_LARGEFILE_BACKCOMPAT
++#endif
++
++#ifdef WANT_DYN_PAGESIZE
++#define WANT_ELFINFO
++#endif
++
+ #endif
+diff -urN -x .git dietlibc-0.33/dietpagesize.h dietlibc/dietpagesize.h
+--- dietlibc-0.33/dietpagesize.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/dietpagesize.h 2015-01-01 12:14:43.461605562 +0000
+@@ -0,0 +1,31 @@
++#ifndef H_DIETLIBC_DIETPAGESIZE_H
++#define H_DIETLIBC_DIETPAGESIZE_H
++
++#include <strings.h>
++#include "dietfeatures.h"
++
++extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure;
++
++#if defined(WANT_STATIC_PAGESIZE)
++# define __DIET_PAGE_SIZE_PREDEF (WANT_STATIC_PAGESIZE)
++# define __DIET_PAGE_SHIFT_PREDEF (ffs(__DIET_PAGE_SIZE_PREDEF)-1)
++#elif defined(__alpha__) || defined(__sparc__)
++# define __DIET_PAGE_SIZE_PREDEF (8192UL)
++# define __DIET_PAGE_SHIFT_PREDEF (13)
++#elif defined(__powerpc64__)
++# define __DIET_PAGE_SIZE_PREDEF (65536UL)
++# define __DIET_PAGE_SHIFT_PREDEF (16)
++#else
++# define __DIET_PAGE_SIZE_PREDEF (4096UL)
++# define __DIET_PAGE_SHIFT_PREDEF (12)
++#endif
++
++#ifdef WANT_DYN_PAGESIZE
++# define __DIET_PAGE_SIZE (__libc_getpagesize())
++# define __DIET_PAGE_SHIFT (ffs(__DIET_PAGE_SIZE)-1)
++#else
++# define __DIET_PAGE_SIZE __DIET_PAGE_SIZE_PREDEF
++# define __DIET_PAGE_SHIFT __DIET_PAGE_SHIFT_PREDEF
++#endif
++
++#endif /* H_DIETLIBC_DIETPAGESIZE_H */
+diff -urN -x .git dietlibc-0.33/dietuglyweaks.h dietlibc/dietuglyweaks.h
+--- dietlibc-0.33/dietuglyweaks.h 2004-06-30 05:52:30.000000000 +0000
++++ dietlibc/dietuglyweaks.h 2015-01-01 12:14:43.461605562 +0000
+@@ -4,6 +4,18 @@
+ /* if you change something here ... KNOW what you're doing !
+ * it'll effect ALL platforms ! */
+
++#ifdef __clang__
++.macro DEF_G name
++.global \name
++.type \name, at function
++\name:
++.endm
++.macro DEF_W name
++.weak \name
++.type \name, at function
++\name:
++.endm
++#else
+ .macro DEF_G name
+ .global \name
+ .type \name,function
+@@ -14,6 +26,7 @@
+ .type \name,function
+ \name:
+ .endm
++#endif
+
+ DEF_W __fflush_stderr
+ DEF_W __fflush_stdin
+diff -urN -x .git dietlibc-0.33/dietunaligned.h dietlibc/dietunaligned.h
+--- dietlibc-0.33/dietunaligned.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/dietunaligned.h 2015-01-01 12:14:43.461605562 +0000
+@@ -0,0 +1,35 @@
++#ifndef H_DIETLIBC_UNALIGNED_H
++#define H_DIETLIBC_UNALIGNED_H
++
++#include <string.h>
++#include <inttypes.h>
++
++#define read_unaligned(_src) \
++ ({ \
++ struct { \
++ __typeof__(*(_src)) a; \
++ } __attribute__((__packed__)) *_tmp = (void *)(_src); \
++ _tmp->a; \
++ })
++
++#define read_unaligned_s(_src, _type, _attr) \
++ read_unaligned((__typeof__(&((_type *)(0))->_attr))( \
++ (uintptr_t)(_src) + \
++ __builtin_offsetof(_type, _attr))) \
++
++
++#define write_unaligned(_v, _dst) \
++ ({ \
++ struct { \
++ __typeof__(*(_dst)) a; \
++ } __attribute__((__packed__)) *_tmp = (void *)(_dst); \
++ _tmp->a = (_v); \
++ })
++
++#define write_unaligned_s(_v, _dst, _type, _attr) \
++ write_unaligned(_v, \
++ (__typeof__(&((_type *)(0))->_attr))( \
++ (uintptr_t)(_dst) + \
++ __builtin_offsetof(_type, _attr))) \
++
++#endif /* H_DIETLIBC_UNALIGNED_H */
+diff -urN -x .git dietlibc-0.33/dynlinker/ldso_start.S dietlibc/dynlinker/ldso_start.S
+--- dietlibc-0.33/dynlinker/ldso_start.S 2007-03-09 13:42:12.000000000 +0000
++++ dietlibc/dynlinker/ldso_start.S 2015-01-01 12:14:43.464938896 +0000
+@@ -86,6 +86,15 @@
+ .long 0
+ #endif
+
++/* __elfinfo must follow __environ immediately */
++.global __elfinfo
++__elfinfo:
++#if __WORDSIZE == 64
++ .quad 0
++#else
++ .long 0
++#endif
++
+ .global fini_entry
+ fini_entry:
+ .long 0
+diff -urN -x .git dietlibc-0.33/dyn_start.c dietlibc/dyn_start.c
+--- dietlibc-0.33/dyn_start.c 2008-05-06 17:18:34.000000000 +0000
++++ dietlibc/dyn_start.c 2015-01-01 12:14:43.464938896 +0000
+@@ -54,10 +54,6 @@
+ __deregister_frame_info(__EH_FRAME_BEGIN__);
+ }
+
+-#ifdef WANT_STACKGAP
+-int stackgap(int argc,char* argv[],char* envp[]);
+-#endif
+-
+ #ifndef __DYN_LIB_SHARED
+ /* pre main, post _start */
+ extern __attribute__((section(".init"))) void _init(void);
+@@ -65,7 +61,7 @@
+ int _dyn_start(int argc, char **argv, char **envp, structor dl_init);
+ int _dyn_start(int argc, char **argv, char **envp, structor dl_init)
+ {
+- int main(int argc, char **argv, char **envp);
++ int CALL_IN_STARTCODE(int argc, char **argv, char **envp);
+
+ #ifndef __arm__
+ /* GT: segfaults on arm, don't know why (for now) */
+@@ -82,11 +78,7 @@
+ __register_frame_info(__EH_FRAME_BEGIN__, &ob);
+ }
+
+-#ifdef WANT_STACKGAP
+- return stackgap(argc, argv, envp);
+-#else
+- return main(argc, argv, envp);
+-#endif
++ return CALL_IN_STARTCODE(argc, argv, envp);
+ }
+ #endif
+ #endif
+diff -urN -x .git dietlibc-0.33/FAQ dietlibc/FAQ
+--- dietlibc-0.33/FAQ 2010-11-09 18:38:34.000000000 +0000
++++ dietlibc/FAQ 2015-01-01 12:14:43.451605563 +0000
+@@ -246,7 +246,7 @@
+ code. Unfortunately, these options have been renamed on gcc 3. You
+ can fix this by creating a file ~/.diet/gcc containing this line:
+
+- -Os -fomit-frame-pointer -falign-jumps=1 -falign-loops=1 -mpreferred-stack-boundary=2
++ -Os -fomit-frame-pointer -falign-jumps=1 -falign-loops=1 -mpreferred-stack-boundary=4
+
+ If you get this options not for diet -Os gcc but for diet -Os
+ i386-linux-gcc, put this in ~/.diet/i386-linux-gcc instead.
+diff -urN -x .git dietlibc-0.33/findcflags.sh dietlibc/findcflags.sh
+--- dietlibc-0.33/findcflags.sh 2005-05-08 15:33:38.000000000 +0000
++++ dietlibc/findcflags.sh 2015-01-01 12:14:43.464938896 +0000
+@@ -3,6 +3,6 @@
+ case $version in
+ 2.9*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=1 -malign-jumps=1 -malign-loops=1 -mpreferred-stack-boundary=2 ;;
+ 3.0*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=1 -malign-jumps=1 -malign-loops=1 -mpreferred-stack-boundary=2 ;;
+- [34]*) echo -Os -fomit-frame-pointer -falign-functions=1 -falign-jumps=1 -falign-loops=1 -mpreferred-stack-boundary=2;;
++ [34]*) echo -Os -fomit-frame-pointer -falign-functions=1 -falign-jumps=1 -falign-loops=1 -mpreferred-stack-boundary=4;;
+ *) echo -O2 -pipe -fomit-frame-pointer ;;
+ esac
+diff -urN -x .git dietlibc-0.33/.gitignore dietlibc/.gitignore
+--- dietlibc-0.33/.gitignore 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/.gitignore 2015-01-01 12:14:43.451605563 +0000
+@@ -0,0 +1,2 @@
++/.cvsps
++/include/errno_definition.h
+diff -urN -x .git dietlibc-0.33/i386/accept4.S dietlibc/i386/accept4.S
+--- dietlibc-0.33/i386/accept4.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/i386/accept4.S 2015-01-01 12:14:43.464938896 +0000
+@@ -0,0 +1,4 @@
++#include <linuxnet.h>
++#include <syscalls.h>
++
++__socketcall(accept4,ACCEPT4)
+diff -urN -x .git dietlibc-0.33/i386/dyn_syscalls.S dietlibc/i386/dyn_syscalls.S
+--- dietlibc-0.33/i386/dyn_syscalls.S 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/i386/dyn_syscalls.S 2015-01-01 12:14:43.464938896 +0000
+@@ -191,7 +191,6 @@
+ #include "../syscalls.s/n_sigpending.S"
+ #include "../syscalls.s/n_sigprocmask.S"
+ #include "../syscalls.s/n_sigsuspend.S"
+-#include "../syscalls.s/nice.S"
+ #include "../syscalls.s/pause.S"
+ #include "../syscalls.s/personality.S"
+ #include "../syscalls.s/query_module.S"
+diff -urN -x .git dietlibc-0.33/i386/getcontext.S dietlibc/i386/getcontext.S
+--- dietlibc-0.33/i386/getcontext.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/i386/getcontext.S 2015-01-01 12:14:43.464938896 +0000
+@@ -0,0 +1,45 @@
++#include "syscalls.h"
++
++.text
++.global getcontext
++.type getcontext, at function
++/* store current CPU context into struct ucontext* */
++getcontext:
++ movl 4(%esp),%eax /* load ucontext* */
++ /* the registers are in uc_mcontext, which starts at offset 20 */
++ movw %gs,20(%eax)
++ movw %fs,24(%eax)
++ movw %es,28(%eax)
++ movw %ds,32(%eax)
++ movl %edi,36(%eax)
++ movl %esi,40(%eax)
++ movl %ebp,44(%eax)
++ /* skip esp until we stored ecx */
++ movl %ebx,52(%eax)
++ movl %edx,56(%eax)
++ movl %ecx,60(%eax)
++ lea 4(%esp),%ecx /* store esp+4 to esp */
++ mov %ecx,48(%eax)
++ movl $0,64(%eax) /* eax */
++ /* not touching trapno and err, no idea what do store there */
++ movl (%esp),%ecx
++ movl %ecx,76(%eax) /* store return value from stack into eip of struct */
++ movw %cs,80(%eax)
++ /* 84: eflags */
++ /* 88: esp_at_signal */
++ movw %ss,92(%eax)
++
++ lea 236(%eax),%ecx
++ movl %ecx,96(%eax)
++ fnstenv (%ecx)
++ fldenv (%ecx)
++ mov %ebx,%edi
++ xor %ebx,%ebx
++ xor %ecx,%ecx
++ lea 108(%eax),%edx
++ mov $__NR_sigprocmask,%eax
++ int $0x80
++ mov %edi,%ebx
++ xor %eax,%eax
++ ret
++.size getcontext, .-getcontext
+diff -urN -x .git dietlibc-0.33/i386/Makefile.add dietlibc/i386/Makefile.add
+--- dietlibc-0.33/i386/Makefile.add 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/i386/Makefile.add 2015-01-01 12:14:43.464938896 +0000
+@@ -1,7 +1,7 @@
+
+ M:=$(shell ./findcflags.sh $(CC))
+ LIBOBJ+=$(OBJDIR)/__ten.o $(OBJDIR)/md5asm.o $(OBJDIR)/__restore_rt.o \
+-$(OBJDIR)/__CAS.o
++$(OBJDIR)/__CAS.o $(OBJDIR)/getcontext.o $(OBJDIR)/setcontext.o
+ LIBMATH+=acos.o asin.o atan.o ceil.o cos.o exp.o exp10.o exp2.o expm1.o fabs.o floor.o hypot.o log.o log2.o log10.o sin.o sqrt.o copysign.o sincos.o __half.o ldexp.o ilogb.o cbrt.o log1p.o fmod.o libm2.o atan2.o tan.o
+ LIBMATH:=$(filter-out acosh.o asinh.o atanh.o cbrt.o copysign.o exp10.o exp2.o expm1.o ilogb.o log2.o,$(LIBMATH))
+ #CFLAGS+=-march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2
+diff -urN -x .git dietlibc-0.33/i386/recvmmsg.S dietlibc/i386/recvmmsg.S
+--- dietlibc-0.33/i386/recvmmsg.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/i386/recvmmsg.S 2015-01-01 12:14:43.468272228 +0000
+@@ -0,0 +1,4 @@
++#include <linuxnet.h>
++#include <syscalls.h>
++
++__socketcall(recvmmsg,RECVMMSG)
+diff -urN -x .git dietlibc-0.33/i386/sendmmsg.S dietlibc/i386/sendmmsg.S
+--- dietlibc-0.33/i386/sendmmsg.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/i386/sendmmsg.S 2015-01-01 12:14:43.468272228 +0000
+@@ -0,0 +1,4 @@
++#include <linuxnet.h>
++#include <syscalls.h>
++
++__socketcall(sendmmsg,SENDMMSG)
+diff -urN -x .git dietlibc-0.33/i386/setcontext.S dietlibc/i386/setcontext.S
+--- dietlibc-0.33/i386/setcontext.S 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/i386/setcontext.S 2015-01-01 12:14:43.468272228 +0000
+@@ -0,0 +1,48 @@
++#include "syscalls.h"
++
++.text
++.global __setcontext_trampoline
++.type __setcontext_trampoline, at function
++__setcontext_trampoline:
++ mov %ebx,4(%esp)
++ /* fall through */
++.size __setcontext_trampoline,.-__setcontext_trampoline
++
++.global setcontext
++.type setcontext, at function
++/* switch to stored CPU context from struct ucontext* */
++setcontext:
++ movl 4(%esp),%eax /* load ucontext* */
++ /* first, load the signal mask */
++ movl %ebx,%edi
++ xorl %edx,%edx
++ movl $2,%ebx /* SIG_SETMASK */
++ lea 108(%eax),%ecx
++ movl $__NR_sigprocmask,%eax
++ int $0x80
++ cmp $-4095,%eax
++ jb .Lnoerror
++ jmp __error_unified_syscall
++.Lnoerror:
++ movl 4(%esp),%eax /* load ucontext* */
++ mov %edi,%ebx
++ lea 236(%eax),%ecx
++ fldenv (%ecx)
++
++ /* the registers are in uc_mcontext, which starts at offset 20 */
++ /* do not restore gs because it's thread-specific */
++ movw 24(%eax),%fs
++ movw 28(%eax),%es
++ movw 32(%eax),%ds
++ movl 36(%eax),%edi
++ movl 40(%eax),%esi
++ movl 44(%eax),%ebp
++ movl 48(%eax),%esp
++ movw 92(%eax),%ss
++ movl 52(%eax),%ebx
++ movl 56(%eax),%edx
++ movl 60(%eax),%ecx
++
++ movl 76(%eax),%eax
++ jmp *%eax
++.size setcontext, .-setcontext
+diff -urN -x .git dietlibc-0.33/i386/start.S dietlibc/i386/start.S
+--- dietlibc-0.33/i386/start.S 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/i386/start.S 2015-01-01 12:14:43.468272228 +0000
+@@ -20,12 +20,18 @@
+ PIC_INIT /* non-PIC: this is an empty line */
+ PUT_VAR %esi, environ, %ecx /* non-PIC: movl %esi,environ */
+
+-#ifdef WANT_SYSENTER
++#if defined(WANT_ELFINFO) || defined(WANT_SYSENTER)
+ /* skip environment, scan for NULL */
+ 1:
+ lodsl
+ testl %eax,%eax
+ jnz 1b
++# ifdef WANT_ELFINFO
++ PUT_VAR %esi, __elfinfo, %ecx
++# endif
++#endif
++
++#ifdef WANT_SYSENTER
+ /* The ELF auxvec follows the environment, consists of key/value pairs.
+ We are looking for key 32, which stands for the vsyscall page */
+ 1:
+diff -urN -x .git dietlibc-0.33/i386/syscalls.h dietlibc/i386/syscalls.h
+--- dietlibc-0.33/i386/syscalls.h 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/i386/syscalls.h 2015-01-01 12:14:43.468272228 +0000
+@@ -339,6 +339,23 @@
+ #define __NR_fanotify_init 338
+ #define __NR_fanotify_mark 339
+ #define __NR_prlimit64 340
++#define __NR_name_to_handle_at 341
++#define __NR_open_by_handle_at 342
++#define __NR_clock_adjtime 343
++#define __NR_syncfs 344
++#define __NR_sendmmsg 345
++#define __NR_setns 346
++#define __NR_process_vm_readv 347
++#define __NR_process_vm_writev 348
++#define __NR_kcmp 349
++#define __NR_finit_module 350
++#define __NR_sched_setattr 351
++#define __NR_sched_getattr 352
++#define __NR_renameat2 353
++#define __NR_seccomp 354
++#define __NR_getrandom 355
++#define __NR_memfd_create 356
++
+
+ #define syscall_weak(name,wsym,sym) \
+ .text; \
+@@ -368,7 +385,6 @@
+ .Lend##sym: ; \
+ .size sym,.Lend##sym-sym
+
+-#ifndef __PIC__
+ #define __socketcall(name,NAME) \
+ .text; \
+ .type name, at function; \
+@@ -381,6 +397,3 @@
+ jmp socketcall; \
+ .Lend##name:; \
+ .size name,.Lend##name-name
+-#else
+-#define __socketcall(name,NAME)
+-#endif
+diff -urN -x .git dietlibc-0.33/ia64/clone.S dietlibc/ia64/clone.S
+--- dietlibc-0.33/ia64/clone.S 2006-06-23 17:29:33.000000000 +0000
++++ dietlibc/ia64/clone.S 2015-01-01 12:14:43.468272228 +0000
+@@ -1,4 +1,4 @@
+-/* This is untested code which probably won�t work out of the box! */
++/* This is untested code which probably won't work out of the box! */
+
+ #include "syscalls.h"
+ #include <errno.h>
+@@ -43,4 +43,5 @@
+ br.call.dptk.few b0=__error_unified_syscall
+ br.ret.sptk.few b0
+ .endp __clone
++.endp __clone2
+ .size __clone, . - __clone
+diff -urN -x .git dietlibc-0.33/ia64/Makefile.add dietlibc/ia64/Makefile.add
+--- dietlibc-0.33/ia64/Makefile.add 2012-01-24 18:24:24.000000000 +0000
++++ dietlibc/ia64/Makefile.add 2015-01-01 12:14:43.468272228 +0000
+@@ -1,2 +1,2 @@
+ VPATH:=ia64:syscalls.s:$(VPATH)
+-LIBOBJ+=$(OBJDIR)/__time.o $(OBJDIR)/__waitpid.o $(OBJDIR)/__nice.o $(OBJDIR)/__alarm.o $(OBJDIR)/__CAS.o
++LIBOBJ+=$(OBJDIR)/__time.o $(OBJDIR)/__waitpid.o $(OBJDIR)/__alarm.o $(OBJDIR)/__CAS.o $(OBJDIR)/__pause.o
+diff -urN -x .git dietlibc-0.33/ia64/__pause.c dietlibc/ia64/__pause.c
+--- dietlibc-0.33/ia64/__pause.c 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/ia64/__pause.c 2015-01-01 12:14:43.468272228 +0000
+@@ -0,0 +1,10 @@
++#include <unistd.h>
++#include <signal.h>
++
++int pause(void)
++{
++ sigset_t set;
++ sigemptyset(&set);
++ sigprocmask(SIG_BLOCK, NULL, &set);
++ return sigsuspend(&set);
++}
+diff -urN -x .git dietlibc-0.33/ia64/start.S dietlibc/ia64/start.S
+--- dietlibc-0.33/ia64/start.S 2006-05-29 16:30:53.000000000 +0000
++++ dietlibc/ia64/start.S 2015-01-01 12:14:43.468272228 +0000
+@@ -40,6 +40,16 @@
+ ;;
+ st8 [r14] = out2 /* store envp in environ */
+
++#ifdef WANT_ELFINFO
++# warning "MAKE ME IE64 CODE!"
++1: ld8 r9 = [out2], 8 /* load *envp and increment it */
++ orr r9 = r9, r9 /* test for NULL */
++ bne 1b
++
++ adds r14 = 8, r14 /* __elfinfo = environ + 8 */
++ st8 [r14] = out2 /* store envp in __elfinfo */
++#endif
++
+ #ifdef WANT_DYNAMIC
+ /* FIXME: dl_init parameter ??? */
+ br.call.sptk.few rp = _dyn_start
+diff -urN -x .git dietlibc-0.33/ia64/syscalls.h dietlibc/ia64/syscalls.h
+--- dietlibc-0.33/ia64/syscalls.h 2008-12-10 20:00:58.000000000 +0000
++++ dietlibc/ia64/syscalls.h 2015-01-01 12:14:43.468272228 +0000
+@@ -289,6 +289,34 @@
+ #define __NR_timerfd_create 1310
+ #define __NR_timerfd_settime 1311
+ #define __NR_timerfd_gettime 1312
++#define __NR_signalfd4 1313
++#define __NR_eventfd2 1314
++#define __NR_epoll_create1 1315
++#define __NR_dup3 1316
++#define __NR_pipe2 1317
++#define __NR_inotify_init1 1318
++#define __NR_preadv 1319
++#define __NR_pwritev 1320
++#define __NR_rt_tgsigqueueinfo 1321
++#define __NR_recvmmsg 1322
++#define __NR_fanotify_init 1323
++#define __NR_fanotify_mark 1324
++#define __NR_prlimit64 1325
++#define __NR_name_to_handle_at 1326
++#define __NR_open_by_handle_at 1327
++#define __NR_clock_adjtime 1328
++#define __NR_syncfs 1329
++#define __NR_setns 1330
++#define __NR_sendmmsg 1331
++#define __NR_process_vm_readv 1332
++#define __NR_process_vm_writev 1333
++#define __NR_accept4 1334
++#define __NR_finit_module 1335
++#define __NR_sched_setattr 1336
++#define __NR_sched_getattr 1337
++#define __NR_renameat2 1338
++#define __NR_getrandom 1339
++#define __NR_memfd_create 1340
+
+ #define syscall(name, sym) \
+ .text; \
+diff -urN -x .git dietlibc-0.33/ia64/unified.S dietlibc/ia64/unified.S
+--- dietlibc-0.33/ia64/unified.S 2006-06-23 17:29:33.000000000 +0000
++++ dietlibc/ia64/unified.S 2015-01-01 12:14:43.468272228 +0000
+@@ -16,9 +16,7 @@
+ .text
+
+ .globl __unified_syscall
+-.proc __unified_syscall
+ .globl __error_unified_syscall
+-.proc __error_unified_syscall
+ .globl _exit
+ .proc _exit
+
+@@ -27,11 +25,16 @@
+ .endp _exit
+ .size _exit, . - _exit
+
++.proc __unified_syscall
+ __unified_syscall:
+ break.i 0x100000
+ movl r2=errno
+ cmp.eq p6,p0=-1,r10
+ ;;
++.endp __unified_syscall
++.size __unified_syscall, . - __unified_syscall
++
++.proc __error_unified_syscall
+ __error_unified_syscall:
+ (p6) st4 [r2]=r8
+ (p6) mov r8=-1
+@@ -39,6 +42,6 @@
+ #include "dietuglyweaks.h"
+
+ br.ret.sptk.few rp
++.endp __error_unified_syscall
+
+-.size __unified_syscall, __error_unified_syscall - __unified_syscall
+ .size __error_unified_syscall, . - __error_unified_syscall
+diff -urN -x .git dietlibc-0.33/include/asm/posix_types.h dietlibc/include/asm/posix_types.h
+--- dietlibc-0.33/include/asm/posix_types.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/include/asm/posix_types.h 2015-01-01 12:14:43.471605562 +0000
+@@ -0,0 +1,7 @@
++#ifndef _ASM_POSIX_TYPES_H
++#define _ASM_POSIX_TYPES_H
++
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
++
++#endif
+diff -urN -x .git dietlibc-0.33/include/asm/prctl.h dietlibc/include/asm/prctl.h
+--- dietlibc-0.33/include/asm/prctl.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/include/asm/prctl.h 2015-01-01 12:14:43.471605562 +0000
+@@ -0,0 +1,18 @@
++#ifndef _ASM_PRCTL_H
++#define _ASM_PRCTL_H
++
++#if defined(__x86_64__)
++
++#define ARCH_SET_GS 0x1001
++#define ARCH_SET_FS 0x1002
++#define ARCH_GET_FS 0x1003
++#define ARCH_GET_GS 0x1004
++
++#elif defined(__i386__)
++
++#else
++
++#warning "need asm/prctl.h for this platform"
++#endif
++
++#endif
+diff -urN -x .git dietlibc-0.33/include/dirent.h dietlibc/include/dirent.h
+--- dietlibc-0.33/include/dirent.h 2012-11-02 11:17:28.000000000 +0000
++++ dietlibc/include/dirent.h 2015-01-01 12:14:43.471605562 +0000
+@@ -42,8 +42,8 @@
+ #endif
+ struct dirent64 *readdir64 (DIR *__dirp) __THROW;
+ void rewinddir (DIR *__dirp) __THROW;
+-void seekdir (DIR *__dirp, long int __pos) __THROW;
+-long int telldir (DIR *__dirp) __THROW;
++void seekdir (DIR *__dirp, long __pos) __THROW;
++long telldir (DIR *__dirp) __THROW;
+
+ int scandir(const char *dir, struct dirent ***namelist,
+ int (*selection)(const struct dirent *),
+diff -urN -x .git dietlibc-0.33/include/dlfcn.h dietlibc/include/dlfcn.h
+--- dietlibc-0.33/include/dlfcn.h 2005-01-31 12:53:33.000000000 +0000
++++ dietlibc/include/dlfcn.h 2015-01-01 12:14:43.471605562 +0000
+@@ -14,10 +14,10 @@
+
+ __BEGIN_DECLS
+
+-void *dlopen (const char *filename, int flag);
+-const char *dlerror(void);
+-void *dlsym(void *handle, const char *symbol);
+-int dlclose (void *handle);
++void *dlopen (const char *filename, int flag) __THROWNL;
++const char *dlerror(void) __THROW;
++void *dlsym(void *handle, const char *symbol) __THROW;
++int dlclose (void *handle) __THROWNL;
+
+ #ifdef _GNU_SOURCE
+ typedef struct
+diff -urN -x .git dietlibc-0.33/include/elf.h dietlibc/include/elf.h
+--- dietlibc-0.33/include/elf.h 2010-09-25 17:03:25.000000000 +0000
++++ dietlibc/include/elf.h 2015-01-01 12:14:43.471605562 +0000
+@@ -954,6 +954,15 @@
+
+ #define AT_SECURE 23 /* Boolean, was exec setuid-like? */
+
++#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/
++
++#define AT_RANDOM 25 /* Address of 16 random bytes. */
++
++#define AT_HWCAP2 26 /* More machine-dependent hints about
++ processor capabilities. */
++
++#define AT_EXECFN 31 /* Filename of executable. */
++
+ /* Pointer to the global system page used for system calls and other
+ nice things. */
+ #define AT_SYSINFO 32
+diff -urN -x .git dietlibc-0.33/include/endian.h dietlibc/include/endian.h
+--- dietlibc-0.33/include/endian.h 2006-05-29 16:30:53.000000000 +0000
++++ dietlibc/include/endian.h 2015-01-01 12:14:43.471605562 +0000
+@@ -39,10 +39,18 @@
+ # define __LONG_LONG_PAIR(HI, LO) HI, LO
+ #endif
+
+-#if defined(__alpha__) || defined(__mips64__) || defined(__sparc_v9__) || defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__)
++#if defined(__alpha__) || defined(__mips64__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__)
+ #define __WORDSIZE 64
+ #endif
+
++#if defined(__x86_64__)
++#if defined(__ILP32__)
++#define __OFF_T_MATCHES_OFF64_T
++#else
++#define __WORDSIZE 64
++#endif
++#endif
++
+ #if defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc_v9__)
+ #define __WORDSIZE_COMPAT32 1
+ #endif
+@@ -51,7 +59,9 @@
+ #define __WORDSIZE 64
+ #endif
+
+-#ifndef __WORDSIZE
++#ifdef __WORDSIZE
++#define __OFF_T_MATCHES_OFF64_T
++#else
+ #define __WORDSIZE 32
+ #endif
+
+diff -urN -x .git dietlibc-0.33/include/errno.h dietlibc/include/errno.h
+--- dietlibc-0.33/include/errno.h 2010-09-25 17:03:26.000000000 +0000
++++ dietlibc/include/errno.h 2015-01-01 12:14:43.471605562 +0000
+@@ -704,11 +704,7 @@
+
+ __BEGIN_DECLS
+
+-#ifndef _REENTRANT
+-extern int errno;
+-#else
+-#define errno (*__errno_location())
+-#endif
++#include <errno_definition.h>
+
+ extern int *__errno_location(void);
+
+diff -urN -x .git dietlibc-0.33/include/fcntl.h dietlibc/include/fcntl.h
+--- dietlibc-0.33/include/fcntl.h 2012-11-02 11:17:28.000000000 +0000
++++ dietlibc/include/fcntl.h 2015-01-01 12:14:43.471605562 +0000
+@@ -14,8 +14,6 @@
+
+ #if defined(__i386__) || defined(__s390__) || defined(__x86_64__) || defined(__ia64__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_ACCMODE 0003
+ #define O_RDONLY 00
+ #define O_WRONLY 01
+@@ -27,13 +25,17 @@
+ #define O_APPEND 02000
+ #define O_NONBLOCK 04000
+ #define O_NDELAY O_NONBLOCK
+-#define O_SYNC 010000
++#define O_DSYNC 010000
+ #define FASYNC 020000 /* fcntl, for BSD compatibility */
+ #define O_DIRECT 040000 /* direct disk access hint - currently ignored */
+ #define O_LARGEFILE 0100000
+ #define O_DIRECTORY 0200000 /* must be a directory */
+ #define O_NOFOLLOW 0400000 /* don't follow links */
+ #define O_NOATIME 01000000
++#define O_CLOEXEC 02000000
++#define O_SYNC (O_DSYNC|04000000)
++#define O_PATH 010000000
++#define O_TMPFILE 020000000
+
+ #define F_DUPFD 0 /* dup */
+ #define F_GETFD 1 /* get close_on_exec */
+@@ -96,8 +98,6 @@
+
+ #elif defined(__alpha__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_ACCMODE 0003
+ #define O_RDONLY 00
+ #define O_WRONLY 01
+@@ -110,13 +110,17 @@
+ #define O_NONBLOCK 00004
+ #define O_APPEND 00010
+ #define O_NDELAY O_NONBLOCK
+-#define O_SYNC 040000
++#define O_DSYNC 040000
+ #define FASYNC 020000 /* fcntl, for BSD compatibility */
+ #define O_DIRECTORY 0100000 /* must be a directory */
+ #define O_NOFOLLOW 0200000 /* don't follow links */
+ #define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
+ #define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
+ #define O_NOATIME 04000000
++#define O_CLOEXEC 010000000
++#define O_SYNC (020000000|O_DSYNC)
++#define O_PATH 040000000
++#define O_TMPFILE 0100000000
+
+ #define F_DUPFD 0 /* dup */
+ #define F_GETFD 1 /* get close_on_exec */
+@@ -167,14 +171,12 @@
+
+ #elif defined(__mips__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_ACCMODE 0x0003
+ #define O_RDONLY 0x0000
+ #define O_WRONLY 0x0001
+ #define O_RDWR 0x0002
+ #define O_APPEND 0x0008
+-#define O_SYNC 0x0010
++#define O_DSYNC 0x0010
+ #define O_NONBLOCK 0x0080
+ #define O_CREAT 0x0100 /* not fcntl */
+ #define O_TRUNC 0x0200 /* not fcntl */
+@@ -182,10 +184,14 @@
+ #define O_NOCTTY 0x0800 /* not fcntl */
+ #define FASYNC 0x1000 /* fcntl, for BSD compatibility */
+ #define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */
++#define O_SYNC (0x4000|O_DSYNC)
+ #define O_DIRECT 0x8000 /* direct disk access hint - currently ignored */
+ #define O_DIRECTORY 0x10000 /* must be a directory */
+ #define O_NOFOLLOW 0x20000 /* don't follow links */
+ #define O_NOATIME 0x40000
++#define O_CLOEXEC 0x80000
++#define O_PATH 040000000
++#define O_TMPFILE 0100000000
+
+ #define O_NDELAY O_NONBLOCK
+
+@@ -266,8 +272,6 @@
+
+ #elif defined(__sparc__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_RDONLY 0x0000
+ #define O_WRONLY 0x0001
+ #define O_RDWR 0x0002
+@@ -277,7 +281,7 @@
+ #define O_CREAT 0x0200 /* not fcntl */
+ #define O_TRUNC 0x0400 /* not fcntl */
+ #define O_EXCL 0x0800 /* not fcntl */
+-#define O_SYNC 0x2000
++#define O_DSYNC 0x2000
+ #define O_NONBLOCK 0x4000
+ #define O_NDELAY (0x0004 | O_NONBLOCK)
+ #define O_NOCTTY 0x8000 /* not fcntl */
+@@ -286,6 +290,10 @@
+ #define O_LARGEFILE 0x40000
+ #define O_DIRECT 0x100000 /* direct disk access hint */
+ #define O_NOATIME 0x200000
++#define O_CLOEXEC 0x400000
++#define O_SYNC (0x800000|O_DSYNC)
++#define O_PATH 0x1000000
++#define O_TMPFILE 0x2000000
+
+ #define F_DUPFD 0 /* dup */
+ #define F_GETFD 1 /* get close_on_exec */
+@@ -355,8 +363,6 @@
+
+ #elif defined(__powerpc__) || defined(__powerpc64__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_ACCMODE 0003
+ #define O_RDONLY 00
+ #define O_WRONLY 01
+@@ -368,13 +374,17 @@
+ #define O_APPEND 02000
+ #define O_NONBLOCK 04000
+ #define O_NDELAY O_NONBLOCK
+-#define O_SYNC 010000
++#define O_DSYNC 010000
+ #define FASYNC 020000 /* fcntl, for BSD compatibility */
+ #define O_DIRECTORY 040000 /* must be a directory */
+ #define O_NOFOLLOW 0100000 /* don't follow links */
+ #define O_LARGEFILE 0200000
+ #define O_DIRECT 0400000 /* direct disk access hint - currently ignored */
+ #define O_NOATIME 01000000
++#define O_CLOEXEC 02000000
++#define O_SYNC (O_DSYNC|04000000)
++#define O_PATH 010000000
++#define O_TMPFILE 020000000
+
+ #define F_DUPFD 0 /* dup */
+ #define F_GETFD 1 /* get close_on_exec */
+@@ -439,8 +449,6 @@
+
+ #elif defined (__arm__)
+
+-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+- located on an ext2 file system */
+ #define O_ACCMODE 0003
+ #define O_RDONLY 00
+ #define O_WRONLY 01
+@@ -452,13 +460,17 @@
+ #define O_APPEND 02000
+ #define O_NONBLOCK 04000
+ #define O_NDELAY O_NONBLOCK
+-#define O_SYNC 010000
++#define O_DSYNC 010000
+ #define FASYNC 020000 /* fcntl, for BSD compatibility */
+ #define O_DIRECTORY 040000 /* must be a directory */
+ #define O_NOFOLLOW 0100000 /* don't follow links */
+ #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
+ #define O_LARGEFILE 0400000
+ #define O_NOATIME 01000000
++#define O_CLOEXEC 02000000
++#define O_SYNC (O_DSYNC|04000000)
++#define O_PATH 010000000
++#define O_TMPFILE 020000000
+
+ #define F_DUPFD 0 /* dup */
+ #define F_GETFD 1 /* get close_on_exec */
+@@ -536,19 +548,24 @@
+ #define O_EXCL 00002000 /* not fcntl */
+ #define O_LARGEFILE 00004000
+ #define O_ASYNC 00020000
+-#define O_SYNC 00100000
++#define __O_SYNC 00100000
+ #define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */
+ #define O_NDELAY O_NONBLOCK
+ #define O_NOCTTY 00400000 /* not fcntl */
+ #define O_DSYNC 01000000 /* HPUX only */
+ #define O_RSYNC 02000000 /* HPUX only */
+ #define O_NOATIME 04000000
++#define O_CLOEXEC 010000000
+ #define O_DIRECTORY 00010000
+
+ #define O_DIRECT 00040000 /* direct disk access hint - currently ignored */
+ #define O_NOFOLLOW 00000200 /* don't follow links */
+ #define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */
+
++#define O_PATH 020000000
++#define O_TMPFILE 040000000
++#define O_SYNC (__O_SYNC|O_DSYNC)
++
+ #define F_DUPFD 0 /* Duplicate file descriptor. */
+ #define F_GETFD 1 /* Get file descriptor flags. */
+ #define F_SETFD 2 /* Set file descriptor flags. */
+@@ -611,11 +628,55 @@
+
+ #endif
+
++#ifdef _GNU_SOURCE
++
++#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
++#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
++
++/*
++ * Cancel a blocking posix lock; internal use only until we expose an
++ * asynchronous lock api to userspace:
++ */
++#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
++
++/* Create a file descriptor with FD_CLOEXEC set. */
++#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
++
++/*
++ * Request nofications on a directory.
++ * See below for events that may be notified.
++ */
++#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
++
++/*
++ * Set and get of pipe page size array
++ */
++#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
++#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
++
++/*
++ * Set/Get seals
++ */
++#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
++#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
++
++/*
++ * Types of seals
++ */
++#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
++#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
++#define F_SEAL_GROW 0x0004 /* prevent file from growing */
++#define F_SEAL_WRITE 0x0008 /* prevent writes */
++/* (1U << 31) is reserved for signed error codes */
++#endif
++
+ extern int fcntl (int __fd, int __cmd, ...) __THROW;
+ #ifndef __NO_STAT64
+ extern int fcntl64 (int __fd, int __cmd, ...) __THROW;
++extern int fstatat64(int dirfd, const char *pathname, struct stat *buf, int flags) __THROW;
+ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+ #define fcntl fcntl64
++#define fstatat fstatat64
+ #endif
+ #endif
+
+@@ -628,37 +689,73 @@
+ #endif
+
+ #ifdef _GNU_SOURCE
+-#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
+-#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
+- /* we may still block on the fd we splice */
+- /* from/to, of course */
+-#define SPLICE_F_MORE (0x04) /* expect more data */
+-#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
++enum {
++ SPLICE_F_MOVE=1, /* move pages instead of copying */
++#define SPLICE_F_MOVE SPLICE_F_MOVE
++ SPLICE_F_NONBLOCK=2, /* don't block on splicing (may still block on fd we splice */
++#define SPLICE_F_NONBLOCK SPLICE_F_NONBLOCK
++ SPLICE_F_MORE=4, /* expect more data */
++#define SPLICE_F_MORE SPLICE_F_MORE
++ SPLICE_F_GIFT=8 /* pages passed in are a gift */
++#define SPLICE_F_GIFT SPLICE_F_GIFT
++};
+
+-long tee(int fd_in, int fd_out, size_t len, unsigned int flags) __THROW;
++ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags) __THROW;
+
+ #include <sys/uio.h>
+
+-long vmsplice(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags) __THROW;
+-long splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags) __THROW;
++ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags) __THROW;
++ssize_t vmsplice(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags) __THROW;
+
+ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags) __THROW;
+
+ #define FALLOC_FL_KEEP_SIZE 1
+
+ int fallocate(int fd, int mode, loff_t offset, loff_t len) __THROW;
++
++/*
++ * Types of directory notifications that may be requested.
++ */
++#define DN_ACCESS 0x00000001 /* File accessed */
++#define DN_MODIFY 0x00000002 /* File modified */
++#define DN_CREATE 0x00000004 /* File created */
++#define DN_DELETE 0x00000008 /* File removed */
++#define DN_RENAME 0x00000010 /* File renamed */
++#define DN_ATTRIB 0x00000020 /* File changed attibutes */
++#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
++
+ #endif
+
+-#if defined(_ATFILE_SOURCE) || ((_XOPEN_SOURCE + 0) >= 700) || ((_POSIX_C_SOURCE + 0) >= 200809L)
++#define F_SETOWN_EX 15
++#define F_GETOWN_EX 16
++#define F_GETOWNER_UIDS 17
++
++#define F_OFD_GETLK 36
++#define F_OFD_SETLK 37
++#define F_OFD_SETLKW 38
++
++#define F_OWNER_TID 0
++#define F_OWNER_PID 1
++#define F_OWNER_PGRP 2
++
++struct f_owner_ex {
++ int type;
++ int pid;
++};
++
+ #define AT_FDCWD -100 /* Special value used to indicate openat should use the current working directory. */
+ #define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
+ #define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */
+ #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
++#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
++#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
++
++/* for faccessat */
++#define AT_EACCESS 0x200 /* using euid, not uid for accessat */
+
+ int openat(int dirfd, const char *pathname, int flags, ...) __THROW;
+ int futimesat(int dirfd, const char *pathname, const struct timeval times[2]) __THROW;
+ int unlinkat(int dirfd, const char *pathname, int flags) __THROW;
+-#endif
+
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) >= 600
+ #include "linux/fadvise.h"
+diff -urN -x .git dietlibc-0.33/include/inttypes.h dietlibc/include/inttypes.h
+--- dietlibc-0.33/include/inttypes.h 2012-01-24 18:24:25.000000000 +0000
++++ dietlibc/include/inttypes.h 2015-01-01 12:14:43.471605562 +0000
+@@ -258,8 +258,8 @@
+ #if __WORDSIZE == 64
+ typedef signed long int64_t;
+ typedef unsigned long uint64_t;
+-typedef signed long int intmax_t;
+-typedef unsigned long int uintmax_t;
++typedef signed long intmax_t;
++typedef unsigned long uintmax_t;
+ #else
+ __extension__ typedef signed long long int64_t;
+ __extension__ typedef unsigned long long uint64_t;
+diff -urN -x .git dietlibc-0.33/include/linux/audit.h dietlibc/include/linux/audit.h
+--- dietlibc-0.33/include/linux/audit.h 1970-01-01 00:00:00.000000000 +0000
++++ dietlibc/include/linux/audit.h 2015-01-01 12:14:43.471605562 +0000
+@@ -0,0 +1,432 @@
++/* audit.h -- Auditing support
++ *
++ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
++ * All Rights Reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Written by Rickard E. (Rik) Faith <faith at redhat.com>
++ *
++ */
++
++#ifndef _UAPI_LINUX_AUDIT_H_
++#define _UAPI_LINUX_AUDIT_H_
++
++#include <inttypes.h>
++
++#include <linux/elf-em.h>
++
++/* The netlink messages for the audit system is divided into blocks:
++ * 1000 - 1099 are for commanding the audit system
++ * 1100 - 1199 user space trusted application messages
++ * 1200 - 1299 messages internal to the audit daemon
++ * 1300 - 1399 audit event messages
++ * 1400 - 1499 SE Linux use
++ * 1500 - 1599 kernel LSPP events
++ * 1600 - 1699 kernel crypto events
++ * 1700 - 1799 kernel anomaly records
++ * 1800 - 1899 kernel integrity events
++ * 1900 - 1999 future kernel use
++ * 2000 is for otherwise unclassified kernel audit messages (legacy)
++ * 2001 - 2099 unused (kernel)
++ * 2100 - 2199 user space anomaly records
++ * 2200 - 2299 user space actions taken in response to anomalies
++ * 2300 - 2399 user space generated LSPP events
++ * 2400 - 2499 user space crypto events
++ * 2500 - 2999 future user space (maybe integrity labels and related events)
++ *
++ * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
++ * exclusively user space. 1300-2099 is kernel --> user space
++ * communication.
++ */
++#define AUDIT_GET 1000 /* Get status */
++#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
++#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
++#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
++#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
++#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
++#define AUDIT_LOGIN 1006 /* Define the login id and information */
++#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
++#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
++#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
++#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
++#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
++#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
++#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
++#define AUDIT_TRIM 1014 /* Trim junk from watched tree */
++#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */
++#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
++#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
++#define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */
++#define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */
++#define AUDIT_FEATURE_CHANGE 1020 /* audit log listing feature changes */
++
++#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
++#define AUDIT_USER_AVC 1107 /* We filter this differently */
++#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */
++#define AUDIT_LAST_USER_MSG 1199
++#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
++#define AUDIT_LAST_USER_MSG2 2999
++
++#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
++#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
++#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */
++#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
++
++#define AUDIT_SYSCALL 1300 /* Syscall event */
++/* #define AUDIT_FS_WATCH 1301 * Deprecated */
++#define AUDIT_PATH 1302 /* Filename path information */
++#define AUDIT_IPC 1303 /* IPC record */
++#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
++#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
++#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
++#define AUDIT_CWD 1307 /* Current working directory */
++#define AUDIT_EXECVE 1309 /* execve arguments */
++#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */
++#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */
++#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
++#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
++#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
++#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
++#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
++#define AUDIT_OBJ_PID 1318 /* ptrace target */
++#define AUDIT_TTY 1319 /* Input on an administrative TTY */
++#define AUDIT_EOE 1320 /* End of multi-record event */
++#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
++#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
++#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
++#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
++#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
++#define AUDIT_SECCOMP 1326 /* Secure Computing event */
++
++#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
++#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
++#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
++#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
++#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
++#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
++#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
++#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
++#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
++#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
++#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
++#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */
++#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */
++#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
++#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
++#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
++#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
++#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
++
++#define AUDIT_FIRST_KERN_ANOM_MSG 1700
++#define AUDIT_LAST_KERN_ANOM_MSG 1799
++#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
++#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
++#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */
++#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
++#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
++#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
++#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */
++#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */
++#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */
++
++#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
++
++/* Rule flags */
++#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */
++#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */
++#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
++#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
++#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
++#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
++
++#define AUDIT_NR_FILTERS 6
++
++#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
++
++/* Rule actions */
++#define AUDIT_NEVER 0 /* Do not build context if rule matches */
++#define AUDIT_POSSIBLE 1 /* Build context if rule matches */
++#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */
++
++/* Rule structure sizes -- if these change, different AUDIT_ADD and
++ * AUDIT_LIST commands must be implemented. */
++#define AUDIT_MAX_FIELDS 64
++#define AUDIT_MAX_KEY_LEN 256
++#define AUDIT_BITMASK_SIZE 64
++#define AUDIT_WORD(nr) ((uint32_t)((nr)/32))
++#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
++
++#define AUDIT_SYSCALL_CLASSES 16
++#define AUDIT_CLASS_DIR_WRITE 0
++#define AUDIT_CLASS_DIR_WRITE_32 1
++#define AUDIT_CLASS_CHATTR 2
++#define AUDIT_CLASS_CHATTR_32 3
++#define AUDIT_CLASS_READ 4
++#define AUDIT_CLASS_READ_32 5
++#define AUDIT_CLASS_WRITE 6
++#define AUDIT_CLASS_WRITE_32 7
++#define AUDIT_CLASS_SIGNAL 8
++#define AUDIT_CLASS_SIGNAL_32 9
++
++/* This bitmask is used to validate user input. It represents all bits that
++ * are currently used in an audit field constant understood by the kernel.
++ * If you are adding a new #define AUDIT_<whatever>, please ensure that
++ * AUDIT_UNUSED_BITS is updated if need be. */
++#define AUDIT_UNUSED_BITS 0x07FFFC00
++
++/* AUDIT_FIELD_COMPARE rule list */
++#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
++#define AUDIT_COMPARE_GID_TO_OBJ_GID 2
++#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3
++#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4
++#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5
++#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6
++#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7
++#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8
++#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9
++
++#define AUDIT_COMPARE_UID_TO_AUID 10
++#define AUDIT_COMPARE_UID_TO_EUID 11
++#define AUDIT_COMPARE_UID_TO_FSUID 12
++#define AUDIT_COMPARE_UID_TO_SUID 13
++
++#define AUDIT_COMPARE_AUID_TO_FSUID 14
++#define AUDIT_COMPARE_AUID_TO_SUID 15
++#define AUDIT_COMPARE_AUID_TO_EUID 16
++
++#define AUDIT_COMPARE_EUID_TO_SUID 17
++#define AUDIT_COMPARE_EUID_TO_FSUID 18
++
++#define AUDIT_COMPARE_SUID_TO_FSUID 19
++
++#define AUDIT_COMPARE_GID_TO_EGID 20
++#define AUDIT_COMPARE_GID_TO_FSGID 21
++#define AUDIT_COMPARE_GID_TO_SGID 22
++
++#define AUDIT_COMPARE_EGID_TO_FSGID 23
++#define AUDIT_COMPARE_EGID_TO_SGID 24
++#define AUDIT_COMPARE_SGID_TO_FSGID 25
++
++#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID
++
++/* Rule fields */
++ /* These are useful when checking the
++ * task structure at task creation time
++ * (AUDIT_PER_TASK). */
++#define AUDIT_PID 0
++#define AUDIT_UID 1
++#define AUDIT_EUID 2
++#define AUDIT_SUID 3
++#define AUDIT_FSUID 4
++#define AUDIT_GID 5
++#define AUDIT_EGID 6
++#define AUDIT_SGID 7
++#define AUDIT_FSGID 8
++#define AUDIT_LOGINUID 9
++#define AUDIT_PERS 10
++#define AUDIT_ARCH 11
++#define AUDIT_MSGTYPE 12
++#define AUDIT_SUBJ_USER 13 /* security label user */
++#define AUDIT_SUBJ_ROLE 14 /* security label role */
++#define AUDIT_SUBJ_TYPE 15 /* security label type */
++#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
++#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
++#define AUDIT_PPID 18
++#define AUDIT_OBJ_USER 19
++#define AUDIT_OBJ_ROLE 20
++#define AUDIT_OBJ_TYPE 21
++#define AUDIT_OBJ_LEV_LOW 22
++#define AUDIT_OBJ_LEV_HIGH 23
++#define AUDIT_LOGINUID_SET 24
++
++ /* These are ONLY useful when checking
++ * at syscall exit time (AUDIT_AT_EXIT). */
++#define AUDIT_DEVMAJOR 100
++#define AUDIT_DEVMINOR 101
++#define AUDIT_INODE 102
++#define AUDIT_EXIT 103
++#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
++#define AUDIT_WATCH 105
++#define AUDIT_PERM 106
++#define AUDIT_DIR 107
++#define AUDIT_FILETYPE 108
++#define AUDIT_OBJ_UID 109
++#define AUDIT_OBJ_GID 110
++#define AUDIT_FIELD_COMPARE 111
++
++#define AUDIT_ARG0 200
++#define AUDIT_ARG1 (AUDIT_ARG0+1)
++#define AUDIT_ARG2 (AUDIT_ARG0+2)
++#define AUDIT_ARG3 (AUDIT_ARG0+3)
++
++#define AUDIT_FILTERKEY 210
++
++#define AUDIT_NEGATE 0x80000000
++
++/* These are the supported operators.
++ * 4 2 1 8
++ * = > < ?
++ * ----------
++ * 0 0 0 0 00 nonsense
++ * 0 0 0 1 08 & bit mask
++ * 0 0 1 0 10 <
++ * 0 1 0 0 20 >
++ * 0 1 1 0 30 !=
++ * 1 0 0 0 40 =
++ * 1 0 0 1 48 &= bit test
++ * 1 0 1 0 50 <=
++ * 1 1 0 0 60 >=
++ * 1 1 1 1 78 all operators
++ */
++#define AUDIT_BIT_MASK 0x08000000
++#define AUDIT_LESS_THAN 0x10000000
++#define AUDIT_GREATER_THAN 0x20000000
++#define AUDIT_NOT_EQUAL 0x30000000
++#define AUDIT_EQUAL 0x40000000
++#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL)
++#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
++#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
++#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
++
++enum {
++ Audit_equal,
++ Audit_not_equal,
++ Audit_bitmask,
++ Audit_bittest,
++ Audit_lt,
++ Audit_gt,
++ Audit_le,
++ Audit_ge,
++ Audit_bad
++};
++
++/* Status symbols */
++ /* Mask values */
++#define AUDIT_STATUS_ENABLED 0x0001
++#define AUDIT_STATUS_FAILURE 0x0002
++#define AUDIT_STATUS_PID 0x0004
++#define AUDIT_STATUS_RATE_LIMIT 0x0008
++#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
++ /* Failure-to-log actions */
++#define AUDIT_FAIL_SILENT 0
++#define AUDIT_FAIL_PRINTK 1
++#define AUDIT_FAIL_PANIC 2
++
++/* distinguish syscall tables */
++#define __AUDIT_ARCH_64BIT 0x80000000
++#define __AUDIT_ARCH_LE 0x40000000
++#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_ARMEB (EM_ARM)
++#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_FRV (EM_FRV)
++#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_M32R (EM_M32R)
++#define AUDIT_ARCH_M68K (EM_68K)
++#define AUDIT_ARCH_MIPS (EM_MIPS)
++#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
++#define AUDIT_ARCH_PARISC (EM_PARISC)
++#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_PPC (EM_PPC)
++#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_S390 (EM_S390)
++#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_SH (EM_SH)
++#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++#define AUDIT_ARCH_SPARC (EM_SPARC)
++#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
++#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++
++#define AUDIT_PERM_EXEC 1
++#define AUDIT_PERM_WRITE 2
++#define AUDIT_PERM_READ 4
++#define AUDIT_PERM_ATTR 8
++
++/* MAX_AUDIT_MESSAGE_LENGTH is set in audit:lib/libaudit.h as:
++ * 8970 // PATH_MAX*2+CONTEXT_SIZE*2+11+256+1
++ * max header+body+tailer: 44 + 29 + 32 + 262 + 7 + pad
++ */
++#define AUDIT_MESSAGE_TEXT_MAX 8560
++
++struct audit_status {
++ uint32_t mask; /* Bit mask for valid entries */
++ uint32_t enabled; /* 1 = enabled, 0 = disabled */
++ uint32_t failure; /* Failure-to-log action */
++ uint32_t pid; /* pid of auditd process */
++ uint32_t rate_limit; /* messages rate limit (per second) */
++ uint32_t backlog_limit; /* waiting messages limit */
++ uint32_t lost; /* messages lost */
++ uint32_t backlog; /* messages waiting in queue */
++};
++
++struct audit_features {
++#define AUDIT_FEATURE_VERSION 1
<Skipped 10893 lines>
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/dietlibc.git/commitdiff/47ba3386937e9d72d45fd8000fd3143c684701b6
More information about the pld-cvs-commit
mailing list