summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-07-21 20:31:26 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-07-21 20:31:26 (GMT)
commit1293ffef115e21ee0a9bd5e8a4ae9a75e5142a63 (patch)
treea81586ae5131bff48eb2772f69cfaf00995f1603 /patches
parent55f66b762cefac238226b6af1672bc8d15d68ca3 (diff)
Vampirise two more patches against uClibc-0.9.29 from buildroot.
Diffstat (limited to 'patches')
-rw-r--r--patches/uClibc/0.9.29/000-fix-mmap.patch91
-rw-r--r--patches/uClibc/0.9.29/200-fix-internal_function-definition.patch51
2 files changed, 142 insertions, 0 deletions
diff --git a/patches/uClibc/0.9.29/000-fix-mmap.patch b/patches/uClibc/0.9.29/000-fix-mmap.patch
new file mode 100644
index 0000000..af38be3
--- /dev/null
+++ b/patches/uClibc/0.9.29/000-fix-mmap.patch
@@ -0,0 +1,91 @@
+--- uClibc-0.9.29.oorig/test/mmap/mmap2.c (revision 0)
++++ uClibc-0.9.29/test/mmap/mmap2.c (revision 18616)
+@@ -0,0 +1,41 @@
++/* When trying to map /dev/mem with offset 0xFFFFF000 on the ARM platform, mmap
++ * returns -EOVERFLOW.
++ *
++ * Since off_t is defined as a long int and the sign bit is set in the address,
++ * the shift operation shifts in ones instead of zeroes
++ * from the left. This results the offset sent to the kernel function becomes
++ * 0xFFFFFFFF instead of 0x000FFFFF with MMAP2_PAGE_SHIFT set to 12.
++ */
++
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <sys/mman.h>
++
++#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
++ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
++
++#define MAP_SIZE 4096UL
++#define MAP_MASK (MAP_SIZE - 1)
++
++int main(int argc, char **argv) {
++ void* map_base = 0;
++ int fd;
++ off_t target = 0xfffff000;
++ if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
++ printf("/dev/mem opened.\n");
++ fflush(stdout);
++
++ /* Map one page */
++ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
++ fd, target & ~MAP_MASK);
++ if(map_base == (void *) -1) FATAL;
++ printf("Memory mapped at address %p.\n", map_base);
++ fflush(stdout);
++ if(munmap(map_base, MAP_SIZE) == -1) FATAL;
++ close(fd);
++ return 0;
++}
+--- uClibc-0.9.29.oorig/libc/sysdeps/linux/arm/mmap.c (revision 18615)
++++ uClibc-0.9.29/libc/sysdeps/linux/arm/mmap.c (revision 18616)
+@@ -27,7 +27,6 @@ __ptr_t mmap(__ptr_t addr, size_t len, i
+
+ #elif defined (__NR_mmap2)
+ #define __NR__mmap __NR_mmap2
+-
+ #ifndef MMAP2_PAGE_SHIFT
+ # define MMAP2_PAGE_SHIFT 12
+ #endif
+@@ -39,9 +38,17 @@ __ptr_t mmap(__ptr_t addr, size_t len, i
+ {
+ /* check if offset is page aligned */
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
++ {
++ __set_errno(EINVAL);
+ return MAP_FAILED;
++ }
++#ifdef __USE_FILE_OFFSET64
++ return (__ptr_t) _mmap (addr, len, prot, flags,
++ fd,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
++#else
+ return (__ptr_t) _mmap (addr, len, prot, flags,
+- fd,(off_t) (offset >> MMAP2_PAGE_SHIFT));
++ fd,((__u_long) offset >> MMAP2_PAGE_SHIFT));
++#endif
+ }
+ #elif defined (__NR_mmap)
+ # define __NR__mmap __NR_mmap
+--- uClibc-0.9.29.oorig/libc/sysdeps/linux/common/mmap64.c (revision 18615)
++++ uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c (revision 18616)
+@@ -58,8 +58,13 @@ __ptr_t mmap64(__ptr_t addr, size_t len,
+ __set_errno(EINVAL);
+ return MAP_FAILED;
+ }
+-
+- return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
++#ifdef __USE_FILE_OFFSET64
++ return __syscall_mmap2(addr, len, prot, flags,
++ fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT));
++#else
++ return __syscall_mmap2(addr, len, prot, flags,
++ fd,((__ulong_t)offset >> MMAP2_PAGE_SHIFT));
++#endif
+ }
+
+ # endif
diff --git a/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch b/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch
new file mode 100644
index 0000000..9b88d82
--- /dev/null
+++ b/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch
@@ -0,0 +1,51 @@
+Index: uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
+===================================================================
+--- uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (revision 18898)
++++ uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (working copy)
+@@ -42,6 +42,8 @@
+ /* define if target supports IEEE signed zero floats */
+ #define __UCLIBC_HAVE_SIGNED_ZERO__
+
++#if defined _LIBC
+ #define internal_function __attribute__ ((regparm (3), stdcall))
++#endif
+
+ #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
+Index: uClibc/include/libc-symbols.h
+===================================================================
+--- uClibc/include/libc-symbols.h (revision 18898)
++++ uClibc/include/libc-symbols.h (working copy)
+@@ -22,6 +22,16 @@
+ #ifndef _LIBC_SYMBOLS_H
+ #define _LIBC_SYMBOLS_H 1
+
++/* This is defined for the compilation of all C library code. features.h
++ tests this to avoid inclusion of stubs.h while compiling the library,
++ before stubs.h has been generated. Some library code that is shared
++ with other packages also tests this symbol to see if it is being
++ compiled as part of the C library. We must define this before including
++ config.h, because it makes some definitions conditional on whether libc
++ itself is being compiled, or just some generator program. */
++#define _LIBC 1
++
++
+ /* This file's macros are included implicitly in the compilation of every
+ file in the C library by -imacros.
+
+@@ -40,16 +50,6 @@
+
+ #include <bits/uClibc_arch_features.h>
+
+-
+-/* This is defined for the compilation of all C library code. features.h
+- tests this to avoid inclusion of stubs.h while compiling the library,
+- before stubs.h has been generated. Some library code that is shared
+- with other packages also tests this symbol to see if it is being
+- compiled as part of the C library. We must define this before including
+- config.h, because it makes some definitions conditional on whether libc
+- itself is being compiled, or just some generator program. */
+-#define _LIBC 1
+-
+ /* Enable declarations of GNU extensions, since we are compiling them. */
+ #define _GNU_SOURCE 1
+