From 833aa0fab572536ebb680cc54bf95c50c3b36a0f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 24 Feb 2005 19:54:47 +0100 Subject: [PATCH] [PATCH] klibc v0.199 --- klibc/MCONFIG | 5 ++ klibc/include/arch/parisc/klibc/archsetjmp.h | 14 +++++ klibc/klibc.spec | 2 +- klibc/klibc/arch/alpha/MCONFIG | 2 +- klibc/klibc/arch/arm/MCONFIG | 2 +- klibc/klibc/arch/ia64/MCONFIG | 2 +- klibc/klibc/arch/ia64/setjmp.S | 2 + klibc/klibc/arch/ia64/vfork.S | 3 +- klibc/klibc/arch/m32r/MCONFIG | 2 +- klibc/klibc/arch/mips/MCONFIG | 2 +- klibc/klibc/arch/mips64/MCONFIG | 2 +- klibc/klibc/arch/parisc/setjmp.S | 2 +- klibc/klibc/arch/parisc/sysstub.ph | 1 - klibc/klibc/arch/ppc/MCONFIG | 2 +- klibc/klibc/arch/ppc64/MCONFIG | 2 +- klibc/klibc/arch/s390/MCONFIG | 2 +- klibc/klibc/arch/s390x/MCONFIG | 2 +- klibc/klibc/arch/sparc/MCONFIG | 2 +- klibc/klibc/arch/sparc64/MCONFIG | 2 +- klibc/klibc/arch/sparc64/crt0.S | 2 +- klibc/klibc/memmem.c | 54 +++++++++++--------- klibc/klibc/strncat.c | 1 - klibc/version | 2 +- 23 files changed, 70 insertions(+), 42 deletions(-) create mode 100644 klibc/include/arch/parisc/klibc/archsetjmp.h diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 7da150d0..3fae2898 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -62,5 +62,10 @@ ERRLIST = 1 # include $(KLIBSRC)/arch/$(ARCH)/MCONFIG +ifeq ($(DEBUG),y) +STRIP = /bin/true -Since_we_are_debugging +OPTFLAGS += -O1 -g +endif + # How to tell the linker main() is the entrypoint EMAIN ?= -e main diff --git a/klibc/include/arch/parisc/klibc/archsetjmp.h b/klibc/include/arch/parisc/klibc/archsetjmp.h new file mode 100644 index 00000000..e7444983 --- /dev/null +++ b/klibc/include/arch/parisc/klibc/archsetjmp.h @@ -0,0 +1,14 @@ +/* + * arch/parisc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + double regs[21]; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc.spec b/klibc/klibc.spec index 02131c7f..de0a14cf 100644 --- a/klibc/klibc.spec +++ b/klibc/klibc.spec @@ -1,6 +1,6 @@ Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.198 +Version: 0.199 Release: 1 License: BSD/GPL Group: Development/Libraries diff --git a/klibc/klibc/arch/alpha/MCONFIG b/klibc/klibc/arch/alpha/MCONFIG index 5987ed58..d7ab6c0b 100644 --- a/klibc/klibc/arch/alpha/MCONFIG +++ b/klibc/klibc/arch/alpha/MCONFIG @@ -5,7 +5,7 @@ # Build configuration for this architecture # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/arm/MCONFIG b/klibc/klibc/arch/arm/MCONFIG index 6fbea329..fe26b996 100644 --- a/klibc/klibc/arch/arm/MCONFIG +++ b/klibc/klibc/arch/arm/MCONFIG @@ -11,7 +11,7 @@ THUMB = n CPU_ARCH := armv4 CPU_TUNE := strongarm -OPTFLAGS = -Os -fomit-frame-pointer -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) +OPTFLAGS = -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) BITSIZE = 32 ifeq ($(THUMB),y) diff --git a/klibc/klibc/arch/ia64/MCONFIG b/klibc/klibc/arch/ia64/MCONFIG index 631a478e..36b30ffb 100644 --- a/klibc/klibc/arch/ia64/MCONFIG +++ b/klibc/klibc/arch/ia64/MCONFIG @@ -7,5 +7,5 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 diff --git a/klibc/klibc/arch/ia64/setjmp.S b/klibc/klibc/arch/ia64/setjmp.S index 50f91dc1..7859ba41 100644 --- a/klibc/klibc/arch/ia64/setjmp.S +++ b/klibc/klibc/arch/ia64/setjmp.S @@ -61,6 +61,7 @@ // .align 32 .global setjmp + .proc setjmp setjmp: // // Make sure buffer is aligned at 16byte boundary @@ -190,6 +191,7 @@ setjmp: .align 32 .global longjmp + .proc longjmp longjmp: // // Make sure buffer is aligned at 16byte boundary diff --git a/klibc/klibc/arch/ia64/vfork.S b/klibc/klibc/arch/ia64/vfork.S index efcd03f7..f79bdc82 100644 --- a/klibc/klibc/arch/ia64/vfork.S +++ b/klibc/klibc/arch/ia64/vfork.S @@ -19,6 +19,7 @@ /* pid_t vfork(void) */ /* Implemented as clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ + .align 32 .proc vfork .global vfork vfork: @@ -38,4 +39,4 @@ vfork: ;; (p7) mov r8=-1 br.ret.sptk.many b0 - .endp + .endp vfork diff --git a/klibc/klibc/arch/m32r/MCONFIG b/klibc/klibc/arch/m32r/MCONFIG index 6706d9dd..2673090f 100644 --- a/klibc/klibc/arch/m32r/MCONFIG +++ b/klibc/klibc/arch/m32r/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/mips/MCONFIG b/klibc/klibc/arch/mips/MCONFIG index a2489738..0a989189 100644 --- a/klibc/klibc/arch/mips/MCONFIG +++ b/klibc/klibc/arch/mips/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/mips64/MCONFIG b/klibc/klibc/arch/mips64/MCONFIG index 6a817e54..66405e43 100644 --- a/klibc/klibc/arch/mips64/MCONFIG +++ b/klibc/klibc/arch/mips64/MCONFIG @@ -7,5 +7,5 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 diff --git a/klibc/klibc/arch/parisc/setjmp.S b/klibc/klibc/arch/parisc/setjmp.S index 51b2b1a5..aebe03a5 100644 --- a/klibc/klibc/arch/parisc/setjmp.S +++ b/klibc/klibc/arch/parisc/setjmp.S @@ -27,7 +27,7 @@ setjmp: stw %r17,60(%r26) stw %r18,64(%r26) stw %r19,68(%r26) - stw %dp,72(%r26) + stw %r27,72(%r26) stw %r30,76(%r26) stw %rp,80(%r26) ldo 88(%r26),%r19 diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph index eb6b5dd9..63b5e17f 100644 --- a/klibc/klibc/arch/parisc/sysstub.ph +++ b/klibc/klibc/arch/parisc/sysstub.ph @@ -16,7 +16,6 @@ sub make_sysstub($$$$@) { print OUT "\t.import __syscall_common, code\n"; print OUT "\t.global ${fname}\n"; print OUT "\t.export ${fname}, code\n"; - print OUT "\t.type ${fname}, @function\n"; print OUT "\t.proc\n"; print OUT "\.callinfo\n"; print OUT "${fname}:\n"; diff --git a/klibc/klibc/arch/ppc/MCONFIG b/klibc/klibc/arch/ppc/MCONFIG index ff7c44db..82c71070 100644 --- a/klibc/klibc/arch/ppc/MCONFIG +++ b/klibc/klibc/arch/ppc/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG index 09881b8d..9aba2ddb 100644 --- a/klibc/klibc/arch/ppc64/MCONFIG +++ b/klibc/klibc/arch/ppc64/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -m64 -mcall-aixdesc -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 LDFLAGS = -m elf64ppc diff --git a/klibc/klibc/arch/s390/MCONFIG b/klibc/klibc/arch/s390/MCONFIG index e32c33fa..640b395b 100644 --- a/klibc/klibc/arch/s390/MCONFIG +++ b/klibc/klibc/arch/s390/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390x/MCONFIG b/klibc/klibc/arch/s390x/MCONFIG index 1c8232be..081a0bbb 100644 --- a/klibc/klibc/arch/s390x/MCONFIG +++ b/klibc/klibc/arch/s390x/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/sparc/MCONFIG b/klibc/klibc/arch/sparc/MCONFIG index cb94f46c..55f8b198 100644 --- a/klibc/klibc/arch/sparc/MCONFIG +++ b/klibc/klibc/arch/sparc/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/sparc64/MCONFIG b/klibc/klibc/arch/sparc64/MCONFIG index d490c636..a8a74241 100644 --- a/klibc/klibc/arch/sparc64/MCONFIG +++ b/klibc/klibc/arch/sparc64/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -m64 -mptr64 -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 LDFLAGS = -m elf64_sparc diff --git a/klibc/klibc/arch/sparc64/crt0.S b/klibc/klibc/arch/sparc64/crt0.S index 23af82ec..5faee7c6 100644 --- a/klibc/klibc/arch/sparc64/crt0.S +++ b/klibc/klibc/arch/sparc64/crt0.S @@ -1,2 +1,2 @@ #define TARGET_PTR_SIZE 64 -#include "arch/sparc/crt0i.S" +#include "../sparc/crt0i.S" diff --git a/klibc/klibc/memmem.c b/klibc/klibc/memmem.c index 0f59938f..8b5faa00 100644 --- a/klibc/klibc/memmem.c +++ b/klibc/klibc/memmem.c @@ -13,32 +13,40 @@ void *memmem(const void *haystack, size_t n, const void *needle, size_t m) { - const unsigned char *y = (const unsigned char *)haystack; - const unsigned char *x = (const unsigned char *)needle; + const unsigned char *y = (const unsigned char *)haystack; + const unsigned char *x = (const unsigned char *)needle; - size_t j, k, l; + size_t j, k, l; - if ( m > n ) - return NULL; + if (m > n || !m || !n) + return NULL; - if ( x[0] == x[1] ) { - k = 2; - l = 1; - } else { - k = 1; - l = 2; - } + if (1 != m) { + if (x[0] == x[1]) { + k = 2; + l = 1; + } else { + k = 1; + l = 2; + } - j = 0; - while ( j <= n-m ) { - if (x[1] != y[j+1]) { - j += k; - } else { - if ( !memcmp(x+2, y+j+2, m-2) && x[0] == y[j] ) - return (void *)&y[j]; - j += l; - } - } + j = 0; + while (j <= n - m) { + if (x[1] != y[j + 1]) { + j += k; + } else { + if (!memcmp(x + 2, y + j + 2, m - 2) + && x[0] == y[j]) + return (void *)&y[j]; + j += l; + } + } + } else + do { + if (*y == *x) + return (void *)y; + y++; + } while (--n); - return NULL; + return NULL; } diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c index 4d8458d5..78223152 100644 --- a/klibc/klibc/strncat.c +++ b/klibc/klibc/strncat.c @@ -10,7 +10,6 @@ char *strncat(char *dst, const char *src, size_t n) char *q = strchr(dst, '\0'); const char *p = src; char ch; - size_t nn = q-dst; while (n--) { *q++ = ch = *p++; diff --git a/klibc/version b/klibc/version index 129efcc0..b4d2b300 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.198 +0.199 -- 2.39.5