]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
[PATCH] Update to version 117 of klibc (from version 108)
authorgreg@kroah.com <greg@kroah.com>
Fri, 21 May 2004 06:14:08 +0000 (23:14 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:35:47 +0000 (21:35 -0700)
22 files changed:
klibc/MCONFIG
klibc/MRULES
klibc/klibc/Makefile
klibc/klibc/README
klibc/klibc/SYSCALLS
klibc/klibc/__static_init.c
klibc/klibc/arch/i386/MCONFIG
klibc/klibc/arch/i386/crt0.S
klibc/klibc/arch/parisc/Makefile.inc
klibc/klibc/arch/parisc/crt0.S [new file with mode: 0644]
klibc/klibc/arch/parisc/include/klibc/archsignal.h
klibc/klibc/arch/parisc/setjmp.S [new file with mode: 0644]
klibc/klibc/getpgrp.c [new file with mode: 0644]
klibc/klibc/getpt.c [new file with mode: 0644]
klibc/klibc/include/klibc/compiler.h
klibc/klibc/include/stdlib.h
klibc/klibc/include/sys/sysinfo.h [new file with mode: 0644]
klibc/klibc/include/sys/un.h
klibc/klibc/include/unistd.h
klibc/klibc/open.c [new file with mode: 0644]
klibc/klibc/pty.c
klibc/version

index de8b332d9829d27183bde107a7db3f721afc9faf..ec8b65c0e4c8a335060e5fa8441f2af5b130f0bc 100644 (file)
@@ -25,9 +25,14 @@ HOST_CFLAGS  = -g -O
 HOST_LDFLAGS = 
 HOST_LIBS    =
 
-CRT0    = $(KLIBSRC)/crt0.o
-KLIBC   = $(KLIBSRC)/libc.a
-LIBGCC  = $(shell $(CC) --print-libgcc)
+# Static library paths
+CRT0      = $(KLIBSRC)/crt0.o
+KLIBC     = $(KLIBSRC)/libc.a
+LIBGCC    = $(shell $(CC) --print-libgcc)
+
+# Shared library paths
+CRTSHARED = $(KLIBSRC)/interp.o
+LIBSHARED = $(KLIBSRC)/libc.so
 
 #
 # This indicates the location of the final version of the shared library.
index 8a8831c3489e31d1d36eda762e42bb598f753ab7..41fdd07af8c4e3eebbafcc3ced8b361882fe4c0d 100644 (file)
@@ -5,6 +5,10 @@
 
 .SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss
 
+% : %.c        # Cancel default rule
+
+% : %.S
+
 .c.o:
        $(CC) $(CFLAGS) -c -o $@ $<
 
index 0d5b197f0d8684b6cbe0f0faab0c2017f97ac0a9..7ed03a8e87d2f4b7b7fa8aa0e558ec8f1c3f243f 100644 (file)
@@ -17,7 +17,8 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          strtoimax.o strtoumax.o \
          globals.o exitc.o atexit.o onexit.o \
          execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \
-         fork.o wait.o wait3.o waitpid.o system.o setpgrp.o \
+         fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \
+         open.o \
          printf.o vprintf.o fprintf.o vfprintf.o perror.o \
          fopen.o fread.o fread2.o fgetc.o fgets.o \
          fwrite.o fwrite2.o fputc.o fputs.o puts.o \
@@ -35,7 +36,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          seteuid.o setegid.o setresuid.o setresgid.o \
          getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
          getopt.o readdir.o \
-         syslog.o closelog.o pty.o isatty.o reboot.o \
+         syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \
          time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \
          qsort.o lrand48.o srand48.o seed48.o \
          inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \
index 4495908a2277e6a602e636d99b343e36673ab229..d69fa8de41b924e51614f7c4f935941a786b5cfc 100644 (file)
@@ -36,9 +36,9 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to
 
    Known to work:             alpha arm ia64 i386 ppc s390 s390x sparc
                               sparc64 x86_64*
-   Works static, not shared:   mips* arm-thumb sh*
+   Works static, not shared:   mips* arm-thumb sh* parisc
    Might work:                ppc64
-   Need porting work:         cris m68k mips64 parisc
+   Need porting work:         cris m68k mips64 v850
 
    x86_64:   requires a kernel header patch (to be created)
    mips, sh: linker problem; might work with fixed linker
index 00883cc0987223bc1884ce3726a5bc77fac0c573..82081201b40ea1fc0107a51feea99970e2eaffc1 100644 (file)
@@ -19,7 +19,6 @@ int setpgid(pid_t, pid_t)
 pid_t getpgid(pid_t)
 <!alpha> pid_t getppid()
 <alpha> pid_t getxpid@dual1::getppid()
-<!ia64> pid_t getpgrp()
 pid_t setsid()
 pid_t getsid(pid_t)
 pid_t wait4(pid_t, int *, int, struct rusage *)
@@ -92,7 +91,6 @@ int lchown(const char *, uid_t, gid_t)
 #
 ssize_t read(int, void *, size_t)
 ssize_t write(int, const void *, size_t)
-int open(const char *, int, mode_t)
 int close(int)
 off_t lseek(int, off_t, int)
 int dup(int)
@@ -145,6 +143,7 @@ long delete_module(const char *, unsigned int)
 <!ia64> int query_module(const char *, int, void *, size_t, size_t)
 int reboot::__reboot(int, int, int, void *)
 int syslog::klogctl(int, char *, int)
+int sysinfo(struct sysinfo *)
 
 #
 # Low-level I/O (generally architecture-specific)
index dcb8d0185641802d038b55fb66a0b6218fb1902d..5a90b5cd88a95303b772a51ea31ac34ab3faa7d5 100644 (file)
@@ -36,5 +36,3 @@ __noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void))
   environ = envp;
   exit(main(argc, argv, envp));
 }
