summaryrefslogtreecommitdiff
path: root/klibc/klibc
diff options
context:
space:
mode:
Diffstat (limited to 'klibc/klibc')
-rw-r--r--klibc/klibc/arch/alpha/MCONFIG2
-rw-r--r--klibc/klibc/arch/arm/MCONFIG2
-rw-r--r--klibc/klibc/arch/ia64/MCONFIG2
-rw-r--r--klibc/klibc/arch/ia64/setjmp.S2
-rw-r--r--klibc/klibc/arch/ia64/vfork.S3
-rw-r--r--klibc/klibc/arch/m32r/MCONFIG2
-rw-r--r--klibc/klibc/arch/mips/MCONFIG2
-rw-r--r--klibc/klibc/arch/mips64/MCONFIG2
-rw-r--r--klibc/klibc/arch/parisc/setjmp.S2
-rw-r--r--klibc/klibc/arch/parisc/sysstub.ph1
-rw-r--r--klibc/klibc/arch/ppc/MCONFIG2
-rw-r--r--klibc/klibc/arch/ppc64/MCONFIG2
-rw-r--r--klibc/klibc/arch/s390/MCONFIG2
-rw-r--r--klibc/klibc/arch/s390x/MCONFIG2
-rw-r--r--klibc/klibc/arch/sparc/MCONFIG2
-rw-r--r--klibc/klibc/arch/sparc64/MCONFIG2
-rw-r--r--klibc/klibc/arch/sparc64/crt0.S2
-rw-r--r--klibc/klibc/memmem.c54
-rw-r--r--klibc/klibc/strncat.c1
19 files changed, 49 insertions, 40 deletions
diff --git a/klibc/klibc/arch/alpha/MCONFIG b/klibc/klibc/arch/alpha/MCONFIG
index 5987ed5841..d7ab6c0b82 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 6fbea32903..fe26b996a7 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 631a478e4f..36b30ffb81 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 50f91dc1d6..7859ba4143 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 efcd03f7f1..f79bdc8234 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 6706d9ddc1..2673090fce 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 a248973815..0a98918987 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 6a817e54b6..66405e4373 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 51b2b1a58b..aebe03a5ed 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 eb6b5dd92a..63b5e17fcf 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 ff7c44db9a..82c7107013 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 09881b8d40..9aba2ddbb6 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 e32c33faa1..640b395b54 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 1c8232bed5..081a0bbb52 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 cb94f46c00..55f8b198c2 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 d490c63643..a8a742412e 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 23af82ecc4..5faee7c6be 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 0f59938ffb..8b5faa0014 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 4d8458d5ec..78223152c4 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++;