diff options
author | Koen Kooi <koen@openembedded.org> | 2007-10-12 07:53:43 +0000 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2007-10-12 07:53:43 +0000 |
commit | c751ec57bd75446f7dbc99e1c5a403b383cc0b48 (patch) | |
tree | 2cbdcfb16daac74347b9300a1759526602a48e61 /packages | |
parent | a812a5fd154c5d08c214190e49111006588d011c (diff) |
uclibc 0.9.29: add patches from buildrot to fix mmap
Diffstat (limited to 'packages')
6 files changed, 300 insertions, 2 deletions
diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-001-fix-mmap.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-001-fix-mmap.patch new file mode 100644 index 0000000000..4775e8c332 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-001-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,((__u_long)offset >> MMAP2_PAGE_SHIFT)); ++#endif + } + + # endif diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-conditional-sched_affinity.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-conditional-sched_affinity.patch new file mode 100644 index 0000000000..509c42af52 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-conditional-sched_affinity.patch @@ -0,0 +1,53 @@ +diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c +--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c 2007-02-12 16:52:32.000000000 -0600 ++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c 2007-05-09 18:05:09.397411811 -0500 +@@ -29,6 +29,7 @@ + #include <sys/param.h> + #include <sys/types.h> + ++#ifdef __NR_sched_getaffinity + libc_hidden_proto(memset) + + #define __NR___syscall_sched_getaffinity __NR_sched_getaffinity +@@ -48,5 +49,15 @@ + } + return res; + } ++#else ++/* ++int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) ++{ ++ __set_errno(ENOSYS); ++ return -1; ++} ++*/ + #endif + #endif ++ ++#endif +diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c +--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c 2007-02-12 16:52:32.000000000 -0600 ++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c 2007-05-09 18:05:09.397411811 -0500 +@@ -31,6 +31,7 @@ + #include <sys/types.h> + #include <alloca.h> + ++#ifdef __NR_sched_setaffinity + libc_hidden_proto(getpid) + + #define __NR___syscall_sched_setaffinity __NR_sched_setaffinity +@@ -74,5 +75,14 @@ + + return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); + } ++#else ++/* ++int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) ++{ ++ __set_errno(ENOSYS); ++ return -1; ++} ++*/ ++#endif + #endif + #endif diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch new file mode 100644 index 0000000000..7b246c1ad7 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-fix-gethostent_r-failure-retval.patch @@ -0,0 +1,12 @@ +diff -ur uClibc-0.9.29/libc/inet/resolv.c uClibc-0.9.29-patched/libc/inet/resolv.c +--- uClibc-0.9.29/libc/inet/resolv.c 2007-04-23 12:01:05.000000000 -0500 ++++ uClibc-0.9.29-patched/libc/inet/resolv.c 2007-05-09 18:05:33.563404419 -0500 +@@ -1700,7 +1700,7 @@ + int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, + struct hostent **result, int *h_errnop) + { +- int ret; ++ int ret = HOST_NOT_FOUND; + + __UCLIBC_MUTEX_LOCK(mylock); + if (__gethostent_fp == NULL) { diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-fix-internal_function-definition.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-fix-internal_function-definition.patch new file mode 100644 index 0000000000..9b88d826f1 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-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 + diff --git a/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-rm-whitespace.patch b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-rm-whitespace.patch new file mode 100644 index 0000000000..6004f91e32 --- /dev/null +++ b/packages/uclibc/uclibc-0.9.29/uClibc-0.9.29-rm-whitespace.patch @@ -0,0 +1,86 @@ +diff -urN uClibc-0.9.29-0rig/include/assert.h uClibc-0.9.29/include/assert.h +--- uClibc-0.9.29-0rig/include/assert.h 2005-11-03 23:42:46.000000000 +0100 ++++ uClibc-0.9.29/include/assert.h 2007-08-13 19:10:57.000000000 +0200 +@@ -31,7 +31,7 @@ + #define _ASSERT_H 1 + #include <features.h> + +-#if defined __cplusplus && __GNUC_PREREQ (2,95) ++#if defined __cplusplus && __GNUC_PREREQ(2,95) + # define __ASSERT_VOID_CAST static_cast<void> + #else + # define __ASSERT_VOID_CAST (void) +@@ -59,13 +59,17 @@ + (__ASSERT_VOID_CAST ((expr) ? 0 : \ + (__assert (__STRING(expr), __FILE__, __LINE__, \ + __ASSERT_FUNCTION), 0))) +- ++ ++/* Define some temporaries to workaround tinyx makedepend bug */ ++#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6) ++#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4) + /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' + which contains the name of the function currently being defined. + This is broken in G++ before version 2.6. + C9x has a similar variable called __func__, but prefer the GCC one since + it demangles C++ function names. */ +-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) ++ ++# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4 + # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ + # else + # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +diff -urN uClibc-0.9.29-0rig/include/complex.h uClibc-0.9.29/include/complex.h +--- uClibc-0.9.29-0rig/include/complex.h 2002-05-09 10:15:21.000000000 +0200 ++++ uClibc-0.9.29/include/complex.h 2007-08-13 17:55:29.000000000 +0200 +@@ -33,7 +33,7 @@ + /* We might need to add support for more compilers here. But since ISO + C99 is out hopefully all maintained compilers will soon provide the data + types `float complex' and `double complex'. */ +-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) ++#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97) + # define _Complex __complex__ + #endif + +diff -urN uClibc-0.9.29-0rig/include/features.h uClibc-0.9.29/include/features.h +--- uClibc-0.9.29-0rig/include/features.h 2006-11-29 22:10:04.000000000 +0100 ++++ uClibc-0.9.29/include/features.h 2007-08-13 17:55:51.000000000 +0200 +@@ -143,7 +143,7 @@ + + /* Convenience macros to test the versions of glibc and gcc. + Use them like this: +- #if __GNUC_PREREQ (2,8) ++ #if __GNUC_PREREQ(2,8) + ... code requiring gcc 2.8 or later ... + #endif + Note - they won't work for gcc1 or glibc1, since the _MINOR macros +@@ -297,7 +297,7 @@ + /* uClibc does not support _FORTIFY_SOURCE */ + #undef _FORTIFY_SOURCE + #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ +- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 ++ && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 + # if _FORTIFY_SOURCE > 1 + # define __USE_FORTIFY_LEVEL 2 + # else +@@ -366,7 +366,7 @@ + #endif /* !ASSEMBLER */ + + /* Decide whether we can define 'extern inline' functions in headers. */ +-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ ++#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ + # define __USE_EXTERN_INLINES 1 + #endif +diff -urN uClibc-0.9.29-0rig/include/tgmath.h uClibc-0.9.29/include/tgmath.h +--- uClibc-0.9.29-0rig/include/tgmath.h 2002-05-09 10:15:21.000000000 +0200 ++++ uClibc-0.9.29/include/tgmath.h 2007-08-13 17:56:17.000000000 +0200 +@@ -34,7 +34,7 @@ + do not try this for now and instead concentrate only on GNU CC. Once + we have more information support for other compilers might follow. */ + +-#if __GNUC_PREREQ (2, 7) ++#if __GNUC_PREREQ(2, 7) + + # ifdef __NO_LONG_DOUBLE_MATH + # define __tgml(fct) fct diff --git a/packages/uclibc/uclibc_0.9.29.bb b/packages/uclibc/uclibc_0.9.29.bb index f00a347aa8..9ec20d61de 100644 --- a/packages/uclibc/uclibc_0.9.29.bb +++ b/packages/uclibc/uclibc_0.9.29.bb @@ -7,7 +7,7 @@ # on whether the base patches apply to the selected (SRCDATE) svn release. # UCLIBC_BASE ?= "0.9.29" -PR = "r7" +PR = "r8" require uclibc.inc @@ -16,7 +16,12 @@ PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc" SRC_URI += "file://uClibc.machine file://uClibc.distro \ file://errno_values.h.patch;patch=1 \ file://termios.h.patch;patch=1 \ - " + file://uClibc-0.9.29-001-fix-mmap.patch;patch=1 \ + file://uClibc-0.9.29-conditional-sched_affinity.patch;patch=1 \ + file://uClibc-0.9.29-fix-gethostent_r-failure-retval.patch;patch=1 \ + file://uClibc-0.9.29-fix-internal_function-definition.patch;patch=1 \ + file://uClibc-0.9.29-rm-whitespace.patch;patch=1 \ + " # mmap-unsigned-shift_bugid1303.patch # http://uclibc.org/lists/uclibc-cvs/2007-May/011360.html;patch=1" |