-
-  
index 367ee8977313f1feae167eccaaebd611ffdbf4bc..516b1b67381489b8956ebdd023e331db899747e2 100644 (file)
@@ -7,17 +7,16 @@
 # accordingly.
 #
 
-# Comment this out to compile with register parameter passing
-# This doesn't work right now because gcc 3.2 (at least) calls
-# libgcc with the default calling convention instead of forcing
-# them to be cdecl
-# REGPARM = -mregparm=3 -DREGPARM
+# Enable this to compile with register parameters; only safe for
+# gcc > 3
+REGPARM_OPT := -mregparm=3 -DREGPARM
 
 gcc_major := $(shell $(CC) -v 2>&1 | awk '/gcc version/{print int($$3)}')
 
 OPTFLAGS = $(REGPARM) -march=i386 -Os
 
 ifeq ($(gcc_major),3)
+REGPARM  := $(REGPARM_OPT)
 OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0
 else
 OPTFLAGS += -malign-functions=0 -malign-jumps=0 -malign-loops=0
index 1c82eda513df54ba3563dd2723df4652ed6fc5b4..0f3a7db35edacad3b2d0cc5db4132c459d1c7094 100644 (file)
@@ -26,7 +26,6 @@ _start:
 #endif
        call __libc_init
        # If __libc_init returns, problem...    
-       ud2
        hlt
        
        .size _start, .-_start
index f7a983da7f4994db57d7921804be7fea08b64af5..abe9155bf4d7dadc67c45f64e969fdb0411582e9 100644 (file)
@@ -7,4 +7,9 @@
 # accordingly.
 #
 
+ARCHOBJS = \
+       arch/$(ARCH)/setjmp.o
+
+ARCHOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS))
+
 archclean:
diff --git a/klibc/klibc/arch/parisc/crt0.S b/klibc/klibc/arch/parisc/crt0.S
new file mode 100644 (file)
index 0000000..fb0bd37
--- /dev/null
@@ -0,0 +1,34 @@
+        .align 4
+
+        .import $global$, data
+        .import __libc_init, code
+        .global _start
+        .export _start, ENTRY
+        .type _start,@function
+
+        .proc
+        .callinfo
+
+_start: 
+/* extend the stack by 64-bytes */
+        ldo     64(%sp), %sp
+       
+/* %r25 = argc
+ * %r24 = argv
+ * envp = argv + (argc + 1)        
+ * elfdata = (argv - 4)
+ */
+        ldo     -4(%r24), %r26
+
+/* load global data */
+        ldil   L%$global$, %dp
+        ldo    R%$global$(%dp), %dp
+
+/* branch to __libc_init */
+        bl     __libc_init,%r2
+        nop
+/* break miserably if we ever return */
+        iitlbp %r0,(%r0) /* illegal instruction */
+        nop
+        .procend
index 511d774b2d0229f3c99e077a71d803aa0c36914e..3190e8528e755b018208080e4b69029262d2aff0 100644 (file)
@@ -8,6 +8,17 @@
 #ifndef _KLIBC_ARCHSIGNAL_H
 #define _KLIBC_ARCHSIGNAL_H
 
