Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chris-se/e35381c75583a4c4bce2 to your computer and use it in GitHub Desktop.
Save chris-se/e35381c75583a4c4bce2 to your computer and use it in GitHub Desktop.
Index: libstdio/fflush.c
===================================================================
RCS file: /cvs/dietlibc/libstdio/fflush.c,v
retrieving revision 1.22
diff -u -p -r1.22 fflush.c
--- libstdio/fflush.c 19 Jun 2012 12:53:48 -0000 1.22
+++ libstdio/fflush.c 22 Mar 2016 19:12:57 -0000
@@ -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)
Index: Makefile
===================================================================
RCS file: /cvs/dietlibc/Makefile,v
retrieving revision 1.210
diff -u -p -r1.210 Makefile
--- Makefile 18 Mar 2016 13:43:08 -0000 1.210
+++ Makefile 22 Mar 2016 19:13:20 -0000
@@ -90,7 +90,7 @@ PIE=-fpie -fvisibility=hidden
OBJDIR=bin-$(ARCH)
ILIBDIR=$(LIBDIR)-$(ARCH)
-HOME=$(shell pwd)
+DIETHOME=$(shell pwd)
WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \
$(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \
@@ -335,7 +335,7 @@ VERSION=dietlibc-$(shell head -n 1 CHANG
CURNAME=$(notdir $(shell pwd))
$(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
- $(CCC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc
+ $(CCC) -isystem include $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(DIETHOME)\" -DVERSION=\"$(VERSION)\" -lgcc
$(STRIP) -R .comment -R .note $@
$(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
@@ -343,7 +343,7 @@ $(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OB
$(STRIP) -R .comment -R .note $@
$(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
- $(LD_UNSET) $(CCC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so
+ $(LD_UNSET) $(CCC) -isystem include $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(DIETHOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(DIETHOME)/$(PICODIR)/libdl.so
$(STRIP) -R .command -R .note $@
$(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
Index: lib/__utime.c
===================================================================
RCS file: /cvs/dietlibc/lib/__utime.c,v
retrieving revision 1.2
diff -u -p -r1.2 __utime.c
--- lib/__utime.c 19 Apr 2014 15:07:34 -0000 1.2
+++ lib/__utime.c 22 Mar 2016 19:13:58 -0000
@@ -4,6 +4,8 @@
#include <sys/time.h>
#ifndef __NR_utime
+extern int utimes(const char *, struct timeval *);
+
int utime(const char *filename, const struct utimbuf *times)
{
if (times == NULL)
Index: Makefile
===================================================================
RCS file: /cvs/dietlibc/Makefile,v
retrieving revision 1.210
diff -u -p -r1.210 Makefile
--- Makefile 18 Mar 2016 13:43:08 -0000 1.210
+++ Makefile 22 Mar 2016 19:14:20 -0000
@@ -573,6 +573,32 @@ $(OBJDIR)/stackgap.o $(OBJDIR)/stackgap-
# WANT_MALLOC_ZERO
$(OBJDIR)/strndup.o: dietfeatures.h
+# tell the compiler to not assume that aliasing rules are 100% followed in these source files
+
+$(OBJDIR)/seekdir.o: lib/seekdir.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -c $< -o $@ -D__dietlibc__ -fno-strict-aliasing
+ -$(STRIP) -x -R .comment -R .note $@
+
+$(OBJDIR)/clnt_raw.o: librpc/clnt_raw.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -c $< -o $@ -D__dietlibc__ -fno-strict-aliasing
+ -$(STRIP) -x -R .comment -R .note $@
+
+$(OBJDIR)/clnt_udp.o: librpc/clnt_udp.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -c $< -o $@ -D__dietlibc__ -fno-strict-aliasing
+ -$(STRIP) -x -R .comment -R .note $@
+
+$(PICODIR)/seekdir.o: lib/seekdir.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -fno-strict-aliasing
+ $(STRIP) -x -R .comment -R .note $@
+
+$(PICODIR)/clnt_raw.o: librpc/clnt_raw.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -fno-strict-aliasing
+ $(STRIP) -x -R .comment -R .note $@
+
+$(PICODIR)/clnt_udp.o: librpc/clnt_udp.c
+ $(CCC) $(INC) $(CFLAGS) $(EXTRACFLAGS) -fPIC -D__DYN_LIB -c $< -o $@ -fno-strict-aliasing
+ $(STRIP) -x -R .comment -R .note $@
+
# dietdirent.h dependencies
$(OBJDIR)/closedir.o $(OBJDIR)/fdopendir.o $(OBJDIR)/ftw.o $(OBJDIR)/ftw64.o $(OBJDIR)/opendir.o $(OBJDIR)/readdir.o $(OBJDIR)/readdir64.o $(OBJDIR)/readdir_r.o $(OBJDIR)/rewinddir.o $(OBJDIR)/seekdir.o $(OBJDIR)/telldir.o $(OBJDIR)/dirfd.o: dietdirent.h
Index: test/select.c
===================================================================
RCS file: /cvs/dietlibc/test/select.c,v
retrieving revision 1.2
diff -u -p -r1.2 select.c
--- test/select.c 20 Feb 2003 15:57:13 -0000 1.2
+++ test/select.c 22 Mar 2016 19:15:58 -0000
@@ -8,6 +8,9 @@ int main() {
struct timeval tv;
FD_ZERO(&f);
tv.tv_sec=3; tv.tv_usec=0;
- select(1,&f,0,0,&tv);
+ if (select(1,&f,0,0,&tv) == -1) {
+ perror("select");
+ return 1;
+ }
return 0;
}
Index: lib/__lltostr.c
===================================================================
RCS file: /cvs/dietlibc/lib/__lltostr.c,v
retrieving revision 1.3
diff -u -p -r1.3 __lltostr.c
--- lib/__lltostr.c 14 Aug 2001 16:56:49 -0000 1.3
+++ lib/__lltostr.c 22 Mar 2016 19:16:14 -0000
@@ -1,8 +1,8 @@
#include <string.h>
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase);
+int __lltostr(char *s, unsigned int size, unsigned long long i, unsigned int base, int UpCase);
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase)
+int __lltostr(char *s, unsigned int size, unsigned long long i, unsigned int base, int UpCase)
{
char *tmp;
unsigned int j=0;
Index: Makefile
===================================================================
RCS file: /cvs/dietlibc/Makefile,v
retrieving revision 1.210
diff -u -p -r1.210 Makefile
--- Makefile 18 Mar 2016 13:43:08 -0000 1.210
+++ Makefile 22 Mar 2016 19:28:41 -0000
@@ -116,23 +116,23 @@ INC=-I. -isystem include
VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling
-SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S))
+SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(sort $(wildcard syscalls.s/*.S)))
-LIBOBJ=$(patsubst lib/%.c,$(OBJDIR)/%.o,$(wildcard lib/*.c))
-LIBUGLYOBJ=$(patsubst libugly/%.c,$(OBJDIR)/%.o,$(wildcard libugly/*.c))
-LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(wildcard libstdio/*.c))
-LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(wildcard libcruft/*.c))
-LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(wildcard libcrypt/*.c))
-LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(wildcard libshell/*.c))
-LIBCOMPATOBJ=$(patsubst libcompat/%.c,$(OBJDIR)/%.o,$(wildcard libcompat/*.c)) $(OBJDIR)/syscall.o
-LIBMATH=$(patsubst libm/%.c,%.o,$(wildcard libm/*.c))
+LIBOBJ=$(patsubst lib/%.c,$(OBJDIR)/%.o,$(sort $(wildcard lib/*.c)))
+LIBUGLYOBJ=$(patsubst libugly/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libugly/*.c)))
+LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libstdio/*.c)))
+LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libcruft/*.c)))
+LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libcrypt/*.c)))
+LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libshell/*.c)))
+LIBCOMPATOBJ=$(patsubst libcompat/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libcompat/*.c))) $(OBJDIR)/syscall.o
+LIBMATH=$(patsubst libm/%.c,%.o,$(sort $(wildcard libm/*.c)))
-LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c))
-LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(wildcard libregex/*.c))
+LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(sort $(wildcard librpc/*.c)))
+LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libregex/*.c)))
-LIBDLOBJ=$(patsubst libdl/%.c,$(OBJDIR)/%.o,$(wildcard libdl/*.c)) $(OBJDIR)/_dl_jump.o
+LIBDLOBJ=$(patsubst libdl/%.c,$(OBJDIR)/%.o,$(sort $(wildcard libdl/*.c))) $(OBJDIR)/_dl_jump.o
-LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh)) $(OBJDIR)/__testandset.o
+LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(sort $(shell ./threadsafe.sh))) $(OBJDIR)/__testandset.o
LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o
@@ -239,7 +239,7 @@ $(OBJDIR)/libcrypt.a: | $(OBJDIR)
dummy.o:
-LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c))
+LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(sort $(wildcard liblatin1/*.c)))
$(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS)
$(CROSS)ar cru $@ $^
Index: libdl/Makefile
===================================================================
RCS file: /cvs/dietlibc/libdl/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- libdl/Makefile 17 Dec 2004 20:37:28 -0000 1.14
+++ libdl/Makefile 22 Mar 2016 19:28:41 -0000
@@ -3,7 +3,7 @@
CC = $(CROSS)gcc
DCC = diet $(CC)
-SRC = $(wildcard *.c) # test/test.c
+SRC = $(sort $(wildcard *.c)) # test/test.c
OBJ = _dl_jump.o $(SRC:.c=.o)
#CFLAGS = -Wall -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -g -O
Index: libpthread/Makefile
===================================================================
RCS file: /cvs/dietlibc/libpthread/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- libpthread/Makefile 18 Aug 2003 17:32:52 -0000 1.15
+++ libpthread/Makefile 22 Mar 2016 19:28:41 -0000
@@ -12,9 +12,9 @@ CC=gcc
VPATH=../$(ARCH)/
-PTHREAD_OBJS = __testandset.o $(patsubst %.c,%.o,$(wildcard pthread_*.c))
+PTHREAD_OBJS = __testandset.o $(patsubst %.c,%.o,$(sort $(wildcard pthread_*.c)))
-TESTS = $(patsubst %.c,%,$(wildcard test-*.c))
+TESTS = $(patsubst %.c,%,$(sort $(wildcard test-*.c)))
%.o : %.c
$(CC) $(CFLAGS) -c -o $@ $?
Index: ppc/select.S
===================================================================
RCS file: ppc/select.S
diff -N ppc/select.S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ppc/select.S 22 Mar 2016 19:18:23 -0000
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(_newselect,select)
Index: ppc64/select.S
===================================================================
RCS file: ppc64/select.S
diff -N ppc64/select.S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ppc64/select.S 22 Mar 2016 19:18:23 -0000
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(_newselect,select)
Index: alpha/syscalls.h
===================================================================
RCS file: /cvs/dietlibc/alpha/syscalls.h,v
retrieving revision 1.7
diff -u -p -r1.7 syscalls.h
--- alpha/syscalls.h 6 Oct 2014 19:58:06 -0000 1.7
+++ alpha/syscalls.h 22 Mar 2016 19:19:30 -0000
@@ -231,6 +231,8 @@
#define __NR_osf_memcntl 260 /* not implemented */
#define __NR_osf_fdatasync 261 /* not implemented */
+#define __NR_umount_without_flags __NR_oldumount
+#define __NR_umount_with_flags __NR_umount
/*
* Linux-specific system calls begin at 300
Index: ia64/syscalls.h
===================================================================
RCS file: /cvs/dietlibc/ia64/syscalls.h,v
retrieving revision 1.12
diff -u -p -r1.12 syscalls.h
--- ia64/syscalls.h 6 Oct 2014 19:58:06 -0000 1.12
+++ ia64/syscalls.h 22 Mar 2016 19:19:30 -0000
@@ -318,6 +318,8 @@
#define __NR_getrandom 1339
#define __NR_memfd_create 1340
+#define __NR_umount_with_flags __NR_umount
+
#define syscall(name, sym) \
.text; \
.globl sym; \
Index: syscalls.s/umount.S
===================================================================
RCS file: /cvs/dietlibc/syscalls.s/umount.S,v
retrieving revision 1.2
diff -u -p -r1.2 umount.S
--- syscalls.s/umount.S 3 Mar 2011 18:40:05 -0000 1.2
+++ syscalls.s/umount.S 22 Mar 2016 19:19:30 -0000
@@ -1,5 +1,9 @@
#include "syscalls.h"
#ifdef __NR_umount
+#if defined(__NR_umount_without_flags)
+syscall(umount_without_flags,umount)
+#elif !defined(__NR_umount_with_flags) || (__NR_umount != __NR_umount_with_flags)
syscall(umount,umount)
#endif
+#endif
Index: syscalls.s/umount2.S
===================================================================
RCS file: /cvs/dietlibc/syscalls.s/umount2.S,v
retrieving revision 1.2
diff -u -p -r1.2 umount2.S
--- syscalls.s/umount2.S 4 Jan 2003 22:21:48 -0000 1.2
+++ syscalls.s/umount2.S 22 Mar 2016 19:19:30 -0000
@@ -1,5 +1,7 @@
#include "syscalls.h"
-#ifdef __NR_umount2
+#if defined(__NR_umount_with_flags)
+syscall(umount_with_flags,umount2)
+#elif defined(__NR_umount2)
syscall(umount2,umount2)
#endif
Index: ia64/umount-wrapper.c
===================================================================
RCS file: ia64/umount-wrapper.c
diff -N ia64/umount-wrapper.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ia64/umount-wrapper.c 22 Mar 2016 19:20:56 -0000
@@ -0,0 +1,5 @@
+#include <sys/mount.h>
+
+int umount(const char *target) {
+ return umount2(target, 0);
+}
Index: ia64/Makefile.add
===================================================================
RCS file: /cvs/dietlibc/ia64/Makefile.add,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.add
--- ia64/Makefile.add 21 Dec 2011 02:11:38 -0000 1.6
+++ ia64/Makefile.add 22 Mar 2016 19:20:56 -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)/__nice.o $(OBJDIR)/__alarm.o $(OBJDIR)/__CAS.o $(OBJDIR)/umount-wrapper.o
Index: include/endian.h
===================================================================
RCS file: /cvs/dietlibc/include/endian.h,v
retrieving revision 1.18
diff -u -p -r1.18 endian.h
--- include/endian.h 26 Jan 2016 09:53:12 -0000 1.18
+++ include/endian.h 22 Mar 2016 19:21:39 -0000
@@ -39,7 +39,7 @@
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
-#if defined(__alpha__) || defined(__mips64__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__)
+#if defined(__alpha__) || defined(__mips64__) || defined(__sparcv9) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__)
#define __WORDSIZE 64
#endif
@@ -51,12 +51,13 @@
#endif
#endif
-#if defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc_v9__)
+#if defined(__x86_64__) || defined(__powerpc64__) || defined(__sparcv9)
#define __WORDSIZE_COMPAT32 1
#endif
#if defined(__sparc__) && (__arch64__)
#define __WORDSIZE 64
+#define __WORDSIZE_COMPAT32 1
#endif
#ifdef __WORDSIZE
Index: arm/dyn_syscalls.S
===================================================================
RCS file: /cvs/dietlibc/arm/dyn_syscalls.S,v
retrieving revision 1.33
diff -u -p -r1.33 dyn_syscalls.S
--- arm/dyn_syscalls.S 19 Apr 2014 15:07:33 -0000 1.33
+++ arm/dyn_syscalls.S 22 Mar 2016 19:23:08 -0000
@@ -11,10 +11,10 @@
#include <dietfeatures.h>
#include "syscalls.h"
-.text
-__unified_syscall4:
+
+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
@@ -28,6 +28,8 @@ __unified_syscall:
mvn r0, #0
#include "dietuglyweaks.h"
RET
+FUNC_END __unified_syscall
+FUNC_END __unified_syscall4
/* ok now include all syscalls.s (*.S) and sysdep *.S */
#include "mmap.S"
@@ -281,9 +283,11 @@ __unified_syscall:
#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
Index: arm/mcount.S
===================================================================
RCS file: /cvs/dietlibc/arm/mcount.S,v
retrieving revision 1.1
diff -u -p -r1.1 mcount.S
--- arm/mcount.S 9 May 2002 03:50:17 -0000 1.1
+++ arm/mcount.S 22 Mar 2016 19:23:08 -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 @@ mcount:
bl __mcount @ call __mcount
ldmdb fp, { r0 - r3, fp, sp, pc } @ restore context from stack frame and return.
-
+FUNC_END mcount
Index: arm/md5asm.S
===================================================================
RCS file: /cvs/dietlibc/arm/md5asm.S,v
retrieving revision 1.7
diff -u -p -r1.7 md5asm.S
--- arm/md5asm.S 19 Apr 2014 15:07:33 -0000 1.7
+++ arm/md5asm.S 22 Mar 2016 19:23:08 -0000
@@ -55,22 +55,11 @@
#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:
-
+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]
@@ -84,14 +73,13 @@ MD5Init:
.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);
@ --
-MD5Update:
-
+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]
@@ -125,7 +113,7 @@ MD5Update:
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);
Index: arm/mmap.S
===================================================================
RCS file: /cvs/dietlibc/arm/mmap.S,v
retrieving revision 1.10
diff -u -p -r1.10 mmap.S
--- arm/mmap.S 15 Mar 2016 13:46:10 -0000 1.10
+++ arm/mmap.S 22 Mar 2016 19:23:08 -0000
@@ -4,6 +4,8 @@
#include <errno.h>
#include "syscalls.h"
+#include "dietfeatures.h"
+#include "arm-features.h"
.text
@@ -16,13 +18,12 @@
@ call the syscall.
@
-.global mmap
-
-mmap:
+FUNC_START mmap
stmdb sp!, {r0, r1, r2, r3}
mov r0, sp
swi __NR_mmap
add sp, sp, #16
b __unified_syscall
+FUNC_END mmap
#endif
Index: include/sys/types.h
===================================================================
RCS file: /cvs/dietlibc/include/sys/types.h,v
retrieving revision 1.32
diff -u -p -r1.32 types.h
--- include/sys/types.h 24 Apr 2013 10:05:59 -0000 1.32
+++ include/sys/types.h 22 Mar 2016 19:23:42 -0000
@@ -82,7 +82,6 @@ typedef int32_t id_t; /* Used as a gen
typedef unsigned long ino_t; /* Used for file serial numbers. */
typedef int32_t key_t; /* Used for interprocess communication. */
typedef int32_t pid_t; /* Used for process IDs and process group IDs. */
-typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
typedef signed long suseconds_t; /* Used for time in microseconds. */
#if defined(__x86_64__) && defined(__ILP32__)
typedef signed long long time_t;
@@ -91,6 +90,16 @@ typedef signed long time_t; /* Used for
#endif
typedef signed long useconds_t; /* Used for time in microseconds. */
+/* make this match size_t definition from stddef.h */
+#ifdef __GNUC__
+/* e-eeeevil kludge, but apparently works */
+#define unsigned signed
+typedef __SIZE_TYPE__ ssize_t; /* Used for a count of bytes or an error indication. */
+#undef unsigned
+#else
+typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
+#endif
+
/* non-susv2 types: */
__extension__ typedef signed long long loff_t; /* 64-bit offset */
Index: arm/setjmp.S
===================================================================
RCS file: /cvs/dietlibc/arm/setjmp.S,v
retrieving revision 1.5
diff -u -p -r1.5 setjmp.S
--- arm/setjmp.S 19 Apr 2014 15:07:33 -0000 1.5
+++ arm/setjmp.S 22 Mar 2016 19:27:48 -0000
@@ -15,7 +15,7 @@ FUNC_START __sigsetjmp
#endif
#ifndef __SOFTFP__
-# if __ARM_ARCH__ >= 7
+# if __ARM_ARCH__ >= 6
vstmia ip!, {d0-d15}
# ifdef __ARM_NEON__
vstmia ip!, {d16-d31}
Index: arm/__longjmp.S
===================================================================
RCS file: /cvs/dietlibc/arm/__longjmp.S,v
retrieving revision 1.4
diff -u -p -r1.4 __longjmp.S
--- arm/__longjmp.S 19 Apr 2014 15:07:32 -0000 1.4
+++ arm/__longjmp.S 22 Mar 2016 19:27:48 -0000
@@ -5,7 +5,7 @@ FUNC_START __longjmp
movs r0, r1
moveq r0, #1
#ifndef __SOFTFP__
-# if __ARM_ARCH__ == 7
+# if __ARM_ARCH__ >= 6
vldm ip!, {d0-d15}
# ifdef __ARM_NEON__
vldm ip!, {d16-d31}
Index: diet.c
===================================================================
RCS file: /cvs/dietlibc/diet.c,v
retrieving revision 1.79
diff -u -p -r1.79 diet.c
--- diet.c 19 Apr 2014 15:07:32 -0000 1.79
+++ diet.c 22 Mar 2016 19:31:11 -0000
@@ -411,6 +411,12 @@ incorporated:
*dest++=f;
}
#endif
+#ifndef WANT_SSP
+ /* dietfeatures.h says: If you compile dietlibc without WANT_SSP
+ * and then try to link code compiled with -fstack-protector
+ * against it, the binary will segfault when calling that code. */
+ *dest++=(char*)"-fno-stack-protector";
+#endif
*dest=0;
if (verbose) {
for (i=0; newargv[i]; i++) {
Index: Makefile
===================================================================
RCS file: /cvs/dietlibc/Makefile,v
retrieving revision 1.210
diff -u -p -r1.210 Makefile
--- Makefile 18 Mar 2016 13:43:08 -0000 1.210
+++ Makefile 22 Mar 2016 19:32:15 -0000
@@ -65,6 +65,9 @@ else
ifeq ($(MYARCH),armeb)
ARCH=arm
else
+ifeq ($(MYARCH),x32)
+ARCH=x32
+else
$(error unknown architecture, please fix Makefile)
endif
endif
@@ -82,6 +85,7 @@ endif
endif
endif
endif
+endif
PIE=-fpie -fvisibility=hidden
Index: diet.c
===================================================================
RCS file: /cvs/dietlibc/diet.c,v
retrieving revision 1.79
diff -u -p -r1.79 diet.c
--- diet.c 19 Apr 2014 15:07:32 -0000 1.79
+++ diet.c 22 Mar 2016 19:32:15 -0000
@@ -186,8 +186,12 @@ int main(int argc,char *argv[]) {
shortplatform="parisc";
#endif
#ifdef __x86_64__
+#ifdef __ILP32__
+ shortplatform=(m==32?"i386":(m==64?"x86_64":"x32"));
+#else
shortplatform=(m==32?"i386":(m==33?"x32":"x86_64"));
#endif
+#endif
#ifdef __ia64__
shortplatform="ia64";
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment