summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-02-20 16:47:39 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-02-20 16:47:39 +0000
commita5a39243b3a51c0187a108d325948155d0aa4fc0 (patch)
treef060b709384d7ea1bb3e6ce231d4d0c434d3b4ed
parent7cbf0dbf5c98d10023125b06b5d4b737c246aacc (diff)
downloaddrakx-a5a39243b3a51c0187a108d325948155d0aa4fc0.tar
drakx-a5a39243b3a51c0187a108d325948155d0aa4fc0.tar.gz
drakx-a5a39243b3a51c0187a108d325948155d0aa4fc0.tar.bz2
drakx-a5a39243b3a51c0187a108d325948155d0aa4fc0.tar.xz
drakx-a5a39243b3a51c0187a108d325948155d0aa4fc0.zip
Merge with dietlibc 0.22-1mdk
-rw-r--r--mdk-stage1/dietlibc/CHANGES24
-rw-r--r--mdk-stage1/dietlibc/FAQ15
-rw-r--r--mdk-stage1/dietlibc/Makefile9
-rw-r--r--mdk-stage1/dietlibc/alpha/errlist.S288
-rw-r--r--mdk-stage1/dietlibc/diet.c4
-rw-r--r--mdk-stage1/dietlibc/dietstdio.h1
-rw-r--r--mdk-stage1/dietlibc/i386/cos.S21
-rw-r--r--mdk-stage1/dietlibc/i386/dyn_syscalls.S1
-rw-r--r--mdk-stage1/dietlibc/i386/ldexp.S23
-rw-r--r--mdk-stage1/dietlibc/i386/libm2.S23
-rw-r--r--mdk-stage1/dietlibc/i386/memchr.S2
-rw-r--r--mdk-stage1/dietlibc/i386/mmap64.S11
-rw-r--r--mdk-stage1/dietlibc/i386/sin.S20
-rw-r--r--mdk-stage1/dietlibc/i386/vfork.S9
-rw-r--r--mdk-stage1/dietlibc/ia64/msgctl.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/msgget.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semget.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semop.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/include/assert.h7
-rw-r--r--mdk-stage1/dietlibc/include/dirent.h6
-rw-r--r--mdk-stage1/dietlibc/include/dlfcn.h1
-rw-r--r--mdk-stage1/dietlibc/include/linux/eventpoll.h17
-rw-r--r--mdk-stage1/dietlibc/include/signal.h2
-rw-r--r--mdk-stage1/dietlibc/include/stdarg-cruft.h2
-rw-r--r--mdk-stage1/dietlibc/include/string.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/ioctl.h6
-rw-r--r--mdk-stage1/dietlibc/include/sys/poll.h36
-rw-r--r--mdk-stage1/dietlibc/include/sys/time.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/types.h4
-rw-r--r--mdk-stage1/dietlibc/include/sys/vfs.h3
-rw-r--r--mdk-stage1/dietlibc/include/termios.h2
-rw-r--r--mdk-stage1/dietlibc/include/unistd.h3
-rw-r--r--mdk-stage1/dietlibc/lib/__dtostr.c17
-rw-r--r--mdk-stage1/dietlibc/lib/__isinf.c15
-rw-r--r--mdk-stage1/dietlibc/lib/__isnan.c2
-rw-r--r--mdk-stage1/dietlibc/lib/__v_printf.c1
-rw-r--r--mdk-stage1/dietlibc/lib/signal.c2
-rw-r--r--mdk-stage1/dietlibc/lib/strerror.c13
-rw-r--r--mdk-stage1/dietlibc/libcruft/alphasort64.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/scandir64.c47
-rw-r--r--mdk-stage1/dietlibc/libcruft/sysconf.c3
-rw-r--r--mdk-stage1/dietlibc/libregex/rx.c3
-rw-r--r--mdk-stage1/dietlibc/libshell/glob.c17
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdglue2.c8
-rw-r--r--mdk-stage1/dietlibc/libstdio/fflush.c2
-rw-r--r--mdk-stage1/dietlibc/libstdio/fread.c2
-rw-r--r--mdk-stage1/dietlibc/libugly/strftime.c9
-rw-r--r--mdk-stage1/dietlibc/libugly/strndup.c10
-rw-r--r--mdk-stage1/dietlibc/libugly/tzfile.c2
-rw-r--r--mdk-stage1/dietlibc/sparc/Makefile.add1
-rw-r--r--mdk-stage1/dietlibc/sparc/errlist.S280
-rw-r--r--mdk-stage1/dietlibc/sparc/udiv.S102
-rw-r--r--mdk-stage1/dietlibc/sparc/umul.S6
-rw-r--r--mdk-stage1/dietlibc/sparc/urem.S102
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/errlist.S20
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fstat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ipc.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lstat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/msync.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigaction.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigpending.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pause.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/socketcall.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/umount2.S2
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semop.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/start.S25
86 files changed, 1122 insertions, 207 deletions
diff --git a/mdk-stage1/dietlibc/CHANGES b/mdk-stage1/dietlibc/CHANGES
index 24282baa5..de4f88c3e 100644
--- a/mdk-stage1/dietlibc/CHANGES
+++ b/mdk-stage1/dietlibc/CHANGES
@@ -26,6 +26,30 @@
add epoll_create, epoll_ctl and epoll_wait
the new x86 syscall numbers exceed 255, breaking our %al optimization
I worked around it with conditional assembly in cpp macros. Ugh.
+ more MIPS fixes (the stoned MIPS ABI for restartable syscalls expects
+ the instruction before the syscall to be a load immediate)
+ fix fread() from a pipe (oops, tried to lseek)
+ #define _POSIX_VDISABLE in termios.h (Laurent Bercot)
+ two *printf fixes (Gernot Tenchio)
+ add nan and +-inf handling in __dtostr
+ add _SC_NGROUPS_MAX support to sysconf (Felix J. Ogris)
+ make assert() use expect(), slight optimization
+ add i386 vfork (Thomas Ogrisegg)
+ fix SA_NODEFER on sparc (Gerrit Pape, Thomas Bader)
+ fix sin, cos and __dtostr (Gernot Tenchio)
+ add /dev/epoll ioctl constants to sys/ioctl.h
+ add linux/eventpoll.h for /dev/epoll
+ fix lseek64 on 64-bit architectures
+ Olaf: fix x86_64 start-code (we have reg-args)
+ fixing some broken macros in sparc32-code (.udiv,.urem)
+ adding strndup (GNU Extension)
+ fix glob strncpy (R.L. Horn)
+ fix regfree (Uwe Ohse)
+ fix puts in full stdio mode (would omit \n)
+ fix wrong types on powerpc, broke *stat (Gerrit Pape)
+ allow more than 64k in i386 memchr (Karsten Scheibler)
+ make strftime work it WANT_TZFILE_PARSER is not set (Gwenole Beauchesne)
+ build parisc on parisc64, change libgcc link order on sparc (Gerrit Pape)
0.21:
use gcc's size_t, ptrdiff_t and wchar_t types (Olaf)
diff --git a/mdk-stage1/dietlibc/FAQ b/mdk-stage1/dietlibc/FAQ
index 02bae3dcd..d6595dcc9 100644
--- a/mdk-stage1/dietlibc/FAQ
+++ b/mdk-stage1/dietlibc/FAQ
@@ -207,3 +207,18 @@ A: The diet libc is also useful for servers because it can improve
Please see http://www.fefe.de/fnord/ (in particular .../fnord/SPEED)
for an example and/or read http://www.fefe.de/talk.pdf for some
benchmarks.
+
+
+Q: I just compiled hello world and the binary is larger than with glibc!
+A: You forgot to add the dynamic glibc to your size comparison. Please
+ use -static when linking with glibc to see the difference.
+
+
+Q: Should I compile my kernel with the diet libc?
+A: The kernel is not linked against any libc. In fact, the libc is the
+ user space interface to the kernel. So unless you are talking about
+ "user mode linux" (which is a special version of the kernel that
+ happens to be a user space program) you cannot link the kernel
+ against the diet libc. Linking user space Linux with the diet libc
+ should be possible in theory but I don't think anyone has actually
+ tried it.
diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile
index da28b4112..0fe32e61b 100644
--- a/mdk-stage1/dietlibc/Makefile
+++ b/mdk-stage1/dietlibc/Makefile
@@ -1,5 +1,5 @@
INSTALL=install
-prefix=/usr
+prefix?=/usr
# Set the following to install to a different root
#DESTDIR=/tmp/fefix
# Use "make DEBUG=1" to compile a debug version.
@@ -40,6 +40,10 @@ else
ifeq ($(MYARCH),parisc)
ARCH=parisc
else
+ifeq ($(MYARCH),parisc64)
+ARCH=parisc
+MYARCH=parisc
+else
ifeq ($(MYARCH),x86_64)
ARCH=x86_64
else
@@ -59,6 +63,7 @@ endif
endif
endif
endif
+endif
# ARCH=$(MYARCH)
@@ -356,7 +361,7 @@ strcasecmp.o $(OBJDIR)/strcat.o $(OBJDIR)/strchr.o $(OBJDIR)/strcmp.o $(OBJDIR)/
$(OBJDIR)/ttyname.o $(OBJDIR)/sysconf_cpus.o: dietfeatures.h
# these depend on dietfeatures.h for WANT_TZFILE_PARSER
-$(OBJDIR)/localtime_r.o: dietfeatures.h
+$(OBJDIR)/localtime_r.o $(OBJDIR)/strftime.o: dietfeatures.h
# these depend on dietfeatures.h for WANT_SMALL_STDIO_BUFS
$(LIBSTDIOOBJ): dietfeatures.h
diff --git a/mdk-stage1/dietlibc/alpha/errlist.S b/mdk-stage1/dietlibc/alpha/errlist.S
new file mode 100644
index 000000000..a5956ce05
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/errlist.S
@@ -0,0 +1,288 @@
+#ifdef __DYN_LIB
+.section .data
+#else
+.section .rodata
+#endif
+
+.align 8
+.global sys_errlist
+.type sys_errlist,@object
+
+sys_errlist:
+ .quad .LC000
+ .quad .LC001
+ .quad .LC002
+ .quad .LC003
+ .quad .LC004
+ .quad .LC005
+ .quad .LC006
+ .quad .LC007
+ .quad .LC008
+ .quad .LC009
+ .quad .LC010
+ .quad .LC011
+ .quad .LC012
+ .quad .LC013
+ .quad .LC014
+ .quad .LC015
+ .quad .LC016
+ .quad .LC017
+ .quad .LC018
+ .quad .LC019
+ .quad .LC020
+ .quad .LC021
+ .quad .LC022
+ .quad .LC023
+ .quad .LC024
+ .quad .LC025
+ .quad .LC026
+ .quad .LC027
+ .quad .LC028
+ .quad .LC029
+ .quad .LC030
+ .quad .LC031
+ .quad .LC032
+ .quad .LC033
+ .quad .LC034
+ .quad .LC035
+ .quad .LC036
+ .quad .LC037
+ .quad .LC038
+ .quad .LC039
+ .quad .LC040
+ .quad .LC041
+ .quad .LC042
+ .quad .LC043
+ .quad .LC044
+ .quad .LC045
+ .quad .LC046
+ .quad .LC047
+ .quad .LC048
+ .quad .LC049
+ .quad .LC050
+ .quad .LC051
+ .quad .LC052
+ .quad .LC053
+ .quad .LC054
+ .quad .LC055
+ .quad .LC056
+ .quad .LC057
+ .quad .LC058
+ .quad .LC059
+ .quad .LC060
+ .quad .LC061
+ .quad .LC062
+ .quad .LC063
+ .quad .LC064
+ .quad .LC065
+ .quad .LC066
+ .quad .LC067
+ .quad .LC068
+ .quad .LC069
+ .quad .LC070
+ .quad .LC071
+ .quad .LC072
+ .quad .LC073
+ .quad .LC074
+ .quad .LC075
+ .quad .LC076
+ .quad .LC077
+ .quad .LC078
+ .quad .LC079
+ .quad .LC080
+ .quad .LC081
+ .quad .LC082
+ .quad .LC083
+ .quad .LC084
+ .quad .LC085
+ .quad .LC086
+ .quad .LC087
+ .quad .LC088
+ .quad .LC089
+ .quad .LC090
+ .quad .LC091
+ .quad .LC092
+ .quad .LC093
+ .quad .LC094
+ .quad .LC095
+ .quad .LC096
+ .quad .LC097
+ .quad .LC098
+ .quad .LC099
+ .quad .LC100
+ .quad .LC101
+ .quad .LC102
+ .quad .LC103
+ .quad .LC104
+ .quad .LC105
+ .quad .LC106
+ .quad .LC107
+ .quad .LC108
+ .quad .LC109
+ .quad .LC110
+ .quad .LC111
+ .quad .LC112
+ .quad .LC113
+ .quad .LC114
+ .quad .LC115
+ .quad .LC116
+ .quad .LC117
+ .quad .LC118
+ .quad .LC119
+ .quad .LC120
+ .quad .LC121
+ .quad .LC122
+ .quad .LC123
+ .quad .LC124
+ .quad .LC125
+ .quad .LC126
+ .quad .LC127
+ .quad .LC128
+ .quad .LC129
+ .quad .LC130
+ .quad 0
+.size sys_errlist,.-sys_errlist
+
+.align 4
+.global sys_nerr
+.type sys_nerr,@object
+sys_nerr:
+ .long 130
+.size sys_nerr,4
+
+#ifdef __DYN_LIB
+.section .rodata
+#endif
+
+.LC000: .string "Success"
+.LC001: .string "Operation not permitted"
+.LC002: .string "No such file or directory"
+.LC003: .string "No such process"
+.LC004: .string "Interrupted system call"
+.LC005: .string "I/O error"
+.LC006: .string "No such device or address"
+.LC007: .string "Arg list too long"
+.LC008: .string "Exec format error"
+.LC009: .string "Bad file number"
+.LC010: .string "No child processes"
+.LC011: .string "Resource deadlock would occur"
+.LC012: .string "Out of memory"
+.LC013: .string "Permission denied"
+.LC014: .string "Bad address"
+.LC015: .string "Block device required"
+.LC016: .string "Device or resource busy"
+.LC017: .string "File exists"
+.LC018: .string "Cross-device link"
+.LC019: .string "No such device"
+.LC020: .string "Not a directory"
+.LC021: .string "Is a directory"
+.LC022: .string "Invalid argument"
+.LC023: .string "File table overflow"
+.LC024: .string "Too many open files"
+.LC025: .string "Not a typewriter"
+.LC026: .string "Text file busy"
+.LC027: .string "File too large"
+.LC028: .string "No space left on device"
+.LC029: .string "Illegal seek"
+.LC030: .string "Read-only file system"
+.LC031: .string "Too many links"
+.LC032: .string "Broken pipe"
+.LC033: .string "Math argument out of domain of func"
+.LC034: .string "Math result not representable"
+.LC035: .string "Try again"
+.LC036: .string "Operation now in progress"
+.LC037: .string "Operation already in progress"
+.LC038: .string "Socket operation on non-socket"
+.LC039: .string "Destination address required"
+.LC040: .string "Message too long"
+.LC041: .string "Protocol wrong type for socket"
+.LC042: .string "Protocol not available"
+.LC043: .string "Protocol not supported"
+.LC044: .string "Socket type not supported"
+.LC045: .string "Operation not supported on transport endpoint"
+.LC046: .string "Protocol family not supported"
+.LC047: .string "Address family not supported by protocol"
+.LC048: .string "Address already in use"
+.LC049: .string "Cannot assign requested address"
+.LC050: .string "Network is down"
+.LC051: .string "Network is unreachable"
+.LC052: .string "Network dropped connection because of reset"
+.LC053: .string "Software caused connection abort"
+.LC054: .string "Connection reset by peer"
+.LC055: .string "No buffer space available"
+.LC056: .string "Transport endpoint is already connected"
+.LC057: .string "Transport endpoint is not connected"
+.LC058: .string "Cannot send after transport endpoint shutdown"
+.LC059: .string "Too many references: cannot splice"
+.LC060: .string "Connection timed out"
+.LC061: .string "Connection refused"
+.LC062: .string "Too many symbolic links encountered"
+.LC063: .string "File name too long"
+.LC064: .string "Host is down"
+.LC065: .string "No route to host"
+.LC066: .string "Directory not empty"
+.LC067: .string "Error 67"
+.LC068: .string "Too many users"
+.LC069: .string "Quota exceeded"
+.LC070: .string "Stale NFS file handle"
+.LC071: .string "Object is remote"
+.LC072: .string "Error 72"
+.LC073: .string "Error 73"
+.LC074: .string "Error 74"
+.LC075: .string "Error 75"
+.LC076: .string "Error 76"
+.LC077: .string "No record locks available"
+.LC078: .string "Function not implemented"
+.LC079: .string "Error 79"
+.LC080: .string "No message of desired type"
+.LC081: .string "Identifier removed"
+.LC082: .string "Out of streams resources"
+.LC083: .string "Timer expired"
+.LC084: .string "Not a data message"
+.LC085: .string "Protocol error"
+.LC086: .string "No data available"
+.LC087: .string "Device not a stream"
+.LC088: .string "Channel number out of range"
+.LC089: .string "Level 2 not synchronized"
+.LC090: .string "Level 3 halted"
+.LC091: .string "Level 3 reset"
+.LC092: .string "Package not installed"
+.LC093: .string "Link number out of range"
+.LC094: .string "Protocol driver not attached"
+.LC095: .string "No CSI structure available"
+.LC096: .string "Level 2 halted"
+.LC097: .string "Invalid exchange"
+.LC098: .string "Invalid request descriptor"
+.LC099: .string "Exchange full"
+.LC100: .string "No anode"
+.LC101: .string "Invalid request code"
+.LC102: .string "Invalid slot"
+.LC103: .string "Error 103"
+.LC104: .string "Bad font file format"
+.LC105: .string "Machine is not on the network"
+.LC106: .string "Link has been severed"
+.LC107: .string "Advertise error"
+.LC108: .string "Srmount error"
+.LC109: .string "Communication error on send"
+.LC110: .string "Multihop attempted"
+.LC111: .string "RFS specific error"
+.LC112: .string "Value too large for defined data type"
+.LC113: .string "Name not unique on network"
+.LC114: .string "File descriptor in bad state"
+.LC115: .string "Remote address changed"
+.LC116: .string "Illegal byte sequence"
+.LC117: .string "Structure needs cleaning"
+.LC118: .string "Not a XENIX named type file"
+.LC119: .string "No XENIX semaphores available"
+.LC120: .string "Is a named type file"
+.LC121: .string "Remote I/O error"
+.LC122: .string "Can not access a needed shared library"
+.LC123: .string "Accessing a corrupted shared library"
+.LC124: .string ".lib section in a.out corrupted"
+.LC125: .string "Attempting to link in too many shared libraries"
+.LC126: .string "Cannot exec a shared library directly"
+.LC127: .string "Interrupted system call should be restarted"
+.LC128: .string "Streams pipe error"
+.LC129: .string "No medium found"
+.LC130: .string "Wrong medium type"
+
diff --git a/mdk-stage1/dietlibc/diet.c b/mdk-stage1/dietlibc/diet.c
index 86b21a1e1..c3a053ac8 100644
--- a/mdk-stage1/dietlibc/diet.c
+++ b/mdk-stage1/dietlibc/diet.c
@@ -325,8 +325,12 @@ pp:
incorporated:
if (_link) {
if (profile) *dest++="-lgmon";
+ if (!strcmp(shortplatform,"sparc") || !strcmp(shortplatform,"sparc64")) {
+ *dest++=(char*)libgcc; *dest++=c;
+ } else {
*dest++=c; *dest++=(char*)libgcc;
}
+ }
#ifdef WANT_DYNAMIC
if (_link) { *dest++=e; }
#endif
diff --git a/mdk-stage1/dietlibc/dietstdio.h b/mdk-stage1/dietlibc/dietstdio.h
index 6eba480c4..2e0e93601 100644
--- a/mdk-stage1/dietlibc/dietstdio.h
+++ b/mdk-stage1/dietlibc/dietstdio.h
@@ -36,6 +36,7 @@ struct __stdio_file {
#define BUFLINEWISE 8
#define NOBUF 16
#define STATICBUF 32
+#define FDPIPE 64
#define _IONBF 0
#define _IOLBF 1
diff --git a/mdk-stage1/dietlibc/i386/cos.S b/mdk-stage1/dietlibc/i386/cos.S
index 73ba03355..f95c81ca7 100644
--- a/mdk-stage1/dietlibc/i386/cos.S
+++ b/mdk-stage1/dietlibc/i386/cos.S
@@ -7,16 +7,27 @@
cosf:
flds 4(%esp)
- jmp .Lcos
+ jmp 1f
cos:
fldl 4(%esp)
-.Lcos:
- call __fmod2pi
+1:
fcos
- ret
+ fnstsw %ax
+ testb $0x04, %ah
+ je 3f
+ fldpi
+ fadd %st
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testb $0x04, %ah
+ jne 2b
+ fstp %st(1)
+ fcos
+3: ret
cosl:
fldt 4(%esp)
- jmp .Lcos
+ jmp 1b
.Lende:
.size cos,.Lende-cos
diff --git a/mdk-stage1/dietlibc/i386/dyn_syscalls.S b/mdk-stage1/dietlibc/i386/dyn_syscalls.S
index 28d668b6c..c4fd2fff5 100644
--- a/mdk-stage1/dietlibc/i386/dyn_syscalls.S
+++ b/mdk-stage1/dietlibc/i386/dyn_syscalls.S
@@ -59,7 +59,6 @@
/* OK this is basicaly unified.S */
.text
.type __unified_syscall_256,@function
-.global __unified_syscall_256
__unified_syscall_256:
movzwl %ax, %eax
jmp .L23
diff --git a/mdk-stage1/dietlibc/i386/ldexp.S b/mdk-stage1/dietlibc/i386/ldexp.S
index 4429b6e22..51d9bae89 100644
--- a/mdk-stage1/dietlibc/i386/ldexp.S
+++ b/mdk-stage1/dietlibc/i386/ldexp.S
@@ -1,15 +1,28 @@
.text
-.type ldexp,@function
-.global ldexp
+.global ldexpf,ldexp,ldexpl
+ .type ldexpf,@function
+ .type ldexp,@function
+ .type ldexpl,@function
-# double ldexp ( double value, int expo );
+ldexpf:
+ fildl 8(%esp)
+ flds 4(%esp)
+ fscale
+ ret
ldexp:
fildl 12(%esp)
fldl 4(%esp)
fscale
- fstp %st(1)
+ ret
+
+ldexpl:
+ fildl 16(%esp)
+ fldt 4(%esp)
+ fscale
ret
.ende:
-.size ldexp,.ende-ldexp
+.size ldexpl,.ende-ldexpl
+.size ldexp,ldexpl-ldexp
+.size ldexpf,ldexp-ldexpf
diff --git a/mdk-stage1/dietlibc/i386/libm2.S b/mdk-stage1/dietlibc/i386/libm2.S
index 8ad85b7f2..91c4437cd 100644
--- a/mdk-stage1/dietlibc/i386/libm2.S
+++ b/mdk-stage1/dietlibc/i386/libm2.S
@@ -598,29 +598,6 @@ frexpl:
movl 16(%esp),%eax
jmp __frexp
-.global ldexpf,ldexp,ldexpl
- .type ldexpf,@function
- .type ldexp,@function
- .type ldexpl,@function
-
-ldexpf:
- fildl 8(%esp)
- flds 4(%esp)
- fscale
- ret
-
-ldexp:
- fildl 12(%esp)
- fldl 4(%esp)
- fscale
- ret
-
-ldexpl:
- fildl 16(%esp)
- fldt 4(%esp)
- fscale
- ret
-
.global logbf,logb,logbl
.type logbf,@function
.type logb,@function
diff --git a/mdk-stage1/dietlibc/i386/memchr.S b/mdk-stage1/dietlibc/i386/memchr.S
index de01aa47f..7d04f990b 100644
--- a/mdk-stage1/dietlibc/i386/memchr.S
+++ b/mdk-stage1/dietlibc/i386/memchr.S
@@ -8,7 +8,7 @@ memchr:
movl 12(%esp),%eax
movl 16(%esp),%ecx
cld
- jcxz .Lnotfound
+ jecxz .Lnotfound
repne scasb
diff --git a/mdk-stage1/dietlibc/i386/mmap64.S b/mdk-stage1/dietlibc/i386/mmap64.S
index 210fec6ce..421325260 100644
--- a/mdk-stage1/dietlibc/i386/mmap64.S
+++ b/mdk-stage1/dietlibc/i386/mmap64.S
@@ -1,6 +1,13 @@
+#include <dietfeatures.h>
#include <syscalls.h>
#include <errno.h>
+#ifdef __DYN_LIB
+#ifndef WANT_THREAD_SAFE
+#define WANT_THREAD_SAFE
+#endif
+#endif
+
.text
.global mmap64
.type mmap64,@function
@@ -32,7 +39,11 @@ mmap64:
.Lerror:
#ifdef WANT_THREAD_SAFE
movl %eax,%ebx
+#ifdef __DYN_LIB
+ call __errno_location@PLT
+#else
call __errno_location
+#endif
movl %ebx,(%eax)
orl $-1,%eax
#else
diff --git a/mdk-stage1/dietlibc/i386/sin.S b/mdk-stage1/dietlibc/i386/sin.S
index 1c99b2d12..404bf5eed 100644
--- a/mdk-stage1/dietlibc/i386/sin.S
+++ b/mdk-stage1/dietlibc/i386/sin.S
@@ -7,16 +7,26 @@
.type sinl,@function
sinf:
flds 4(%esp)
- jmp __sin
+ jmp 1f
sin:
fldl 4(%esp)
-__sin:
- call __fmod2pi
+1: fsin
+ fnstsw %ax
+ testb $0x04, %ah
+ je 3f
+ fldpi
+ fadd %st
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testb $0x04, %ah
+ jne 2b
+ fstp %st(1)
fsin
- ret
+3: ret
sinl:
fldt 4(%esp)
- jmp __sin
+ jmp 1b
.ende:
.size sin,.ende-sin
diff --git a/mdk-stage1/dietlibc/i386/vfork.S b/mdk-stage1/dietlibc/i386/vfork.S
new file mode 100644
index 000000000..c07c5f6af
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/vfork.S
@@ -0,0 +1,9 @@
+.text
+.globl vfork
+vfork:
+ popl %edx
+ xorl %eax,%eax
+ movb $190, %al
+ int $0x80
+ jmpl *%edx
+.size vfork, . - vfork
diff --git a/mdk-stage1/dietlibc/ia64/msgctl.S b/mdk-stage1/dietlibc/ia64/msgctl.S
new file mode 100644
index 000000000..d7caed2cc
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/ia64/msgget.S b/mdk-stage1/dietlibc/ia64/msgget.S
new file mode 100644
index 000000000..518d67ac4
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/ia64/msgrcv.S b/mdk-stage1/dietlibc/ia64/msgrcv.S
new file mode 100644
index 000000000..ab62e6c30
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgrcv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/ia64/msgsnd.S b/mdk-stage1/dietlibc/ia64/msgsnd.S
new file mode 100644
index 000000000..890a996a2
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgsnd.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/ia64/semctl.S b/mdk-stage1/dietlibc/ia64/semctl.S
new file mode 100644
index 000000000..e215ed955
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/ia64/semget.S b/mdk-stage1/dietlibc/ia64/semget.S
new file mode 100644
index 000000000..67f488546
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/ia64/semop.S b/mdk-stage1/dietlibc/ia64/semop.S
new file mode 100644
index 000000000..81b6fc606
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semop.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/ia64/shmat.S b/mdk-stage1/dietlibc/ia64/shmat.S
new file mode 100644
index 000000000..51248173d
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmat.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/ia64/shmctl.S b/mdk-stage1/dietlibc/ia64/shmctl.S
new file mode 100644
index 000000000..d56caace4
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/ia64/shmdt.S b/mdk-stage1/dietlibc/ia64/shmdt.S
new file mode 100644
index 000000000..d9812a799
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmdt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/ia64/shmget.S b/mdk-stage1/dietlibc/ia64/shmget.S
new file mode 100644
index 000000000..82914223f
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/include/assert.h b/mdk-stage1/dietlibc/include/assert.h
index b135369b8..a8ce3ce87 100644
--- a/mdk-stage1/dietlibc/include/assert.h
+++ b/mdk-stage1/dietlibc/include/assert.h
@@ -22,10 +22,17 @@ extern void __assert_fail (const char *__assertion, const char *__file,
#ifdef NDEBUG
#define assert(expr)
#else
+#ifdef expect
+# define assert(expr) \
+ ((void) (expect((long)(expr),0) ? 0 : \
+ (__assert_fail (#expr, \
+ __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
+#else
# define assert(expr) \
((void) ((expr) ? 0 : \
(__assert_fail (#expr, \
__FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
#endif
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/dirent.h b/mdk-stage1/dietlibc/include/dirent.h
index 636ebc2b0..ad8b3a41a 100644
--- a/mdk-stage1/dietlibc/include/dirent.h
+++ b/mdk-stage1/dietlibc/include/dirent.h
@@ -41,8 +41,12 @@ long int telldir (DIR *__dirp) __THROW;
int scandir(const char *dir, struct dirent ***namelist,
int (*selection)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **)) __THROW;
+int scandir64(const char *dir, struct dirent64 ***namelist,
+ int (*selection)(const struct dirent64 *),
+ int (*compar)(const struct dirent64 **, const struct dirent64 **)) __THROW;
int alphasort(const struct dirent **a, const struct dirent **b) __THROW __attribute__((const));
+int alphasort64(const struct dirent64 **a, const struct dirent64 **b) __THROW __attribute__((const));
#define MAXNAMLEN NAME_MAX
@@ -53,6 +57,8 @@ extern int dirfd(DIR *dirp) __THROW;
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define dirent dirent64
#define readdir readdir64
+#define scandir scandir64
+#define alphasort alphasort64
#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/dlfcn.h b/mdk-stage1/dietlibc/include/dlfcn.h
index 5195cc41f..0ddcafdba 100644
--- a/mdk-stage1/dietlibc/include/dlfcn.h
+++ b/mdk-stage1/dietlibc/include/dlfcn.h
@@ -8,6 +8,7 @@
#define RTLD_GLOBAL 0x10000
#define RTLD_DEFAULT ((void*)1)
+#define RTLD_NEXT ((void*)2)
void *dlopen (const char *filename, int flag);
const char *dlerror(void);
diff --git a/mdk-stage1/dietlibc/include/linux/eventpoll.h b/mdk-stage1/dietlibc/include/linux/eventpoll.h
new file mode 100644
index 000000000..19990ac2a
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/eventpoll.h
@@ -0,0 +1,17 @@
+#ifndef _LINUX_EVENTPOLL_H
+#define _LINUX_EVENTPOLL_H
+
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/shm.h>
+
+#define POLLFD_X_PAGE (PAGE_SIZE / sizeof(struct pollfd))
+#define EP_FDS_PAGES(n) (((n) + POLLFD_X_PAGE - 1) / POLLFD_X_PAGE)
+#define EP_MAP_SIZE(n) (EP_FDS_PAGES(n) * PAGE_SIZE * 2)
+
+struct evpoll {
+ int ep_timeout;
+ unsigned long ep_resoff;
+};
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h
index 65f968755..fdc0518cf 100644
--- a/mdk-stage1/dietlibc/include/signal.h
+++ b/mdk-stage1/dietlibc/include/signal.h
@@ -168,7 +168,7 @@
#define SA_RESTART SV_INTR
#define SA_RESETHAND SV_RESET
#define SA_INTERRUPT 0x10
-#define SA_DEFER 0x20
+#define SA_NODEFER 0x20
#define SA_SHIRQ 0x40
#define SA_NOCLDWAIT 0x100 /* not supported yet */
#define SA_SIGINFO 0x200
diff --git a/mdk-stage1/dietlibc/include/stdarg-cruft.h b/mdk-stage1/dietlibc/include/stdarg-cruft.h
index c25973fe8..fbd9e0ca4 100644
--- a/mdk-stage1/dietlibc/include/stdarg-cruft.h
+++ b/mdk-stage1/dietlibc/include/stdarg-cruft.h
@@ -1,4 +1,4 @@
-#if defined(__sparc__) || defined(__alpha__)
+#if defined(__sparc__) || defined(__alpha__) || defined(__mips__)
enum {
__no_type_class = -1,
__void_type_class,
diff --git a/mdk-stage1/dietlibc/include/string.h b/mdk-stage1/dietlibc/include/string.h
index bc81f2ac3..4c56bf8bb 100644
--- a/mdk-stage1/dietlibc/include/string.h
+++ b/mdk-stage1/dietlibc/include/string.h
@@ -62,6 +62,8 @@ char *strerror(int errnum) __THROW;
#ifdef _GNU_SOURCE
const char *strsignal(int signum) __THROW;
void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) __THROW;
+
+char *strndup(const char *s,size_t n) __attribute_malloc__ __THROW;
#endif
char *strtok(char *s, const char *delim) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/ioctl.h b/mdk-stage1/dietlibc/include/sys/ioctl.h
index 630abc515..a7890f038 100644
--- a/mdk-stage1/dietlibc/include/sys/ioctl.h
+++ b/mdk-stage1/dietlibc/include/sys/ioctl.h
@@ -21,6 +21,12 @@
#include <sys/hppa-ioctl.h>
#endif
+/* used for /dev/epoll */
+#define EP_ALLOC _IOR('P', 1, int)
+#define EP_POLL _IOWR('P', 2, struct evpoll)
+#define EP_FREE _IO('P', 3)
+#define EP_ISPOLLED _IOWR('P', 4, struct pollfd)
+
int ioctl(int d, int request, ...) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/poll.h b/mdk-stage1/dietlibc/include/sys/poll.h
index d17f6422c..fe36df79d 100644
--- a/mdk-stage1/dietlibc/include/sys/poll.h
+++ b/mdk-stage1/dietlibc/include/sys/poll.h
@@ -3,19 +3,32 @@
#include <sys/cdefs.h>
-#define POLLIN 0x0001
-#define POLLPRI 0x0002
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRBAND 0x0200
-#define POLLMSG 0x0400
+enum {
+ POLLIN = 0x0001,
+#define POLLIN POLLIN
+ POLLPRI = 0x0002,
+#define POLLPRI POLLPRI
+ POLLOUT = 0x0004,
+#define POLLOUT POLLOUT
+ POLLERR = 0x0008,
+#define POLLERR POLLERR
+ POLLHUP = 0x0010,
+#define POLLHUP POLLHUP
+ POLLNVAL = 0x0020,
+#define POLLNVAL POLLNVAL
+ POLLRDNORM = 0x0040,
+#define POLLRDNORM POLLRDNORM
+ POLLRDBAND = 0x0080,
+#define POLLRDBAND POLLRDBAND
+ POLLWRBAND = 0x0200,
+#define POLLWRBAND POLLWRBAND
+ POLLMSG = 0x0400,
+#define POLLMSG POLLMSG
/* POLLREMOVE is for /dev/epoll (/dev/misc/eventpoll),
* a new event notification mechanism for 2.6 */
-#define POLLREMOVE 0x1000
+ POLLREMOVE = 0x1000,
+#define POLLREMOVE POLLREMOVE
+};
#if defined(__sparc__) || defined (__mips__)
#define POLLWRNORM POLLOUT
@@ -31,5 +44,4 @@ struct pollfd {
extern int poll(struct pollfd *ufds, unsigned int nfds, int timeout) __THROW;
-
#endif /* _SYS_POLL_H */
diff --git a/mdk-stage1/dietlibc/include/sys/time.h b/mdk-stage1/dietlibc/include/sys/time.h
index 8d345a77d..9fc40089f 100644
--- a/mdk-stage1/dietlibc/include/sys/time.h
+++ b/mdk-stage1/dietlibc/include/sys/time.h
@@ -46,6 +46,8 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
int gettimeofday(struct timeval *tv, struct timezone *tz) __THROW;
int settimeofday(const struct timeval *tv , const struct timezone *tz) __THROW;
+extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW;
+
extern int adjtime (const struct timeval *delta, struct timeval *olddelta) __THROW;
struct tm {
diff --git a/mdk-stage1/dietlibc/include/sys/types.h b/mdk-stage1/dietlibc/include/sys/types.h
index eadc1bb65..a3d2bf4be 100644
--- a/mdk-stage1/dietlibc/include/sys/types.h
+++ b/mdk-stage1/dietlibc/include/sys/types.h
@@ -41,7 +41,7 @@ typedef unsigned long int clock_t; /* Used for system times in
Used for timer ID returned by timer_create().
*/
-#if defined(__alpha__) || defined(__mips__) || defined(__ppc__) || defined(__hppa__) || defined(__sparc64__) \
+#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__hppa__) || defined(__sparc64__) \
|| defined(__x86_64__) || defined(__ia64__)
typedef unsigned int uid_t; /* Used for user IDs. */
typedef unsigned int gid_t; /* Used for group IDs. */
@@ -52,7 +52,7 @@ typedef unsigned short gid_t; /* Used for group IDs. */
typedef unsigned short dev_t; /* Used for device IDs. */
#endif
-#if defined(__alpha__) || defined(__mips__) || defined(__ppc__) || defined(__sparc64__) \
+#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__sparc64__) \
|| defined(__x86_64__) || defined(__ia64__)
typedef unsigned int mode_t; /* Used for some file attributes. */
#else
diff --git a/mdk-stage1/dietlibc/include/sys/vfs.h b/mdk-stage1/dietlibc/include/sys/vfs.h
index cf7e7f946..19b3242bb 100644
--- a/mdk-stage1/dietlibc/include/sys/vfs.h
+++ b/mdk-stage1/dietlibc/include/sys/vfs.h
@@ -11,6 +11,9 @@ typedef struct {
struct statfs {
long f_type;
long f_bsize;
+#ifdef __mips__
+ long f_frsize;
+#endif
long f_blocks;
long f_bfree;
#ifndef __mips__
diff --git a/mdk-stage1/dietlibc/include/termios.h b/mdk-stage1/dietlibc/include/termios.h
index c9998595c..12e02c5d7 100644
--- a/mdk-stage1/dietlibc/include/termios.h
+++ b/mdk-stage1/dietlibc/include/termios.h
@@ -76,6 +76,8 @@ typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
+#define _POSIX_VDISABLE '\0'
+
#if defined(__i386__) || defined(__arm__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) || defined(__s390x__) || defined(__x86_64__)
#define NCCS 19
struct termios {
diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h
index 0f49b2b9b..2fba5d584 100644
--- a/mdk-stage1/dietlibc/include/unistd.h
+++ b/mdk-stage1/dietlibc/include/unistd.h
@@ -34,10 +34,10 @@ extern int access (const char *__name, int __type) __THROW;
off_t lseek(int fildes, off_t offset, int whence) __THROW;
#ifndef __NO_STAT64
loff_t lseek64(int fildes, loff_t offset, int whence) __THROW;
-#endif
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define lseek(fildes,offset,whence) lseek64(fildes,offset,whence)
#endif
+#endif
int chdir(const char *path) __THROW;
int fchdir(int fd) __THROW;
@@ -182,6 +182,7 @@ int _sysctl(struct __sysctl_args *args) __THROW;
#define _SC_CLK_TCK 1
#define _SC_ARG_MAX 2
+#define _SC_NGROUPS_MAX 3
#define _SC_OPEN_MAX 4
#define _SC_PAGESIZE 5
#define _SC_NPROCESSORS_ONLN 6
diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c
index f54bde22b..580258936 100644
--- a/mdk-stage1/dietlibc/lib/__dtostr.c
+++ b/mdk-stage1/dietlibc/lib/__dtostr.c
@@ -1,7 +1,16 @@
#include <stdlib.h>
#include <endian.h>
+#include <math.h>
/* convert double to string. Helper for sprintf. */
+static int copystring(char* buf,int maxlen, const char* s) {
+ int i;
+ for (i=0; i<3&&i<maxlen; ++i)
+ buf[i]=s[i];
+ if (i<maxlen) { buf[i]=0; ++i; }
+ return i;
+}
+
int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2) {
#if 1
unsigned long long *x=(unsigned long long *)&d;
@@ -16,13 +25,16 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i
#endif
/* unsigned long long m=*x & ((1ull<<52)-1); */
/* step 2: exponent is base 2, compute exponent for base 10 */
- signed long e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
+ signed long e10;
/* step 3: calculate 10^e10 */
unsigned int i;
double backup=d;
double tmp;
char *oldbuf=buf;
+ if (isnan(d)) return copystring(buf,maxlen,"nan");
+ if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf");
+ e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
/* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht
* ist. Wenn maxlen erreicht ist, machen wir das nochmal in
* scientific notation. Wenn dann von prec noch was übrig ist, geben
@@ -37,7 +49,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i
return i;
}
- if (d < 0.0) { d=-d; *buf='-'; --maxlen; buf++; }
+ if (d < 0.0) { d=-d; *buf='-'; --maxlen; ++buf; }
/*
Perform rounding. It needs to be done before we generate any
@@ -48,6 +60,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i
for (i = 0; i < prec2; i++) { tmp *= 0.1; }
d += tmp;
+ if (d < 1.0) { *buf='0'; --maxlen; ++buf; }
/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */
if (e10>0) {
int first=1; /* are we about to write the first digit? */
diff --git a/mdk-stage1/dietlibc/lib/__isinf.c b/mdk-stage1/dietlibc/lib/__isinf.c
new file mode 100644
index 000000000..359bd2709
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__isinf.c
@@ -0,0 +1,15 @@
+#include <math.h>
+
+int isinf(double d) {
+ unsigned long long *x=(unsigned long long *)&d;
+ return (*x==0x7FF0000000000000ll?1:*x==0xFFF0000000000000?-1:0);
+}
+int __isinf(double d) __attribute__((alias("isinf")));
+
+#if 0
+TestFromIeeeExtended("7FFF0000000000000000"); /* +infinity */
+TestFromIeeeExtended("FFFF0000000000000000"); /* -infinity */
+TestFromIeeeExtended("7FFF8001000000000000"); /* Quiet NaN(1) */
+TestFromIeeeExtended("7FFF0001000000000000"); /* Signalling NaN(1) */
+TestFromIeeeExtended("3FFFFEDCBA9876543210"); /* accuracy test */
+#endif
diff --git a/mdk-stage1/dietlibc/lib/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c
index 20e44dd46..de74b8a9f 100644
--- a/mdk-stage1/dietlibc/lib/__isnan.c
+++ b/mdk-stage1/dietlibc/lib/__isnan.c
@@ -2,7 +2,7 @@
int isnan(double d) {
unsigned long long *x=(unsigned long long *)&d;
- return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000);
+ return (*x==0x7FF8000000000000ll || *x==0x7FF0000000000000 || *x==0xfff8000000000000);
}
int __isnan(double d) __attribute__((alias("isnan")));
diff --git a/mdk-stage1/dietlibc/lib/__v_printf.c b/mdk-stage1/dietlibc/lib/__v_printf.c
index e27c63788..15011cdd8 100644
--- a/mdk-stage1/dietlibc/lib/__v_printf.c
+++ b/mdk-stage1/dietlibc/lib/__v_printf.c
@@ -182,6 +182,7 @@ print_out:
case 'x':
base=16;
sz=0;
+ if (flag_dot) width=preci;
if (flag_hash) {
buf[1]='0';
buf[2]=ch;
diff --git a/mdk-stage1/dietlibc/lib/signal.c b/mdk-stage1/dietlibc/lib/signal.c
index eb3672c68..51441558e 100644
--- a/mdk-stage1/dietlibc/lib/signal.c
+++ b/mdk-stage1/dietlibc/lib/signal.c
@@ -5,7 +5,7 @@ sighandler_t signal(int signum, sighandler_t action) {
sa.sa_handler=action;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask,signum);
- sa.sa_flags=SA_RESTART|SA_NODEFER;
+ sa.sa_flags=SA_NODEFER;
if (sigaction(signum,&sa,&oa))
return SIG_ERR;
return oa.sa_handler;
diff --git a/mdk-stage1/dietlibc/lib/strerror.c b/mdk-stage1/dietlibc/lib/strerror.c
index f3ef07334..7cb79d988 100644
--- a/mdk-stage1/dietlibc/lib/strerror.c
+++ b/mdk-stage1/dietlibc/lib/strerror.c
@@ -5,13 +5,16 @@
#define _BSD_SOURCE
#include <errno.h>
-extern const char __sys_err_unknown [];
+extern const char __sys_err_unknown[];
-char* strerror ( int errnum )
-{
- register const char* message = __sys_err_unknown;
+char*strerror(int errnum) {
+ register const char*message=__sys_err_unknown;
if ( (unsigned int)errnum < (unsigned int)__SYS_NERR )
- message = sys_errlist [errnum];
+ message=sys_errlist[errnum];
+#if defined(__mips__)
+ if ( errnum == 1133 )
+ message="Quota exceeded";
+#endif
return (char*)message;
}
diff --git a/mdk-stage1/dietlibc/libcruft/alphasort64.c b/mdk-stage1/dietlibc/libcruft/alphasort64.c
new file mode 100644
index 000000000..520086352
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/alphasort64.c
@@ -0,0 +1,6 @@
+#include <dirent.h>
+#include <string.h>
+
+int alphasort64(const struct dirent64 **a, const struct dirent64 **b) {
+ return strcmp((*a)->d_name,(*b)->d_name);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/scandir64.c b/mdk-stage1/dietlibc/libcruft/scandir64.c
new file mode 100644
index 000000000..c1bdc3415
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/scandir64.c
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+
+int scandir64(const char *dir, struct dirent64 ***namelist,
+ int (*select)(const struct dirent64 *),
+ int (*compar)(const struct dirent64 **, const struct dirent64 **)) {
+ DIR* d;
+ struct dirent64 *D;
+ int num=0;
+ if (!(d=opendir(dir)))
+ return -1;
+ *namelist=0;
+ while ((D=readdir64(d))) {
+ if (select==0 || select(D)) {
+ struct dirent64 **tmp;
+ ++num;
+/* printf("realloc %p,%d -> ",*namelist,num*sizeof(struct dirent**)); */
+ if (!(tmp=realloc(*namelist,num*sizeof(struct dirent64**))) ||
+ !(tmp[num-1]=malloc(sizeof(struct dirent64)))) {
+ int i;
+ for (i=0; i<num-1; ++i) free(tmp[i]);
+ free(*namelist);
+ closedir(d);
+ return -1;
+ }
+ memccpy(tmp[num-1]->d_name,D->d_name,0,NAME_MAX);
+ *namelist=tmp;
+/* printf("%p; tmp[num-1(%d)]=%p\n",*namelist,num-1,tmp[num-1]); */
+ }
+ }
+ closedir(d);
+#if 0
+ {
+ int i;
+ puts("pre-qsort:\n");
+ for (i=0; i<num-1; ++i) {
+ puts((*namelist)[i]->d_name);
+ }
+ puts("post-qsort:\n");
+ }
+#endif
+// qsort(&(*namelist)[0],num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar));
+ if (compar)
+ qsort(*namelist,num,sizeof(struct dirent64*),(int (*)(const void*,const void*))(compar));
+ return num;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/sysconf.c b/mdk-stage1/dietlibc/libcruft/sysconf.c
index 8e36ec4e9..e9c15cb66 100644
--- a/mdk-stage1/dietlibc/libcruft/sysconf.c
+++ b/mdk-stage1/dietlibc/libcruft/sysconf.c
@@ -32,6 +32,9 @@ long sysconf(int name)
case _SC_ARG_MAX:
return ARG_MAX;
+ case _SC_NGROUPS_MAX:
+ return NGROUPS_MAX;
+
case _SC_NPROCESSORS_ONLN:
return __sc_nr_cpus();
diff --git a/mdk-stage1/dietlibc/libregex/rx.c b/mdk-stage1/dietlibc/libregex/rx.c
index 752d7f11b..9bab3e22c 100644
--- a/mdk-stage1/dietlibc/libregex/rx.c
+++ b/mdk-stage1/dietlibc/libregex/rx.c
@@ -468,10 +468,9 @@ int regexec(const regex_t*__restrict__ preg, const char*__restrict__ string, siz
void regfree(regex_t* preg) {
int i;
- for (i=0; i<preg->r.num; ++i) {
+ for (i=0; i<preg->r.num; ++i)
free(preg->r.b[i].p);
free(preg->r.b);
- }
}
size_t regerror(int errcode, const regex_t*__restrict__ preg, char*__restrict__ errbuf, size_t errbuf_size) {
diff --git a/mdk-stage1/dietlibc/libshell/glob.c b/mdk-stage1/dietlibc/libshell/glob.c
index deb61473c..def55f8dc 100644
--- a/mdk-stage1/dietlibc/libshell/glob.c
+++ b/mdk-stage1/dietlibc/libshell/glob.c
@@ -68,17 +68,16 @@ static int add_entry(const char* name,glob_t *pglob,int* nfound) {
return 0;
}
-static void build_fullname(char * fullname, int fullnamesize, const char * directory, const char * filename) {
+static void build_fullname(char * fullname, const char * directory, const char * filename) {
char *dest=fullname;
- char *max=fullname+fullnamesize-1;
if (directory[0]=='/' && !directory[1]) {
*dest='/'; ++dest;
} else if (directory[0]!='.' || directory[1]) {
- strncpy(dest,directory,max-dest);
- dest+=strlen(dest);
+ strcpy(dest,directory);
+ dest=strchr(dest,0);
*dest='/'; ++dest;
}
- strncpy(dest,filename,max-dest);
+ strcpy(dest,filename);
}
static int glob_in_dir(const char *pattern, const char *directory, int flags,
@@ -103,7 +102,7 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
while ((ep = readdir(dp))) {
i = strlen(directory) + strlen(ep->d_name) + 2;
ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, ep->d_name);
+ build_fullname(ptr, directory, ep->d_name);
if (flags & GLOB_ONLYDIR) {
struct stat statr;
if (stat(ptr, &statr) || !S_ISDIR(statr.st_mode))
@@ -123,7 +122,7 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
/* nfound == 0 */
i = strlen(directory) + strlen(pattern) + 2;
ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, pattern);
+ build_fullname(ptr, directory, pattern);
if (add_entry(ptr,pglob,&nfound))
goto memory_error;
}
@@ -300,13 +299,13 @@ int glob(const char *pattern, int flags, int errfunc(const char * epath, int eer
}
/* okay now we add the new entry */
- k = strlen(dirs.gl_pathv[i]) + 1 + strlen(filename) + 1;
+ k = strlen(dirs.gl_pathv[i]) + strlen(filename) + 2;
if ((pglob->gl_pathv[j] = malloc(k)) == NULL) {
globfree(&dirs);
globfree(pglob);
return GLOB_NOSPACE;
}
- build_fullname(pglob->gl_pathv[j], k, dirs.gl_pathv[i], filename);
+ build_fullname(pglob->gl_pathv[j], dirs.gl_pathv[i], filename);
pglob->gl_pathc++;
pglob->gl_pathv[j+1] = NULL;
}
diff --git a/mdk-stage1/dietlibc/libstdio/fdglue2.c b/mdk-stage1/dietlibc/libstdio/fdglue2.c
index a76d4698d..b96e4c5b8 100644
--- a/mdk-stage1/dietlibc/libstdio/fdglue2.c
+++ b/mdk-stage1/dietlibc/libstdio/fdglue2.c
@@ -1,5 +1,6 @@
#include <unistd.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include <errno.h>
#include "dietstdio.h"
#include <stdlib.h>
@@ -23,7 +24,12 @@ err_out:
tmp->bm=0;
tmp->bs=0;
tmp->buflen=BUFSIZE;
- tmp->flags=0;
+ {
+ struct stat st;
+ fstat(fd,&st);
+ tmp->flags=(S_ISFIFO(st.st_mode))?FDPIPE:0;
+ }
+ tmp->popen_kludge=0;
if (__stdio_atexit==0) {
__stdio_atexit=1;
atexit(__stdio_flushall);
diff --git a/mdk-stage1/dietlibc/libstdio/fflush.c b/mdk-stage1/dietlibc/libstdio/fflush.c
index 6f2003702..e0e23b3ba 100644
--- a/mdk-stage1/dietlibc/libstdio/fflush.c
+++ b/mdk-stage1/dietlibc/libstdio/fflush.c
@@ -58,7 +58,7 @@ int __fflush4(FILE *stream,int next) {
* This is defined here because of the weak symbol ELF semantics */
int __stdio_outs(const char *s,size_t len);
int __stdio_outs(const char *s,size_t len) {
- return fwrite(s,1,(size_t)len,stdout);
+ return fwrite(s,1,(size_t)len,stdout)==len?1:0;
}
link_warning("fflush","warning: your code uses stdio (7+k bloat).")
diff --git a/mdk-stage1/dietlibc/libstdio/fread.c b/mdk-stage1/dietlibc/libstdio/fread.c
index 63ad4c2bc..813a98fb2 100644
--- a/mdk-stage1/dietlibc/libstdio/fread.c
+++ b/mdk-stage1/dietlibc/libstdio/fread.c
@@ -17,7 +17,7 @@ size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) {
if (!j) return 1;
#ifdef WANT_FREAD_OPTIMIZATION
- if (j>stream->buflen) {
+ if ( !(stream->flags&FDPIPE) && (j>stream->buflen)) {
size_t tmp=j-i;
int res;
fflush(stream);
diff --git a/mdk-stage1/dietlibc/libugly/strftime.c b/mdk-stage1/dietlibc/libugly/strftime.c
index 7fd608720..365d0c84f 100644
--- a/mdk-stage1/dietlibc/libugly/strftime.c
+++ b/mdk-stage1/dietlibc/libugly/strftime.c
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <time.h>
+#include "dietfeatures.h"
static const char sweekdays [7] [4] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
@@ -79,7 +80,13 @@ again:
case 'w': no = tm->tm_wday; goto _no;
case 'U': no = (tm->tm_yday - tm->tm_wday + 7) / 7; goto _no;
case 'W': no = (tm->tm_yday - (tm->tm_wday - 1 + 7) % 7 + 7) / 7; goto _no;
- case 'Z': tzset(); src = tzname[0]; goto _str;
+ case 'Z':
+#ifdef WANT_TZFILE_PARSER
+ tzset(); src = tzname[0];
+#else
+ src = "[unknown timezone]";
+#endif
+ goto _str;
case 'Y': i2a ( buf+0, (unsigned int)(tm->tm_year / 100 + 19) );
i2a ( buf+2, (unsigned int)(tm->tm_year % 100) );
src = buf;
diff --git a/mdk-stage1/dietlibc/libugly/strndup.c b/mdk-stage1/dietlibc/libugly/strndup.c
new file mode 100644
index 000000000..7f912d4c6
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/strndup.c
@@ -0,0 +1,10 @@
+#include <string.h>
+#include <stdlib.h>
+
+char *strndup(const char *s,size_t n) {
+ char *tmp=(char *)malloc(n+1);
+ if (!tmp) return 0;
+ strncpy(tmp,s,n);
+ tmp[n]=0;
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libugly/tzfile.c b/mdk-stage1/dietlibc/libugly/tzfile.c
index aca613e56..e0e8f7846 100644
--- a/mdk-stage1/dietlibc/libugly/tzfile.c
+++ b/mdk-stage1/dietlibc/libugly/tzfile.c
@@ -7,7 +7,7 @@
/* #include <stdio.h> */
-char* tzname[2];
+char* tzname[2]={"GMT","GMT"};
#ifdef WANT_TZFILE_PARSER
static char *tzfile=0;
diff --git a/mdk-stage1/dietlibc/sparc/Makefile.add b/mdk-stage1/dietlibc/sparc/Makefile.add
index 0de05b1db..102175bc5 100644
--- a/mdk-stage1/dietlibc/sparc/Makefile.add
+++ b/mdk-stage1/dietlibc/sparc/Makefile.add
@@ -1,3 +1,4 @@
CFLAGS+=-mcpu=supersparc -Os
VPATH:=sparc:syscalls.s:$(VPATH)
+LIBOBJ+=$(OBJDIR)/udiv.o $(OBJDIR)/umul.o $(OBJDIR)/urem.o
diff --git a/mdk-stage1/dietlibc/sparc/errlist.S b/mdk-stage1/dietlibc/sparc/errlist.S
new file mode 100644
index 000000000..c23f7b3d5
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/errlist.S
@@ -0,0 +1,280 @@
+#ifdef __DYN_LIB
+.section .data
+#else
+.section .rodata
+#endif
+
+.align 4
+.global sys_errlist
+.type sys_errlist,@object
+sys_errlist:
+ .long .LC000
+ .long .LC001
+ .long .LC002
+ .long .LC003
+ .long .LC004
+ .long .LC005
+ .long .LC006
+ .long .LC007
+ .long .LC008
+ .long .LC009
+ .long .LC010
+ .long .LC011
+ .long .LC012
+ .long .LC013
+ .long .LC014
+ .long .LC015
+ .long .LC016
+ .long .LC017
+ .long .LC018
+ .long .LC019
+ .long .LC020
+ .long .LC021
+ .long .LC022
+ .long .LC023
+ .long .LC024
+ .long .LC025
+ .long .LC026
+ .long .LC027
+ .long .LC028
+ .long .LC029
+ .long .LC030
+ .long .LC031
+ .long .LC032
+ .long .LC033
+ .long .LC034
+ .long .LC035
+ .long .LC036
+ .long .LC037
+ .long .LC038
+ .long .LC039
+ .long .LC040
+ .long .LC041
+ .long .LC042
+ .long .LC043
+ .long .LC044
+ .long .LC045
+ .long .LC046
+ .long .LC047
+ .long .LC048
+ .long .LC049
+ .long .LC050
+ .long .LC051
+ .long .LC052
+ .long .LC053
+ .long .LC054
+ .long .LC055
+ .long .LC056
+ .long .LC057
+ .long .LC058
+ .long .LC059
+ .long .LC060
+ .long .LC061
+ .long .LC062
+ .long .LC063
+ .long .LC064
+ .long .LC065
+ .long .LC066
+ .long .LC067
+ .long .LC068
+ .long .LC069
+ .long .LC070
+ .long .LC071
+ .long .LC072
+ .long .LC073
+ .long .LC074
+ .long .LC075
+ .long .LC076
+ .long .LC077
+ .long .LC078
+ .long .LC079
+ .long .LC080
+ .long .LC081
+ .long .LC082
+ .long .LC083
+ .long .LC084
+ .long .LC085
+ .long .LC086
+ .long .LC087
+ .long .LC088
+ .long .LC089
+ .long .LC090
+ .long .LC091
+ .long .LC092
+ .long .LC093
+ .long .LC094
+ .long .LC095
+ .long .LC096
+ .long .LC097
+ .long .LC098
+ .long .LC099
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC120
+ .long .LC121
+ .long .LC122
+ .long .LC123
+ .long .LC124
+ .long .LC125
+ .long .LC126
+ .long 0
+.size sys_errlist,.-sys_errlist
+
+.align 4
+.global sys_nerr
+.type sys_nerr,@object
+sys_nerr:
+ .long 127
+.size sys_nerr,4
+
+#ifdef __DYN_LIB
+.section .rodata
+#endif
+
+.LC000: .string "Success"
+.LC001: .string "Operation not permitted"
+.LC002: .string "No such file or directory"
+.LC003: .string "No such process"
+.LC004: .string "Interrupted system call"
+.LC005: .string "I/O error"
+.LC006: .string "No such device or address"
+.LC007: .string "Arg list too long"
+.LC008: .string "Exec format error"
+.LC009: .string "Bad file number"
+.LC010: .string "No child processes"
+.LC011: .string "Try again"
+.LC012: .string "Out of memory"
+.LC013: .string "Permission denied"
+.LC014: .string "Bad address"
+.LC015: .string "Block device required"
+.LC016: .string "Device or resource busy"
+.LC017: .string "File exists"
+.LC018: .string "Cross-device link"
+.LC019: .string "No such device"
+.LC020: .string "Not a directory"
+.LC021: .string "Is a directory"
+.LC022: .string "Invalid argument"
+.LC023: .string "File table overflow"
+.LC024: .string "Too many open files"
+.LC025: .string "Not a typewriter"
+.LC026: .string "Text file busy"
+.LC027: .string "File too large"
+.LC028: .string "No space left on device"
+.LC029: .string "Illegal seek"
+.LC030: .string "Read-only file system"
+.LC031: .string "Too many links"
+.LC032: .string "Broken pipe"
+.LC033: .string "Math argument out of domain of func"
+.LC034: .string "Math result not representable"
+.LC035: .string "Operation would block"
+.LC036: .string "Operation now in progress"
+.LC037: .string "Operation already in progress"
+.LC038: .string "Socket operation on non-socket"
+.LC039: .string "Destination address required"
+.LC040: .string "Message too long"
+.LC041: .string "Protocol wrong type for socket"
+.LC042: .string "Protocol not available"
+.LC043: .string "Protocol not supported"
+.LC044: .string "Socket type not supported"
+.LC045: .string "Op not supported on transport endpoint"
+.LC046: .string "Protocol family not supported"
+.LC047: .string "Address family not supported by protocol"
+.LC048: .string "Address already in use"
+.LC049: .string "Cannot assign requested address"
+.LC050: .string "Network is down"
+.LC051: .string "Network is unreachable"
+.LC052: .string "Net dropped connection because of reset"
+.LC053: .string "Software caused connection abort"
+.LC054: .string "Connection reset by peer"
+.LC055: .string "No buffer space available"
+.LC056: .string "Transport endpoint is already connected"
+.LC057: .string "Transport endpoint is not connected"
+.LC058: .string "No send after transport endpoint shutdown"
+.LC059: .string "Too many references: cannot splice"
+.LC060: .string "Connection timed out"
+.LC061: .string "Connection refused"
+.LC062: .string "Too many symbolic links encountered"
+.LC063: .string "File name too long"
+.LC064: .string "Host is down"
+.LC065: .string "No route to host"
+.LC066: .string "Directory not empty"
+.LC067: .string "SUNOS: Too many processes"
+.LC068: .string "Too many users"
+.LC069: .string "Quota exceeded"
+.LC070: .string "Stale NFS file handle"
+.LC071: .string "Object is remote"
+.LC072: .string "Device not a stream"
+.LC073: .string "Timer expired"
+.LC074: .string "Out of streams resources"
+.LC075: .string "No message of desired type"
+.LC076: .string "Not a data message"
+.LC077: .string "Identifier removed"
+.LC078: .string "Resource deadlock would occur"
+.LC079: .string "No record locks available"
+.LC080: .string "Machine is not on the network"
+.LC081: .string "SunOS: Too many lvls of remote in path"
+.LC082: .string "Link has been severed"
+.LC083: .string "Advertise error"
+.LC084: .string "Srmount error"
+.LC085: .string "Communication error on send"
+.LC086: .string "Protocol error"
+.LC087: .string "Multihop attempted"
+.LC088: .string "RFS specific error"
+.LC089: .string "Remote address changed"
+.LC090: .string "Function not implemented"
+.LC091: .string "Streams pipe error"
+.LC092: .string "Value too large for defined data type"
+.LC093: .string "File descriptor in bad state"
+.LC094: .string "Channel number out of range"
+.LC095: .string "Level 2 not synchronized"
+.LC096: .string "Level 3 halted"
+.LC097: .string "Level 3 reset"
+.LC098: .string "Link number out of range"
+.LC099: .string "Protocol driver not attached"
+.LC100: .string "No CSI structure available"
+.LC101: .string "Level 2 halted"
+.LC102: .string "Invalid exchange"
+.LC103: .string "Invalid request descriptor"
+.LC104: .string "Exchange full"
+.LC105: .string "No anode"
+.LC106: .string "Invalid request code"
+.LC107: .string "Invalid slot"
+.LC108: .string "File locking deadlock error"
+.LC109: .string "Bad font file format"
+.LC110: .string "Cannot exec a shared library directly"
+.LC111: .string "No data available"
+.LC112: .string "Accessing a corrupted shared library"
+.LC113: .string "Package not installed"
+.LC114: .string "Can not access a needed shared library"
+.LC115: .string "Name not unique on network"
+.LC116: .string "Interrupted syscall should be restarted"
+.LC117: .string "Structure needs cleaning"
+.LC118: .string "Not a XENIX named type file"
+.LC119: .string "No XENIX semaphores available"
+.LC120: .string "Is a named type file"
+.LC121: .string "Remote I/O error"
+.LC122: .string "Illegal byte sequence"
+.LC123: .string "Atmpt to link in too many shared libs"
+.LC124: .string ".lib section in a.out corrupted"
+.LC125: .string "No medium found"
+.LC126: .string "Wrong medium type"
+
+
diff --git a/mdk-stage1/dietlibc/sparc/udiv.S b/mdk-stage1/dietlibc/sparc/udiv.S
index 87479e7bd..fe8d04969 100644
--- a/mdk-stage1/dietlibc/sparc/udiv.S
+++ b/mdk-stage1/dietlibc/sparc/udiv.S
@@ -48,8 +48,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -70,11 +68,11 @@ ENTRY(.udiv)
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
+ blu .Lgot_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
- blu LOC(not_really_big)
+ blu .Lnot_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
@@ -92,7 +90,7 @@ ENTRY(.udiv)
! Now compute %g2.
2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
+ bcc .Lnot_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
@@ -101,14 +99,14 @@ ENTRY(.udiv)
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
- b LOC(do_single_div)
+ b .Ldo_single_div
sub %g2, 1, %g2
- LOC(not_too_big):
+ .Lnot_too_big:
3: cmp %o5, %o3
blu 2b
nop
- be LOC(do_single_div)
+ be .Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
@@ -123,15 +121,15 @@ ENTRY(.udiv)
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
- LOC(do_single_div):
+ .Ldo_single_div:
subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
+ bl .Lend_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
- b LOC(end_single_divloop)
+ b .Lend_single_divloop
nop
- LOC(single_divloop):
+ .Lsingle_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
@@ -143,66 +141,66 @@ ENTRY(.udiv)
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
- LOC(end_single_divloop):
+ .Lend_single_divloop:
subcc %g2, 1, %g2
- bge LOC(single_divloop)
+ bge .Lsingle_divloop
tst %o3
- b,a LOC(end_regular_divide)
+ b,a .Lend_regular_divide
-LOC(not_really_big):
+.Lnot_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
- be LOC(got_result)
+ be .Lgot_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
-LOC(divloop):
+.Ldivloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
- bl LOC(1.16)
+ bl .L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
- bl LOC(2.17)
+ bl .L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
- bl LOC(3.19)
+ bl .L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
- bl LOC(4.23)
+ bl .L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
-LOC(4.23):
+.L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
-LOC(3.19):
+.L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
- bl LOC(4.21)
+ bl .L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
-LOC(4.21):
+.L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -210,41 +208,41 @@ LOC(4.21):
-LOC(2.17):
+.L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
- bl LOC(3.17)
+ bl .L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
- bl LOC(4.19)
+ bl .L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
-LOC(4.19):
+.L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
-LOC(3.17):
+.L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
- bl LOC(4.17)
+ bl .L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
-LOC(4.17):
+.L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -253,46 +251,46 @@ LOC(4.17):
-LOC(1.16):
+.L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
- bl LOC(2.15)
+ bl .L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
- bl LOC(3.15)
+ bl .L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
- bl LOC(4.15)
+ bl .L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
-LOC(4.15):
+.L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
-LOC(3.15):
+.L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
- bl LOC(4.13)
+ bl .L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
-LOC(4.13):
+.L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -300,41 +298,41 @@ LOC(4.13):
-LOC(2.15):
+.L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
- bl LOC(3.13)
+ bl .L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
- bl LOC(4.11)
+ bl .L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
-LOC(4.11):
+.L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
-LOC(3.13):
+.L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
- bl LOC(4.9)
+ bl .L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
-LOC(4.9):
+.L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -344,16 +342,16 @@ LOC(4.9):
9:
-LOC(end_regular_divide):
+.Lend_regular_divide:
subcc %o4, 1, %o4
- bge LOC(divloop)
+ bge .Ldivloop
tst %o3
- bl,a LOC(got_result)
+ bl,a .Lgot_result
! non-restoring fixup here (one instruction only!)
sub %o2, 1, %o2
-LOC(got_result):
+.Lgot_result:
retl
mov %o2, %o0
diff --git a/mdk-stage1/dietlibc/sparc/umul.S b/mdk-stage1/dietlibc/sparc/umul.S
index 15038ab2a..5d7d60f2b 100644
--- a/mdk-stage1/dietlibc/sparc/umul.S
+++ b/mdk-stage1/dietlibc/sparc/umul.S
@@ -25,8 +25,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -34,7 +32,7 @@ ENTRY(.umul)
or %o0, %o1, %o4
mov %o0, %y ! multiplier -> Y
andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args
- be LOC(mul_shortway) ! if zero, can do it the short way
+ be .Lmul_shortway ! if zero, can do it the short way
andcc %g0, %g0, %o4 ! zero the partial product; clear N & V
/*
@@ -124,7 +122,7 @@ ENTRY(.umul)
addcc %o4, %o2, %o1 ! add compensation and put upper half in place
#endif
-LOC(mul_shortway):
+.Lmul_shortway:
/*
* Short multiply. 12 steps, followed by a final shift step.
* The resulting bits are off by 12 and (32-12) = 20 bit positions,
diff --git a/mdk-stage1/dietlibc/sparc/urem.S b/mdk-stage1/dietlibc/sparc/urem.S
index 943cb7873..f7a9fd394 100644
--- a/mdk-stage1/dietlibc/sparc/urem.S
+++ b/mdk-stage1/dietlibc/sparc/urem.S
@@ -48,8 +48,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -70,11 +68,11 @@ ENTRY(.urem)
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
+ blu .Lgot_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
- blu LOC(not_really_big)
+ blu .Lnot_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
@@ -92,7 +90,7 @@ ENTRY(.urem)
! Now compute %g2.
2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
+ bcc .Lnot_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
@@ -101,14 +99,14 @@ ENTRY(.urem)
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
- b LOC(do_single_div)
+ b .Ldo_single_div
sub %g2, 1, %g2
- LOC(not_too_big):
+ .Lnot_too_big:
3: cmp %o5, %o3
blu 2b
nop
- be LOC(do_single_div)
+ be .Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
@@ -123,15 +121,15 @@ ENTRY(.urem)
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
- LOC(do_single_div):
+ .Ldo_single_div:
subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
+ bl .Lend_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
- b LOC(end_single_divloop)
+ b .Lend_single_divloop
nop
- LOC(single_divloop):
+ .Lsingle_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
@@ -143,66 +141,66 @@ ENTRY(.urem)
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
- LOC(end_single_divloop):
+ .Lend_single_divloop:
subcc %g2, 1, %g2
- bge LOC(single_divloop)
+ bge .Lsingle_divloop
tst %o3
- b,a LOC(end_regular_divide)
+ b,a .Lend_regular_divide
-LOC(not_really_big):
+.Lnot_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
- be LOC(got_result)
+ be .Lgot_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
-LOC(divloop):
+.Ldivloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
- bl LOC(1.16)
+ bl .L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
- bl LOC(2.17)
+ bl .L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
- bl LOC(3.19)
+ bl .L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
- bl LOC(4.23)
+ bl .L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
-LOC(4.23):
+.L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
-LOC(3.19):
+.L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
- bl LOC(4.21)
+ bl .L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
-LOC(4.21):
+.L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -210,41 +208,41 @@ LOC(4.21):
-LOC(2.17):
+.L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
- bl LOC(3.17)
+ bl .L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
- bl LOC(4.19)
+ bl .L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
-LOC(4.19):
+.L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
-LOC(3.17):
+.L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
- bl LOC(4.17)
+ bl .L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
-LOC(4.17):
+.L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -253,46 +251,46 @@ LOC(4.17):
-LOC(1.16):
+.L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
- bl LOC(2.15)
+ bl .L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
- bl LOC(3.15)
+ bl .L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
- bl LOC(4.15)
+ bl .L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
-LOC(4.15):
+.L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
-LOC(3.15):
+.L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
- bl LOC(4.13)
+ bl .L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
-LOC(4.13):
+.L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -300,41 +298,41 @@ LOC(4.13):
-LOC(2.15):
+.L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
- bl LOC(3.13)
+ bl .L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
- bl LOC(4.11)
+ bl .L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
-LOC(4.11):
+.L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
-LOC(3.13):
+.L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
- bl LOC(4.9)
+ bl .L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
-LOC(4.9):
+.L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -344,16 +342,16 @@ LOC(4.9):
9:
-LOC(end_regular_divide):
+.Lend_regular_divide:
subcc %o4, 1, %o4
- bge LOC(divloop)
+ bge .Ldivloop
tst %o3
- bl,a LOC(got_result)
+ bl,a .Lgot_result
! non-restoring fixup here (one instruction only!)
add %o3, %o1, %o3
-LOC(got_result):
+.Lgot_result:
retl
mov %o3, %o0
diff --git a/mdk-stage1/dietlibc/syscalls.s/errlist.S b/mdk-stage1/dietlibc/syscalls.s/errlist.S
index 503bd22e4..c06d3d3ac 100644
--- a/mdk-stage1/dietlibc/syscalls.s/errlist.S
+++ b/mdk-stage1/dietlibc/syscalls.s/errlist.S
@@ -10,14 +10,14 @@
.section .rodata
#endif
-.globl sys_errlist
- .align 4
+.align 4
+.global sys_errlist
#ifdef __arm__
- .type sys_errlist,object
- .type sys_nerr,object
+.type sys_errlist,object
+.type sys_nerr,object
#else
- .type sys_errlist,@object
- .type sys_nerr,@object
+.type sys_errlist,@object
+.type sys_nerr,@object
#endif
#if (__WORDSIZE == 64)
@@ -153,13 +153,13 @@ sys_errlist:
deflong .LC123
deflong .LC124
deflong 0
+.size sys_errlist,.-sys_errlist
-.globl sys_nerr
- .align 4
- .size sys_nerr,4
-
+.align 4
+.global sys_nerr
sys_nerr:
.long 125
+.size sys_nerr,4
#ifdef __DYN_LIB
diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat64.S b/mdk-stage1/dietlibc/syscalls.s/fstat64.S
index 0c7a41609..f034ddf5b 100644
--- a/mdk-stage1/dietlibc/syscalls.s/fstat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/fstat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_fstat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(fstat64,__dietlibc_fstat64)
#else
syscall(fstat64,fstat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ipc.S b/mdk-stage1/dietlibc/syscalls.s/ipc.S
index 40479400d..476878e52 100644
--- a/mdk-stage1/dietlibc/syscalls.s/ipc.S
+++ b/mdk-stage1/dietlibc/syscalls.s/ipc.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_ipc
syscall(ipc,__ipc)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/lstat64.S b/mdk-stage1/dietlibc/syscalls.s/lstat64.S
index 33fd5ab94..021cb0578 100644
--- a/mdk-stage1/dietlibc/syscalls.s/lstat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/lstat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_lstat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(lstat64,__dietlibc_lstat64)
#else
syscall(lstat64,lstat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/msync.S b/mdk-stage1/dietlibc/syscalls.s/msync.S
index 6359d4cb0..7f5ae9e4a 100644
--- a/mdk-stage1/dietlibc/syscalls.s/msync.S
+++ b/mdk-stage1/dietlibc/syscalls.s/msync.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-syscall(msync,msync)
+syscall_weak(msync,msync,__libc_msync)
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S b/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S
index 821f93d33..15d66ccc0 100644
--- a/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_sigaction
syscall_weak(sigaction,__old_sigaction,__n_sigaction)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S b/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S
index 2ccb1da82..f851099a0 100644
--- a/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_sigpending
syscall_weak(sigpending,__old_sigpending,__n_sigpending)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S
index 2a64bf166..6d632aa71 100644
--- a/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_sigprocmask
syscall_weak(sigprocmask,__old_sigprocmask,__n_sigprocmask)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S
index be461b37d..a1cfc014d 100644
--- a/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_sigsuspend
syscall_weak(sigsuspend,__old_sigsuspend,__n_sigsuspend)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/pause.S b/mdk-stage1/dietlibc/syscalls.s/pause.S
index cdf42cabd..d154f1538 100644
--- a/mdk-stage1/dietlibc/syscalls.s/pause.S
+++ b/mdk-stage1/dietlibc/syscalls.s/pause.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_pause
syscall_weak(pause,pause,__libc_pause)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/socketcall.S b/mdk-stage1/dietlibc/syscalls.s/socketcall.S
index 5837c049a..b97b37f0c 100644
--- a/mdk-stage1/dietlibc/syscalls.s/socketcall.S
+++ b/mdk-stage1/dietlibc/syscalls.s/socketcall.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_socketcall
syscall(socketcall,socketcall)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/stat64.S b/mdk-stage1/dietlibc/syscalls.s/stat64.S
index 734fcab20..7dc54d955 100644
--- a/mdk-stage1/dietlibc/syscalls.s/stat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/stat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_stat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(stat64,__dietlibc_stat64)
#else
syscall(stat64,stat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/umount2.S b/mdk-stage1/dietlibc/syscalls.s/umount2.S
index 4cdd6a200..b27b353ed 100644
--- a/mdk-stage1/dietlibc/syscalls.s/umount2.S
+++ b/mdk-stage1/dietlibc/syscalls.s/umount2.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_umount2
syscall(umount2,umount2)
+#endif
diff --git a/mdk-stage1/dietlibc/x86_64/msgctl.S b/mdk-stage1/dietlibc/x86_64/msgctl.S
new file mode 100644
index 000000000..d7caed2cc
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/x86_64/msgget.S b/mdk-stage1/dietlibc/x86_64/msgget.S
new file mode 100644
index 000000000..518d67ac4
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/x86_64/msgrcv.S b/mdk-stage1/dietlibc/x86_64/msgrcv.S
new file mode 100644
index 000000000..ab62e6c30
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgrcv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/x86_64/msgsnd.S b/mdk-stage1/dietlibc/x86_64/msgsnd.S
new file mode 100644
index 000000000..890a996a2
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgsnd.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/x86_64/semctl.S b/mdk-stage1/dietlibc/x86_64/semctl.S
new file mode 100644
index 000000000..e215ed955
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/x86_64/semget.S b/mdk-stage1/dietlibc/x86_64/semget.S
new file mode 100644
index 000000000..67f488546
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/x86_64/semop.S b/mdk-stage1/dietlibc/x86_64/semop.S
new file mode 100644
index 000000000..81b6fc606
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semop.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/x86_64/shmat.S b/mdk-stage1/dietlibc/x86_64/shmat.S
new file mode 100644
index 000000000..51248173d
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmat.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/x86_64/shmctl.S b/mdk-stage1/dietlibc/x86_64/shmctl.S
new file mode 100644
index 000000000..d56caace4
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/x86_64/shmdt.S b/mdk-stage1/dietlibc/x86_64/shmdt.S
new file mode 100644
index 000000000..d9812a799
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmdt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/x86_64/shmget.S b/mdk-stage1/dietlibc/x86_64/shmget.S
new file mode 100644
index 000000000..82914223f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/x86_64/start.S b/mdk-stage1/dietlibc/x86_64/start.S
index 328bbcfe3..5e8356350 100644
--- a/mdk-stage1/dietlibc/x86_64/start.S
+++ b/mdk-stage1/dietlibc/x86_64/start.S
@@ -3,19 +3,36 @@
.text
.global _start
_start:
+#ifdef WANT_DYNAMIC
+ movq %rdx, %rcx /* %rcx = dynamic fini */
+#endif
popq %rdi /* %rdi = argc */
movq %rsp,%rsi /* %rsi = argv */
pushq %rdi
leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */
- movq %rdx, environ
+#ifdef __DYN_LIB
+ movq environ@GOTPCREL(%rip), %rax
+ movq %rdx, (%rax)
+#else
+ movq %rdx, environ(%rip)
+#endif
#ifdef PROFILING
- pushq $_etext
- pushq $.text
+ pushq %rdi /* save reg args */
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+
+ leaq _etext(%rip), %rsi /* highpc */
+ leaq .text(%rip), %rdi /* lowpc */
call monitor
- addq $0x16, %rsp
+
+ popq %rcx /* restore reg args */
+ popq %rdx
+ popq %rsi
+ popq %rdi
#endif
#ifdef WANT_DYNAMIC