-/* No special stuff for this architecture */
+#define _NSIG    64
+#define _NSIG_SZ (_NSIG / LONG_BIT)
+
+typedef struct {
+        unsigned long sig[_NSIG_SZ];
+} sigset_t;
+
+struct sigaction {
+        __sighandler_t sa_handler;
+        unsigned long sa_flags;
+        sigset_t sa_mask;
+};
 
 #endif
diff --git a/klibc/klibc/arch/parisc/setjmp.S b/klibc/klibc/arch/parisc/setjmp.S
new file mode 100644 (file)
index 0000000..51b2b1a
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * parisc specific setjmp/longjmp routines
+ *
+ */
+        
+        .text
+        .align 4
+        .global setjmp
+        .export setjmp, code
+        .proc
+        .callinfo
+setjmp:
+        stw     %r3,0(%r26)
+        stw     %r4,8(%r26)
+        stw     %r5,12(%r26)
+        stw     %r6,16(%r26)
+        stw     %r7,20(%r26)
+        stw     %r8,24(%r26)
+        stw     %r9,28(%r26)
+        stw     %r10,32(%r26)
+        stw     %r11,36(%r26)
+        stw     %r12,40(%r26)
+        stw     %r13,44(%r26)
+        stw     %r14,48(%r26)
+        stw     %r15,52(%r26)
+        stw     %r16,56(%r26)
+        stw     %r17,60(%r26)
+        stw     %r18,64(%r26)
+        stw     %r19,68(%r26)
+        stw     %dp,72(%r26)
+        stw     %r30,76(%r26)
+        stw     %rp,80(%r26)
+        ldo     88(%r26),%r19
+        fstd,ma %fr12,8(%r19)
+        fstd,ma %fr13,8(%r19)
+        fstd,ma %fr14,8(%r19)
+        fstd,ma %fr15,8(%r19)
+        fstd,ma %fr16,8(%r19)
+        fstd,ma %fr17,8(%r19)
+        fstd,ma %fr18,8(%r19)
+        fstd,ma %fr19,8(%r19)
+        fstd,ma %fr20,8(%r19)
+        fstd     %fr21,0(%r19)
+        bv       %r0(%rp)
+        copy     %r0,%r28
+       .procend
+
+       .text
+       .align 4
+       .global longjmp
+       .export longjmp, code
+       .proc
+       .callinfo
+longjmp:
+        ldw     0(%r26),%r3
+        ldw     8(%r26),%r4
+        ldw     12(%r26),%r5
+        ldw     16(%r26),%r6
+        ldw     20(%r26),%r7
+        ldw     24(%r26),%r8
+        ldw     28(%r26),%r9
+        ldw     32(%r26),%r10
+        ldw     36(%r26),%r11
+        ldw     40(%r26),%r12
+        ldw     44(%r26),%r13
+        ldw     48(%r26),%r14
+        ldw     52(%r26),%r15
+        ldw     56(%r26),%r16
+        ldw     60(%r26),%r17
+        ldw     64(%r26),%r18
+        ldw     68(%r26),%r19
+        ldw     72(%r26),%r27
+        ldw     76(%r26),%r30
+        ldw     80(%r26),%rp
+        ldo     88(%r26),%r20
+        fldd,ma 8(%r20),%fr12
+        fldd,ma 8(%r20),%fr13
+        fldd,ma 8(%r20),%fr14
+        fldd,ma 8(%r20),%fr15
+        fldd,ma 8(%r20),%fr16
+        fldd,ma 8(%r20),%fr17
+        fldd,ma 8(%r20),%fr18
+        fldd,ma 8(%r20),%fr19
+        fldd,ma 8(%r20),%fr20
+        fldd    0(%r20),%fr21
+        bv      %r0(%rp)
+        copy    %r25,%r28
+        .procend
diff --git a/klibc/klibc/getpgrp.c b/klibc/klibc/getpgrp.c
new file mode 100644 (file)
index 0000000..c923698
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * getpgrp.c
+ */
+
+#include <unistd.h>
+
+pid_t getpgrp(void) {
+  return getpgid(0);
+}
diff --git a/klibc/klibc/getpt.c b/klibc/klibc/getpt.c
new file mode 100644 (file)
index 0000000..a059030
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * getpt.c
+ *
+ * GNU extension to the standard Unix98 pty suite
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+int getpt(void)
+{
+  return open("/dev/ptmx", O_RDWR|O_NOCTTY);
+}
index 49872b89d4c2484ff4addb0cc5c6acff6c242dcf..6c01474cc1add4c181c7f1910a4d3e8af648fbf5 100644 (file)
@@ -8,12 +8,16 @@
 #define _KLIBC_COMPILER_H
 
 /* Specific calling conventions */
+/* __cdecl is used when we want varadic and non-varadic functions to have
+   the same binary calling convention. */
 #ifdef __i386__
 # ifdef __GNUC__
 #  define __cdecl __attribute__((cdecl,regparm(0)))
 # else
   /* Most other C compilers have __cdecl as a keyword */
 # endif
+#else
+# define __cdecl               /* Meaningless on non-i386 */
 #endif
 
 /* How to declare a function that *must* be inlined */
index 38dd1624a5c2c6801ba4d457014212acfd0cc6e2..af97eea63637e5fcf5b7218bbbfcbd8b14adfc90 100644 (file)
@@ -83,12 +83,14 @@ static __inline__ void srandom(unsigned int __s)
 
 /* Basic PTY functions.  These only work if devpts is mounted! */
 
+__extern int unlockpt(int);
+__extern char *ptsname(int);
+__extern int getpt(void);
+
 static __inline__ int grantpt(int __fd)
 {
   (void)__fd;
   return 0;                    /* devpts does this all for us! */
 }
-__extern int unlockpt(int);
-__extern char *ptsname(int);
 
 #endif /* _STDLIB_H */
diff --git a/klibc/klibc/include/sys/sysinfo.h b/klibc/klibc/include/sys/sysinfo.h
new file mode 100644 (file)
index 0000000..4051c68
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * sys/sysinfo.h
+ */
+
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#include <linux/kernel.h>
+
+extern int sysinfo (struct sysinfo *info);
+
+#endif /* _SYS_SYSINFO_H */
index 85822ba6a497b051082e3cc03665612391cb08f1..df42d719f7aa149d3c4c898aedc4d43b4764ef60 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * sys/un.h
+ * <sys/un.h>
  */
 
-#ifndef _UN_H
-#define _UN_H
+#ifndef _SYS_UN_H
+#define _SYS_UN_H
 
 #include <linux/un.h>
 
-#endif /* _UN_H */
+#endif /* _SYS_UN_H */
index f1cde2376e2faf377c093da0a5413b0a3e8eb70e..13ff03b012cb96a52a25b09125f4af546d5f3038 100644 (file)
@@ -17,6 +17,7 @@ __extern __noreturn _exit(int);
 __extern pid_t fork(void);
 __extern pid_t vfork(void);
 __extern pid_t getpid(void);
+__extern pid_t getpgid(pid_t);
 __extern int setpgid(pid_t, pid_t);
 __extern pid_t getppid(void);
 __extern pid_t getpgrp(void);
@@ -76,8 +77,8 @@ __extern int sync(void);
 
 __extern ssize_t read(int, void *, size_t);
 __extern ssize_t write(int, const void *, size_t);
-#ifndef __IN_SYS_COMMON
-__extern int open(const char *, int, ...);
+#ifndef __IN_OPEN_C
+__extern __cdecl int open(const char *, int, ...);
 #endif
 __extern int close(int);
 __extern off_t lseek(int, off_t, int);
diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c
new file mode 100644 (file)
index 0000000..0d7db10
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * open.c
+ *
+ * The open syscall is weird, because it's defined as a varadic
+ * function, but implementing it as such generally sucks for
+ * performance.  Thus we generate it as a 3-argument function,
+ * but with explicit __cdecl assuming the __cdecl convention is
+ * independent of being varadic.
+ */
+
+#define __IN_OPEN_C
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+
+__cdecl _syscall3(int,open,const char *,file,int,flags,mode_t,mode)
index 5907ca2ff504014d9bb6e6f0f9879fbde9d39a8c..2fe01ab2043f9d6a2f5ce645d9d4a7bd9cad6e42 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * pty.c
  *
- * Basic Unix98 PTY functionality; assumes devpts
+ * Basic Unix98 PTY functionality; assumes devpts mounted on /dev/pts
  */
 
 #include <stdio.h>
index 4b0a18ac52a4a612417cebae97f33b2684bf658e..31ba1bdaa52015553a61bc5b92cfcae426fcc7cb 100644 (file)
@@ -1 +1 @@
-0.108
+0.117