diff options
60 files changed, 7878 insertions, 2406 deletions
diff --git a/meta/recipes-core/uclibc/files/armeb-kernel-stat.h.patch b/meta/recipes-core/uclibc/files/armeb-kernel-stat.h.patch deleted file mode 100644 index 0440718eec..0000000000 --- a/meta/recipes-core/uclibc/files/armeb-kernel-stat.h.patch +++ /dev/null | |||
| @@ -1,125 +0,0 @@ | |||
| 1 | # The 2.6 asm/stat.h for ARM has some rather unusual transmogrifications | ||
| 2 | # for big-endian running. This patch adds ARM specific code in xstatconv.c | ||
| 3 | # which deals with the 2.4->2.6 ABI change. | ||
| 4 | --- uClibc-0.9.27/libc/sysdeps/linux/common/xstatconv.c 2005-01-11 23:59:21.000000000 -0800 | ||
| 5 | +++ uClibc-0.9.27/libc/sysdeps/linux/common/xstatconv.c 2005-06-05 11:03:56.742587966 -0700 | ||
| 6 | @@ -18,7 +18,14 @@ | ||
| 7 | 02111-1307 USA. | ||
| 8 | |||
| 9 | Modified for uClibc by Erik Andersen <andersen@codepoet.org> | ||
| 10 | + Further modified for ARMBE by John Bowler <jbowler@acm.org> | ||
| 11 | */ | ||
| 12 | +/* This is a copy of common/xstatconv.c with a fixup for the ABI | ||
| 13 | + * (structure layout) change in ARM Linux 2.6 - this shifts the | ||
| 14 | + * st_dev and st_rdev information from the start of the 8 byte | ||
| 15 | + * space to the end on big-endian ARM (only). The code is unchanged | ||
| 16 | + * on little endian. | ||
| 17 | + */ | ||
| 18 | |||
| 19 | #define _GNU_SOURCE | ||
| 20 | #define _LARGEFILE64_SOURCE | ||
| 21 | @@ -32,6 +39,84 @@ | ||
| 22 | #include <sys/stat.h> | ||
| 23 | #include "xstatconv.h" | ||
| 24 | |||
| 25 | +/* Only for ARMEB and LFS. */ | ||
| 26 | +#if defined(__ARMEB__) && defined(__UCLIBC_HAS_LFS__) | ||
| 27 | +/* stat64 (renamed) from 2.6.11.11. What happened here is that after | ||
| 28 | + * Linux 2.4 the 2.4 unsigned short st_rdev and st_dev fields were | ||
| 29 | + * lengthened to unsigned long long - causing the inclusion of at least | ||
| 30 | + * some of the 0 padding bytes which followed them. On little endian | ||
| 31 | + * this is fine because 2.4 did zero the pad bytes (I think) and the | ||
| 32 | + * position of the data did not change. On big endian the change | ||
| 33 | + * shifted the data to the end of the field. Someone noticed for the | ||
| 34 | + * struct stat, and the armeb (big endian) case preserved the | ||
| 35 | + * unsigned short (yuck), but no so for stat64 (maybe this was deliberate, | ||
| 36 | + * but there is no evidence in the code of this.) Consequently a | ||
| 37 | + * fixup is necessary for the stat64 case. The fixup here is to | ||
| 38 | + * use the new structure when the change is detected. See below. | ||
| 39 | + */ | ||
| 40 | +struct __kernel_stat64_armeb { | ||
| 41 | + /* This definition changes the layout on big-endian from that | ||
| 42 | + * used in 2.4.31 - ABI change! Likewise for st_rdev. | ||
| 43 | + */ | ||
| 44 | + unsigned long long st_dev; | ||
| 45 | + unsigned char __pad0[4]; | ||
| 46 | + unsigned long __st_ino; | ||
| 47 | + unsigned int st_mode; | ||
| 48 | + unsigned int st_nlink; | ||
| 49 | + unsigned long st_uid; | ||
| 50 | + unsigned long st_gid; | ||
| 51 | + unsigned long long st_rdev; | ||
| 52 | + unsigned char __pad3[4]; | ||
| 53 | + long long st_size; | ||
| 54 | + unsigned long st_blksize; | ||
| 55 | + unsigned long __pad4; | ||
| 56 | + unsigned long st_blocks; | ||
| 57 | + unsigned long st_atime; | ||
| 58 | + unsigned long st_atime_nsec; | ||
| 59 | + unsigned long st_mtime; | ||
| 60 | + unsigned long st_mtime_nsec; | ||
| 61 | + unsigned long st_ctime; | ||
| 62 | + unsigned long st_ctime_nsec; | ||
| 63 | + unsigned long long st_ino; | ||
| 64 | +}; | ||
| 65 | + | ||
| 66 | +/* This fixup only works so long as the old struct stat64 is no | ||
| 67 | + * smaller than the new one - the caller of xstatconv uses the | ||
| 68 | + * *old* struct, but the kernel writes the new one. CASSERT | ||
| 69 | + * detects this at compile time. | ||
| 70 | + */ | ||
| 71 | +#define CASSERT(c) do switch (0) { case 0:; case (c):; } while (0) | ||
| 72 | + | ||
| 73 | +void __xstat64_conv_new(struct __kernel_stat64_armeb *kbuf, struct stat64 *buf) | ||
| 74 | +{ | ||
| 75 | + CASSERT(sizeof *kbuf <= sizeof (struct kernel_stat64)); | ||
| 76 | + | ||
| 77 | + /* Convert from new kernel version of `struct stat64'. */ | ||
| 78 | + buf->st_dev = kbuf->st_dev; | ||
| 79 | + buf->st_ino = kbuf->st_ino; | ||
| 80 | +#ifdef _HAVE_STAT64___ST_INO | ||
| 81 | + buf->__st_ino = kbuf->__st_ino; | ||
| 82 | +#endif | ||
| 83 | + buf->st_mode = kbuf->st_mode; | ||
| 84 | + buf->st_nlink = kbuf->st_nlink; | ||
| 85 | + buf->st_uid = kbuf->st_uid; | ||
| 86 | + buf->st_gid = kbuf->st_gid; | ||
| 87 | + buf->st_rdev = kbuf->st_rdev; | ||
| 88 | + buf->st_size = kbuf->st_size; | ||
| 89 | + buf->st_blksize = kbuf->st_blksize; | ||
| 90 | + buf->st_blocks = kbuf->st_blocks; | ||
| 91 | + buf->st_atime = kbuf->st_atime; | ||
| 92 | + buf->st_mtime = kbuf->st_mtime; | ||
| 93 | + buf->st_ctime = kbuf->st_ctime; | ||
| 94 | +} | ||
| 95 | +#define _MAY_HAVE_NEW_STAT64 1 | ||
| 96 | +#else | ||
| 97 | +#define _MAY_HAVE_NEW_STAT64 0 | ||
| 98 | +#endif | ||
| 99 | + | ||
| 100 | +/* The following is taken verbatim from xstatconv.c apart from | ||
| 101 | + * the addition of the _MAY_HAVE_NEW_STAT64 code. | ||
| 102 | + */ | ||
| 103 | void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) | ||
| 104 | { | ||
| 105 | /* Convert to current kernel version of `struct stat'. */ | ||
| 106 | @@ -53,6 +138,19 @@ | ||
| 107 | #if defined __UCLIBC_HAS_LFS__ | ||
| 108 | void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf) | ||
| 109 | { | ||
| 110 | +# if _MAY_HAVE_NEW_STAT64 | ||
| 111 | + /* This relies on any device (0,0) not being mountable - i.e. | ||
| 112 | + * it fails on Linux 2.4 if dev(0,0) is a mountable block file | ||
| 113 | + * system and itself contains it's own device. That doesn't | ||
| 114 | + * happen on Linux 2.4 so far as I can see, but even if it | ||
| 115 | + * does the API only fails (even then) if 2.4 didn't set all | ||
| 116 | + * of the pad bytes to 0 (and it does set them to zero.) | ||
| 117 | + */ | ||
| 118 | + if (kbuf->st_dev == 0 && kbuf->st_rdev == 0) { | ||
| 119 | + __xstat64_conv_new((struct __kernel_stat64_armeb*)kbuf, buf); | ||
| 120 | + return; | ||
| 121 | + } | ||
| 122 | +# endif | ||
| 123 | /* Convert to current kernel version of `struct stat64'. */ | ||
| 124 | buf->st_dev = kbuf->st_dev; | ||
| 125 | buf->st_ino = kbuf->st_ino; | ||
diff --git a/meta/recipes-core/uclibc/files/errno_values.h.patch b/meta/recipes-core/uclibc/files/errno_values.h.patch deleted file mode 100644 index a1e39c181b..0000000000 --- a/meta/recipes-core/uclibc/files/errno_values.h.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | Index: uClibc-0.9.29/libc/sysdeps/linux/common/bits/errno_values.h | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc-0.9.29/libc/sysdeps/linux/common/bits/errno_values.h 2002-08-23 20:48:19.000000000 +0200 | ||
| 4 | +++ uClibc-0.9.29/libc/sysdeps/linux/common/bits/errno_values.h 2007-07-01 22:11:53.000000000 +0200 | ||
| 5 | @@ -134,4 +134,16 @@ | ||
| 6 | #define ENOMEDIUM 123 /* No medium found */ | ||
| 7 | #define EMEDIUMTYPE 124 /* Wrong medium type */ | ||
| 8 | |||
| 9 | +/* the following errornumbers are only in 2.6 */ | ||
| 10 | + | ||
| 11 | +#define ECANCELED 125 /* Operation Canceled */ | ||
| 12 | +#define ENOKEY 126 /* Required key not available */ | ||
| 13 | +#define EKEYEXPIRED 127 /* Key has expired */ | ||
| 14 | +#define EKEYREVOKED 128 /* Key has been revoked */ | ||
| 15 | +#define EKEYREJECTED 129 /* Key was rejected by service */ | ||
| 16 | + | ||
| 17 | +/* for robust mutexes */ | ||
| 18 | +#define EOWNERDEAD 130 /* Owner died */ | ||
| 19 | +#define ENOTRECOVERABLE 131 /* State not recoverable */ | ||
| 20 | + | ||
| 21 | #endif /* _BITS_ERRNO_VALUES_H */ | ||
diff --git a/meta/recipes-core/uclibc/files/kernel-key-t-ipc.h.patch b/meta/recipes-core/uclibc/files/kernel-key-t-ipc.h.patch deleted file mode 100644 index 4cc4530470..0000000000 --- a/meta/recipes-core/uclibc/files/kernel-key-t-ipc.h.patch +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | # include/linux/posix_types.h defines __kernel_key_t as int, this file | ||
| 2 | # contains an identical definition. This results in a compiler error | ||
| 3 | # if both files are included. The ipc.h file, however, also includes | ||
| 4 | # bits/types.h, which typedefs __key_t to (int), therefore it must | ||
| 5 | # be safe to use __key_t in place of __kernel_key_t (given that C | ||
| 6 | # regards equivalent numeric typedefs as identical.) | ||
| 7 | --- uClibc-0.9.27/libc/sysdeps/linux/common/bits/ipc.h.orig 2005-05-07 13:36:04.448332211 -0700 | ||
| 8 | +++ uClibc-0.9.27/libc/sysdeps/linux/common/bits/ipc.h 2005-05-07 13:37:00.493885708 -0700 | ||
| 9 | @@ -35,9 +35,6 @@ | ||
| 10 | # define IPC_INFO 3 /* See ipcs. */ | ||
| 11 | #endif | ||
| 12 | |||
| 13 | -/* Type of a SYSV IPC key. */ | ||
| 14 | -typedef int __kernel_key_t; | ||
| 15 | - | ||
| 16 | /* Special key values. */ | ||
| 17 | #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ | ||
| 18 | |||
| 19 | @@ -45,7 +42,7 @@ | ||
| 20 | /* Data structure used to pass permission information to IPC operations. */ | ||
| 21 | struct ipc_perm | ||
| 22 | { | ||
| 23 | - __kernel_key_t __key; | ||
| 24 | + __key_t __key; | ||
| 25 | __kernel_uid_t uid; | ||
| 26 | __kernel_gid_t gid; | ||
| 27 | __kernel_uid_t cuid; | ||
diff --git a/meta/recipes-core/uclibc/files/nokernelheadercheck.patch b/meta/recipes-core/uclibc/files/nokernelheadercheck.patch deleted file mode 100644 index 9f09fb2ac9..0000000000 --- a/meta/recipes-core/uclibc/files/nokernelheadercheck.patch +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | |||
| 2 | # | ||
| 3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
| 4 | # | ||
| 5 | |||
| 6 | --- uClibc/Makefile~nokernelheadercheck | ||
| 7 | +++ uClibc/Makefile | ||
| 8 | @@ -121,11 +121,11 @@ | ||
| 9 | @./extra/config/conf -o extra/Configs/Config.in | ||
| 10 | |||
| 11 | headers: include/bits/uClibc_config.h | ||
| 12 | -ifeq ($(strip $(ARCH_HAS_MMU)),y) | ||
| 13 | - @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) | ||
| 14 | -else | ||
| 15 | - @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) -n | ||
| 16 | -endif | ||
| 17 | +#ifeq ($(strip $(ARCH_HAS_MMU)),y) | ||
| 18 | +# @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) | ||
| 19 | +#else | ||
| 20 | +# @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) -n | ||
| 21 | +#endif | ||
| 22 | @cd include/bits; \ | ||
| 23 | set -e; \ | ||
| 24 | for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \ | ||
diff --git a/meta/recipes-core/uclibc/files/termios.h.patch b/meta/recipes-core/uclibc/files/termios.h.patch deleted file mode 100644 index f7200ba393..0000000000 --- a/meta/recipes-core/uclibc/files/termios.h.patch +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | Index: uClibc-0.9.29/libc/sysdeps/linux/common/bits/termios.h | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc-0.9.29.orig/libc/sysdeps/linux/common/bits/termios.h 2006-02-13 09:41:37.000000000 +0100 | ||
| 4 | +++ uClibc-0.9.29/libc/sysdeps/linux/common/bits/termios.h 2007-07-03 00:41:27.000000000 +0200 | ||
| 5 | @@ -156,7 +156,6 @@ | ||
| 6 | #endif | ||
| 7 | #define B57600 0010001 | ||
| 8 | #define B115200 0010002 | ||
| 9 | -#if 0 /* limited on uClibc, keep in sync w/ cfsetspeed.c */ | ||
| 10 | #define B230400 0010003 | ||
| 11 | #define B460800 0010004 | ||
| 12 | #define B500000 0010005 | ||
| 13 | @@ -171,9 +170,6 @@ | ||
| 14 | #define B3500000 0010016 | ||
| 15 | #define B4000000 0010017 | ||
| 16 | #define __MAX_BAUD B4000000 | ||
| 17 | -#else | ||
| 18 | -#define __MAX_BAUD B115200 | ||
| 19 | -#endif | ||
| 20 | #ifdef __USE_MISC | ||
| 21 | # define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
| 22 | # define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
diff --git a/meta/recipes-core/uclibc/files/uClibc.distro b/meta/recipes-core/uclibc/files/uClibc.distro deleted file mode 100644 index d87b891b41..0000000000 --- a/meta/recipes-core/uclibc/files/uClibc.distro +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | # Default per-distro config | ||
| 2 | # DO NOT CHANGE THIS | ||
| 3 | # Create a new file ${DISTRO}/uClibc.distro | ||
diff --git a/meta/recipes-core/uclibc/site_config/funcs b/meta/recipes-core/uclibc/site_config/funcs index 79a3c19652..ccc85392d7 100644 --- a/meta/recipes-core/uclibc/site_config/funcs +++ b/meta/recipes-core/uclibc/site_config/funcs | |||
| @@ -121,6 +121,7 @@ gethostid | |||
| 121 | gethostname | 121 | gethostname |
| 122 | getifaddrs | 122 | getifaddrs |
| 123 | getline | 123 | getline |
| 124 | getloadavg | ||
| 124 | getmntent | 125 | getmntent |
| 125 | getmsg | 126 | getmsg |
| 126 | getnameinfo | 127 | getnameinfo |
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.distro b/meta/recipes-core/uclibc/uClibc.distro index 042ea4c547..e25324d3d1 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.distro +++ b/meta/recipes-core/uclibc/uClibc.distro | |||
| @@ -17,8 +17,9 @@ UCLIBC_CTOR_DTOR=y | |||
| 17 | LDSO_GNU_HASH_SUPPORT=y | 17 | LDSO_GNU_HASH_SUPPORT=y |
| 18 | # HAS_NO_THREADS is not set | 18 | # HAS_NO_THREADS is not set |
| 19 | UCLIBC_HAS_THREADS=y | 19 | UCLIBC_HAS_THREADS=y |
| 20 | UCLIBC_HAS_THREADS_NATIVE=y | ||
| 20 | PTHREADS_DEBUG_SUPPORT=y | 21 | PTHREADS_DEBUG_SUPPORT=y |
| 21 | LINUXTHREADS_OLD=y | 22 | # LINUXTHREADS_OLD is not set |
| 22 | UCLIBC_HAS_LFS=y | 23 | UCLIBC_HAS_LFS=y |
| 23 | # MALLOC is not set | 24 | # MALLOC is not set |
| 24 | # MALLOC_SIMPLE is not set | 25 | # MALLOC_SIMPLE is not set |
| @@ -28,12 +29,13 @@ UCLIBC_DYNAMIC_ATEXIT=y | |||
| 28 | COMPAT_ATEXIT=y | 29 | COMPAT_ATEXIT=y |
| 29 | UCLIBC_SUSV3_LEGACY=y | 30 | UCLIBC_SUSV3_LEGACY=y |
| 30 | UCLIBC_SUSV3_LEGACY_MACROS=y | 31 | UCLIBC_SUSV3_LEGACY_MACROS=y |
| 32 | UCLIBC_SUSV4_LEGACY=y | ||
| 31 | UCLIBC_HAS_SHADOW=y | 33 | UCLIBC_HAS_SHADOW=y |
| 32 | UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y | 34 | UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y |
| 33 | UCLIBC_HAS___PROGNAME=y | 35 | UCLIBC_HAS___PROGNAME=y |
| 34 | UNIX98PTY_ONLY=y | 36 | UNIX98PTY_ONLY=y |
| 35 | UCLIBC_HAS_GETPT=y | ||
| 36 | ASSUME_DEVPTS=y | 37 | ASSUME_DEVPTS=y |
| 38 | UCLIBC_HAS_LIBUTIL=y | ||
| 37 | UCLIBC_HAS_TM_EXTENSIONS=y | 39 | UCLIBC_HAS_TM_EXTENSIONS=y |
| 38 | UCLIBC_HAS_TZ_CACHING=y | 40 | UCLIBC_HAS_TZ_CACHING=y |
| 39 | UCLIBC_HAS_TZ_FILE=y | 41 | UCLIBC_HAS_TZ_FILE=y |
| @@ -53,8 +55,12 @@ UCLIBC_HAS_IPV6=y | |||
| 53 | UCLIBC_HAS_RPC=y | 55 | UCLIBC_HAS_RPC=y |
| 54 | UCLIBC_HAS_FULL_RPC=y | 56 | UCLIBC_HAS_FULL_RPC=y |
| 55 | # UCLIBC_HAS_REENTRANT_RPC is not set | 57 | # UCLIBC_HAS_REENTRANT_RPC is not set |
| 56 | # UCLIBC_USE_NETLINK is not set | 58 | UCLIBC_USE_NETLINK=y |
| 57 | # UCLIBC_HAS_BSD_RES_CLOSE is not set | 59 | UCLIBC_SUPPORT_AI_ADDRCONFIG=y |
| 60 | |||
| 61 | UCLIBC_HAS_BSD_RES_CLOSE=y | ||
| 62 | UCLIBC_HAS_LIBRESOLV_STUB=y | ||
| 63 | UCLIBC_HAS_LIBNSL_STUB=y | ||
| 58 | 64 | ||
| 59 | # | 65 | # |
| 60 | # String and Stdio Support | 66 | # String and Stdio Support |
| @@ -83,8 +89,8 @@ UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y | |||
| 83 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set | 89 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set |
| 84 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set | 90 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set |
| 85 | # UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set | 91 | # UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set |
| 86 | # UCLIBC_HAS_STDIO_GETC_MACRO is not set | 92 | UCLIBC_HAS_STDIO_GETC_MACRO=y |
| 87 | # UCLIBC_HAS_STDIO_PUTC_MACRO is not set | 93 | UCLIBC_HAS_STDIO_PUTC_MACRO=y |
| 88 | UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y | 94 | UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y |
| 89 | # UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set | 95 | # UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set |
| 90 | UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y | 96 | UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y |
| @@ -105,7 +111,9 @@ UCLIBC_HAS_REGEX=y | |||
| 105 | UCLIBC_HAS_FNMATCH=y | 111 | UCLIBC_HAS_FNMATCH=y |
| 106 | # UCLIBC_HAS_FNMATCH_OLD is not set | 112 | # UCLIBC_HAS_FNMATCH_OLD is not set |
| 107 | UCLIBC_HAS_WORDEXP=y | 113 | UCLIBC_HAS_WORDEXP=y |
| 114 | UCLIBC_HAS_NFTW=y | ||
| 108 | UCLIBC_HAS_FTW=y | 115 | UCLIBC_HAS_FTW=y |
| 116 | UCLIBC_HAS_FTS=y | ||
| 109 | UCLIBC_HAS_GLOB=y | 117 | UCLIBC_HAS_GLOB=y |
| 110 | UCLIBC_HAS_GNU_GLOB=y | 118 | UCLIBC_HAS_GNU_GLOB=y |
| 111 | 119 | ||
| @@ -134,7 +142,7 @@ CROSS_COMPILER_PREFIX="" | |||
| 134 | UCLIBC_EXTRA_CFLAGS="" | 142 | UCLIBC_EXTRA_CFLAGS="" |
| 135 | # DODEBUG is not set | 143 | # DODEBUG is not set |
| 136 | # DODEBUG_PT is not set | 144 | # DODEBUG_PT is not set |
| 137 | DOSTRIP=n | 145 | # DOSTRIP is not set |
| 138 | # DOASSERTS is not set | 146 | # DOASSERTS is not set |
| 139 | # SUPPORT_LD_DEBUG is not set | 147 | # SUPPORT_LD_DEBUG is not set |
| 140 | # SUPPORT_LD_DEBUG_EARLY is not set | 148 | # SUPPORT_LD_DEBUG_EARLY is not set |
| @@ -146,3 +154,4 @@ WARNINGS="-Wall" | |||
| 146 | 154 | ||
| 147 | # math stuff for perl | 155 | # math stuff for perl |
| 148 | DO_C99_MATH=y | 156 | DO_C99_MATH=y |
| 157 | UCLIBC_HAS_LONG_DOUBLE_MATH=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/Use-__always_inline-instead-of-__inline__.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/Use-__always_inline-instead-of-__inline__.patch deleted file mode 100644 index a9c7a4fb10..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/Use-__always_inline-instead-of-__inline__.patch +++ /dev/null | |||
| @@ -1,393 +0,0 @@ | |||
| 1 | From c190f738e1b0e87658ea5f86c057fb147dc19428 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Carmelo Amoroso <carmelo.amoroso@st.com> | ||
| 3 | Date: Thu, 5 Mar 2009 13:28:55 +0000 | ||
| 4 | Subject: [PATCH] Use __always_inline instead of __inline__ | ||
| 5 | |||
| 6 | --- | ||
| 7 | ldso/ldso/arm/dl-sysdep.h | 8 ++++---- | ||
| 8 | ldso/ldso/bfin/dl-sysdep.h | 2 +- | ||
| 9 | ldso/ldso/cris/dl-sysdep.h | 6 +++--- | ||
| 10 | ldso/ldso/i386/dl-sysdep.h | 10 +++++----- | ||
| 11 | ldso/ldso/m68k/dl-sysdep.h | 6 +++--- | ||
| 12 | ldso/ldso/mips/dl-sysdep.h | 8 ++++---- | ||
| 13 | ldso/ldso/powerpc/dl-sysdep.h | 8 ++++---- | ||
| 14 | ldso/ldso/sh/dl-sysdep.h | 8 ++++---- | ||
| 15 | ldso/ldso/sh64/dl-sysdep.h | 6 +++--- | ||
| 16 | ldso/ldso/sparc/dl-sysdep.h | 8 ++++---- | ||
| 17 | ldso/ldso/xtensa/dl-sysdep.h | 6 +++--- | ||
| 18 | 11 files changed, 38 insertions(+), 38 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h | ||
| 21 | index eea3b98..5191dd7 100644 | ||
| 22 | --- a/ldso/ldso/arm/dl-sysdep.h | ||
| 23 | +++ b/ldso/ldso/arm/dl-sysdep.h | ||
| 24 | @@ -15,7 +15,7 @@ | ||
| 25 | GOT_BASE[1] = (unsigned long) MODULE; \ | ||
| 26 | } | ||
| 27 | |||
| 28 | -static __inline__ unsigned long arm_modulus(unsigned long m, unsigned long p) | ||
| 29 | +static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p) | ||
| 30 | { | ||
| 31 | unsigned long i,t,inc; | ||
| 32 | i=p; t=0; | ||
| 33 | @@ -67,7 +67,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); | ||
| 34 | first element of the GOT. We used to use the PIC register to do this | ||
| 35 | without a constant pool reference, but GCC 4.2 will use a pseudo-register | ||
| 36 | for the PIC base, so it may not be in r10. */ | ||
| 37 | -static __inline__ Elf32_Addr __attribute__ ((unused)) | ||
| 38 | +static __always_inline Elf32_Addr __attribute__ ((unused)) | ||
| 39 | elf_machine_dynamic (void) | ||
| 40 | { | ||
| 41 | Elf32_Addr dynamic; | ||
| 42 | @@ -99,7 +99,7 @@ elf_machine_dynamic (void) | ||
| 43 | } | ||
| 44 | |||
| 45 | /* Return the run-time load address of the shared object. */ | ||
| 46 | -static __inline__ Elf32_Addr __attribute__ ((unused)) | ||
| 47 | +static __always_inline Elf32_Addr __attribute__ ((unused)) | ||
| 48 | elf_machine_load_address (void) | ||
| 49 | { | ||
| 50 | extern void __dl_start __asm__ ("_dl_start"); | ||
| 51 | @@ -123,7 +123,7 @@ elf_machine_load_address (void) | ||
| 52 | return pcrel_addr - got_addr; | ||
| 53 | } | ||
| 54 | |||
| 55 | -static __inline__ void | ||
| 56 | +static __always_inline void | ||
| 57 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 58 | Elf32_Word relative_count) | ||
| 59 | { | ||
| 60 | diff --git a/ldso/ldso/bfin/dl-sysdep.h b/ldso/ldso/bfin/dl-sysdep.h | ||
| 61 | index 3c88da4..f0c5129 100644 | ||
| 62 | --- a/ldso/ldso/bfin/dl-sysdep.h | ||
| 63 | +++ b/ldso/ldso/bfin/dl-sysdep.h | ||
| 64 | @@ -210,7 +210,7 @@ while (0) | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #include <elf.h> | ||
| 68 | -static __inline__ void | ||
| 69 | +static __always_inline void | ||
| 70 | elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr, | ||
| 71 | Elf32_Word relative_count) | ||
| 72 | { | ||
| 73 | diff --git a/ldso/ldso/cris/dl-sysdep.h b/ldso/ldso/cris/dl-sysdep.h | ||
| 74 | index ffb763a..e454c10 100644 | ||
| 75 | --- a/ldso/ldso/cris/dl-sysdep.h | ||
| 76 | +++ b/ldso/ldso/cris/dl-sysdep.h | ||
| 77 | @@ -37,7 +37,7 @@ extern unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entr | ||
| 78 | || ((type) == R_CRIS_GLOB_DAT)) * ELF_RTYPE_CLASS_PLT) \ | ||
| 79 | | (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY)) | ||
| 80 | |||
| 81 | -static __inline__ Elf32_Addr | ||
| 82 | +static __always_inline Elf32_Addr | ||
| 83 | elf_machine_dynamic(void) | ||
| 84 | { | ||
| 85 | /* Don't just set this to an asm variable "r0" since that's not logical | ||
| 86 | @@ -59,7 +59,7 @@ elf_machine_dynamic(void) | ||
| 87 | there's some other symbol we could use, that we don't *have* to force a | ||
| 88 | GOT entry for. */ | ||
| 89 | |||
| 90 | -static __inline__ Elf32_Addr | ||
| 91 | +static __always_inline Elf32_Addr | ||
| 92 | elf_machine_load_address(void) | ||
| 93 | { | ||
| 94 | Elf32_Addr gotaddr_diff; | ||
| 95 | @@ -93,7 +93,7 @@ elf_machine_load_address(void) | ||
| 96 | return gotaddr_diff; | ||
| 97 | } | ||
| 98 | |||
| 99 | -static __inline__ void | ||
| 100 | +static __always_inline void | ||
| 101 | elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 102 | Elf32_Word relative_count) | ||
| 103 | { | ||
| 104 | diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h | ||
| 105 | index 77fa372..6e84861 100644 | ||
| 106 | --- a/ldso/ldso/i386/dl-sysdep.h | ||
| 107 | +++ b/ldso/ldso/i386/dl-sysdep.h | ||
| 108 | @@ -37,8 +37,8 @@ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_ent | ||
| 109 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 110 | first element of the GOT. This must be inlined in a function which | ||
| 111 | uses global data. */ | ||
| 112 | -static __inline__ Elf32_Addr elf_machine_dynamic (void) attribute_unused; | ||
| 113 | -static __inline__ Elf32_Addr | ||
| 114 | +static __always_inline Elf32_Addr elf_machine_dynamic (void) attribute_unused; | ||
| 115 | +static __always_inline Elf32_Addr | ||
| 116 | elf_machine_dynamic (void) | ||
| 117 | { | ||
| 118 | register Elf32_Addr *got __asm__ ("%ebx"); | ||
| 119 | @@ -47,8 +47,8 @@ elf_machine_dynamic (void) | ||
| 120 | |||
| 121 | |||
| 122 | /* Return the run-time load address of the shared object. */ | ||
| 123 | -static __inline__ Elf32_Addr elf_machine_load_address (void) attribute_unused; | ||
| 124 | -static __inline__ Elf32_Addr | ||
| 125 | +static __always_inline Elf32_Addr elf_machine_load_address (void) attribute_unused; | ||
| 126 | +static __always_inline Elf32_Addr | ||
| 127 | elf_machine_load_address (void) | ||
| 128 | { | ||
| 129 | /* It doesn't matter what variable this is, the reference never makes | ||
| 130 | @@ -61,7 +61,7 @@ elf_machine_load_address (void) | ||
| 131 | return addr; | ||
| 132 | } | ||
| 133 | |||
| 134 | -static __inline__ void | ||
| 135 | +static __always_inline void | ||
| 136 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 137 | Elf32_Word relative_count) | ||
| 138 | { | ||
| 139 | diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h | ||
| 140 | index 8e26e20..259cb84 100644 | ||
| 141 | --- a/ldso/ldso/m68k/dl-sysdep.h | ||
| 142 | +++ b/ldso/ldso/m68k/dl-sysdep.h | ||
| 143 | @@ -39,7 +39,7 @@ extern unsigned long _dl_linux_resolver (struct elf_resolve *, int); | ||
| 144 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 145 | first element of the GOT. This must be inlined in a function which | ||
| 146 | uses global data. */ | ||
| 147 | -static __inline__ Elf32_Addr | ||
| 148 | +static __always_inline Elf32_Addr | ||
| 149 | elf_machine_dynamic (void) | ||
| 150 | { | ||
| 151 | register Elf32_Addr *got __asm__ ("%a5"); | ||
| 152 | @@ -48,7 +48,7 @@ elf_machine_dynamic (void) | ||
| 153 | |||
| 154 | |||
| 155 | /* Return the run-time load address of the shared object. */ | ||
| 156 | -static __inline__ Elf32_Addr | ||
| 157 | +static __always_inline Elf32_Addr | ||
| 158 | elf_machine_load_address (void) | ||
| 159 | { | ||
| 160 | Elf32_Addr addr; | ||
| 161 | @@ -58,7 +58,7 @@ elf_machine_load_address (void) | ||
| 162 | return addr; | ||
| 163 | } | ||
| 164 | |||
| 165 | -static __inline__ void | ||
| 166 | +static __always_inline void | ||
| 167 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 168 | Elf32_Word relative_count) | ||
| 169 | { | ||
| 170 | diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h | ||
| 171 | index cf6b28b..30d84fb 100644 | ||
| 172 | --- a/ldso/ldso/mips/dl-sysdep.h | ||
| 173 | +++ b/ldso/ldso/mips/dl-sysdep.h | ||
| 174 | @@ -169,7 +169,7 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy) | ||
| 175 | |||
| 176 | #define OFFSET_GP_GOT 0x7ff0 | ||
| 177 | |||
| 178 | -static __inline__ ElfW(Addr) * | ||
| 179 | +static __always_inline ElfW(Addr) * | ||
| 180 | elf_mips_got_from_gpreg (ElfW(Addr) gpreg) | ||
| 181 | { | ||
| 182 | /* FIXME: the offset of gp from GOT may be system-dependent. */ | ||
| 183 | @@ -179,7 +179,7 @@ elf_mips_got_from_gpreg (ElfW(Addr) gpreg) | ||
| 184 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 185 | first element of the GOT. This must be inlined in a function which | ||
| 186 | uses global data. We assume its $gp points to the primary GOT. */ | ||
| 187 | -static __inline__ ElfW(Addr) | ||
| 188 | +static __always_inline ElfW(Addr) | ||
| 189 | elf_machine_dynamic (void) | ||
| 190 | { | ||
| 191 | register ElfW(Addr) gp __asm__ ("$28"); | ||
| 192 | @@ -198,7 +198,7 @@ elf_machine_dynamic (void) | ||
| 193 | #endif | ||
| 194 | |||
| 195 | /* Return the run-time load address of the shared object. */ | ||
| 196 | -static __inline__ ElfW(Addr) | ||
| 197 | +static __always_inline ElfW(Addr) | ||
| 198 | elf_machine_load_address (void) | ||
| 199 | { | ||
| 200 | ElfW(Addr) addr; | ||
| 201 | @@ -214,7 +214,7 @@ elf_machine_load_address (void) | ||
| 202 | return addr; | ||
| 203 | } | ||
| 204 | |||
| 205 | -static __inline__ void | ||
| 206 | +static __always_inline void | ||
| 207 | elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr, | ||
| 208 | ElfW(Word) relative_count) | ||
| 209 | { | ||
| 210 | diff --git a/ldso/ldso/powerpc/dl-sysdep.h b/ldso/ldso/powerpc/dl-sysdep.h | ||
| 211 | index fdbf564..f33214c 100644 | ||
| 212 | --- a/ldso/ldso/powerpc/dl-sysdep.h | ||
| 213 | +++ b/ldso/ldso/powerpc/dl-sysdep.h | ||
| 214 | @@ -85,7 +85,7 @@ void _dl_init_got(unsigned long *lpnt,struct elf_resolve *tpnt); | ||
| 215 | #define ELF_MACHINE_PLTREL_OVERLAP 1 | ||
| 216 | |||
| 217 | /* Return the value of the GOT pointer. */ | ||
| 218 | -static __inline__ Elf32_Addr * __attribute__ ((const)) | ||
| 219 | +static __always_inline Elf32_Addr * __attribute__ ((const)) | ||
| 220 | ppc_got (void) | ||
| 221 | { | ||
| 222 | Elf32_Addr *got; | ||
| 223 | @@ -104,14 +104,14 @@ ppc_got (void) | ||
| 224 | |||
| 225 | /* Return the link-time address of _DYNAMIC, stored as | ||
| 226 | the first value in the GOT. */ | ||
| 227 | -static __inline__ Elf32_Addr __attribute__ ((const)) | ||
| 228 | +static __always_inline Elf32_Addr __attribute__ ((const)) | ||
| 229 | elf_machine_dynamic (void) | ||
| 230 | { | ||
| 231 | return *ppc_got(); | ||
| 232 | } | ||
| 233 | |||
| 234 | /* Return the run-time load address of the shared object. */ | ||
| 235 | -static __inline__ Elf32_Addr __attribute__ ((const)) | ||
| 236 | +static __always_inline Elf32_Addr __attribute__ ((const)) | ||
| 237 | elf_machine_load_address (void) | ||
| 238 | { | ||
| 239 | Elf32_Addr *branchaddr; | ||
| 240 | @@ -159,7 +159,7 @@ elf_machine_load_address (void) | ||
| 241 | return runtime_dynamic - elf_machine_dynamic (); | ||
| 242 | } | ||
| 243 | |||
| 244 | -static __inline__ void | ||
| 245 | +static __always_inline void | ||
| 246 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 247 | Elf32_Word relative_count) | ||
| 248 | { | ||
| 249 | diff --git a/ldso/ldso/sh/dl-sysdep.h b/ldso/ldso/sh/dl-sysdep.h | ||
| 250 | index daedda5..d4fc784 100644 | ||
| 251 | --- a/ldso/ldso/sh/dl-sysdep.h | ||
| 252 | +++ b/ldso/ldso/sh/dl-sysdep.h | ||
| 253 | @@ -25,7 +25,7 @@ | ||
| 254 | struct elf_resolve; | ||
| 255 | extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); | ||
| 256 | |||
| 257 | -static __inline__ unsigned int | ||
| 258 | +static __always_inline unsigned int | ||
| 259 | _dl_urem(unsigned int n, unsigned int base) | ||
| 260 | { | ||
| 261 | int res; | ||
| 262 | @@ -95,7 +95,7 @@ _dl_urem(unsigned int n, unsigned int base) | ||
| 263 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 264 | first element of the GOT. This must be inlined in a function which | ||
| 265 | uses global data. */ | ||
| 266 | -static __inline__ Elf32_Addr __attribute__ ((unused)) | ||
| 267 | +static __always_inline Elf32_Addr __attribute__ ((unused)) | ||
| 268 | elf_machine_dynamic (void) | ||
| 269 | { | ||
| 270 | register Elf32_Addr *got; | ||
| 271 | @@ -104,7 +104,7 @@ elf_machine_dynamic (void) | ||
| 272 | } | ||
| 273 | |||
| 274 | /* Return the run-time load address of the shared object. */ | ||
| 275 | -static __inline__ Elf32_Addr __attribute__ ((unused)) | ||
| 276 | +static __always_inline Elf32_Addr __attribute__ ((unused)) | ||
| 277 | elf_machine_load_address (void) | ||
| 278 | { | ||
| 279 | Elf32_Addr addr; | ||
| 280 | @@ -146,7 +146,7 @@ elf_machine_load_address (void) | ||
| 281 | } \ | ||
| 282 | } | ||
| 283 | |||
| 284 | -static __inline__ void | ||
| 285 | +static __always_inline void | ||
| 286 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 287 | Elf32_Word relative_count) | ||
| 288 | { | ||
| 289 | diff --git a/ldso/ldso/sh64/dl-sysdep.h b/ldso/ldso/sh64/dl-sysdep.h | ||
| 290 | index fc67b12..15d9b5e 100644 | ||
| 291 | --- a/ldso/ldso/sh64/dl-sysdep.h | ||
| 292 | +++ b/ldso/ldso/sh64/dl-sysdep.h | ||
| 293 | @@ -41,7 +41,7 @@ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_ent | ||
| 294 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 295 | first element of the GOT. This must be inlined in a function which | ||
| 296 | uses global data. */ | ||
| 297 | -static __inline__ Elf32_Addr elf_machine_dynamic(void) | ||
| 298 | +static __always_inline Elf32_Addr elf_machine_dynamic(void) | ||
| 299 | { | ||
| 300 | register Elf32_Addr *got; | ||
| 301 | |||
| 302 | @@ -69,7 +69,7 @@ static __inline__ Elf32_Addr elf_machine_dynamic(void) | ||
| 303 | } | ||
| 304 | |||
| 305 | /* Return the run-time load address of the shared object. */ | ||
| 306 | -static __inline__ Elf32_Addr elf_machine_load_address(void) | ||
| 307 | +static __always_inline Elf32_Addr elf_machine_load_address(void) | ||
| 308 | { | ||
| 309 | Elf32_Addr addr; | ||
| 310 | |||
| 311 | @@ -122,7 +122,7 @@ static __inline__ Elf32_Addr elf_machine_load_address(void) | ||
| 312 | } \ | ||
| 313 | } | ||
| 314 | |||
| 315 | -static __inline__ void | ||
| 316 | +static __always_inline void | ||
| 317 | elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 318 | Elf32_Word relative_count) | ||
| 319 | { | ||
| 320 | diff --git a/ldso/ldso/sparc/dl-sysdep.h b/ldso/ldso/sparc/dl-sysdep.h | ||
| 321 | index 7936517..ebfa268 100644 | ||
| 322 | --- a/ldso/ldso/sparc/dl-sysdep.h | ||
| 323 | +++ b/ldso/ldso/sparc/dl-sysdep.h | ||
| 324 | @@ -52,7 +52,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); | ||
| 325 | |||
| 326 | #ifndef COMPILE_ASM | ||
| 327 | /* Cheap modulo implementation, taken from arm/ld_sysdep.h. */ | ||
| 328 | -static __inline__ unsigned long | ||
| 329 | +static __always_inline unsigned long | ||
| 330 | sparc_mod(unsigned long m, unsigned long p) | ||
| 331 | { | ||
| 332 | unsigned long i, t, inc; | ||
| 333 | @@ -118,7 +118,7 @@ do { register Elf32_Addr pc __asm__("o7"); \ | ||
| 334 | /* Return the link-time address of _DYNAMIC. Conveniently, this is the | ||
| 335 | first element of the GOT. This must be inlined in a function which | ||
| 336 | uses global data. */ | ||
| 337 | -static __inline__ Elf32_Addr | ||
| 338 | +static __always_inline Elf32_Addr | ||
| 339 | elf_machine_dynamic (void) | ||
| 340 | { | ||
| 341 | register Elf32_Addr *got __asm__ ("%l7"); | ||
| 342 | @@ -129,7 +129,7 @@ elf_machine_dynamic (void) | ||
| 343 | } | ||
| 344 | |||
| 345 | /* Return the run-time load address of the shared object. */ | ||
| 346 | -static __inline__ Elf32_Addr | ||
| 347 | +static __always_inline Elf32_Addr | ||
| 348 | elf_machine_load_address (void) | ||
| 349 | { | ||
| 350 | register Elf32_Addr *pc __asm__ ("%o7"), *got __asm__ ("%l7"); | ||
| 351 | @@ -148,7 +148,7 @@ elf_machine_load_address (void) | ||
| 352 | return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4; | ||
| 353 | } | ||
| 354 | |||
| 355 | -static __inline__ void | ||
| 356 | +static __always_inline void | ||
| 357 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 358 | Elf32_Word relative_count) | ||
| 359 | { | ||
| 360 | diff --git a/ldso/ldso/xtensa/dl-sysdep.h b/ldso/ldso/xtensa/dl-sysdep.h | ||
| 361 | index daae428..07b9b79 100644 | ||
| 362 | --- a/ldso/ldso/xtensa/dl-sysdep.h | ||
| 363 | +++ b/ldso/ldso/xtensa/dl-sysdep.h | ||
| 364 | @@ -85,7 +85,7 @@ extern unsigned long _dl_linux_resolver (struct elf_resolve *, int); | ||
| 365 | (((type) == R_XTENSA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) | ||
| 366 | |||
| 367 | /* Return the link-time address of _DYNAMIC. */ | ||
| 368 | -static __inline__ Elf32_Addr | ||
| 369 | +static __always_inline Elf32_Addr | ||
| 370 | elf_machine_dynamic (void) | ||
| 371 | { | ||
| 372 | /* This function is only used while bootstrapping the runtime linker. | ||
| 373 | @@ -95,7 +95,7 @@ elf_machine_dynamic (void) | ||
| 374 | } | ||
| 375 | |||
| 376 | /* Return the run-time load address of the shared object. */ | ||
| 377 | -static __inline__ Elf32_Addr | ||
| 378 | +static __always_inline Elf32_Addr | ||
| 379 | elf_machine_load_address (void) | ||
| 380 | { | ||
| 381 | Elf32_Addr addr, tmp; | ||
| 382 | @@ -116,7 +116,7 @@ elf_machine_load_address (void) | ||
| 383 | return addr - 3; | ||
| 384 | } | ||
| 385 | |||
| 386 | -static __inline__ void | ||
| 387 | +static __always_inline void | ||
| 388 | elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, | ||
| 389 | Elf32_Word relative_count) | ||
| 390 | { | ||
| 391 | -- | ||
| 392 | 1.6.3.3.444.g4ecbc | ||
| 393 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/arm-linuxthreads.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/arm-linuxthreads.patch deleted file mode 100644 index e222668a66..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/arm-linuxthreads.patch +++ /dev/null | |||
| @@ -1,218 +0,0 @@ | |||
| 1 | Index: uClibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S | ||
| 2 | =================================================================== | ||
| 3 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 4 | +++ uClibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S 2008-08-28 00:22:06.278340855 +0200 | ||
| 5 | @@ -0,0 +1,78 @@ | ||
| 6 | +/* Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc. | ||
| 7 | + This file is part of the GNU C Library. | ||
| 8 | + Contributed by Philip Blundell <philb@gnu.org>. | ||
| 9 | + | ||
| 10 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 11 | + modify it under the terms of the GNU Lesser General Public | ||
| 12 | + License as published by the Free Software Foundation; either | ||
| 13 | + version 2.1 of the License, or (at your option) any later version. | ||
| 14 | + | ||
| 15 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 | + Lesser General Public License for more details. | ||
| 19 | + | ||
| 20 | + You should have received a copy of the GNU Lesser General Public | ||
| 21 | + License along with the GNU C Library; if not, write to the Free | ||
| 22 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 23 | + 02111-1307 USA. */ | ||
| 24 | + | ||
| 25 | +#include <sysdep-cancel.h> | ||
| 26 | +#define _ERRNO_H 1 | ||
| 27 | +#include <bits/errno.h> | ||
| 28 | +#include <kernel-features.h> | ||
| 29 | + | ||
| 30 | +/* Clone the calling process, but without copying the whole address space. | ||
| 31 | + The calling process is suspended until the new process exits or is | ||
| 32 | + replaced by a call to `execve'. Return -1 for errors, 0 to the new process, | ||
| 33 | + and the process ID of the new process to the old process. */ | ||
| 34 | + | ||
| 35 | +ENTRY (__vfork) | ||
| 36 | + | ||
| 37 | +#ifdef __NR_vfork | ||
| 38 | + | ||
| 39 | +#ifdef SHARED | ||
| 40 | + ldr ip, 1f | ||
| 41 | + ldr r0, 2f | ||
| 42 | +3: add ip, pc, ip | ||
| 43 | + ldr r0, [ip, r0] | ||
| 44 | +#else | ||
| 45 | + ldr r0, 1f | ||
| 46 | +#endif | ||
| 47 | + movs r0, r0 | ||
| 48 | + bne HIDDEN_JUMPTARGET (__fork) | ||
| 49 | + | ||
| 50 | + DO_CALL (vfork, 0) | ||
| 51 | + cmn a1, #4096 | ||
| 52 | + RETINSTR(cc, lr) | ||
| 53 | + | ||
| 54 | +#ifndef __ASSUME_VFORK_SYSCALL | ||
| 55 | + /* Check if vfork syscall is known at all. */ | ||
| 56 | + cmn a1, #ENOSYS | ||
| 57 | + bne PLTJMP(C_SYMBOL_NAME(__syscall_error)) | ||
| 58 | +#endif | ||
| 59 | + | ||
| 60 | +#endif | ||
| 61 | + | ||
| 62 | +#ifndef __ASSUME_VFORK_SYSCALL | ||
| 63 | + /* If we don't have vfork, fork is close enough. */ | ||
| 64 | + DO_CALL (fork, 0) | ||
| 65 | + cmn a1, #4096 | ||
| 66 | + RETINSTR(cc, lr) | ||
| 67 | +#elif !defined __NR_vfork | ||
| 68 | +# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined" | ||
| 69 | +#endif | ||
| 70 | + b PLTJMP(C_SYMBOL_NAME(__syscall_error)) | ||
| 71 | + | ||
| 72 | +#ifdef SHARED | ||
| 73 | +1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 8 | ||
| 74 | +2: .word __libc_pthread_functions(GOTOFF) | ||
| 75 | +#else | ||
| 76 | + .weak pthread_create | ||
| 77 | +1: .word pthread_create | ||
| 78 | +#endif | ||
| 79 | + | ||
| 80 | +PSEUDO_END (__vfork) | ||
| 81 | +libc_hidden_def (__vfork) | ||
| 82 | + | ||
| 83 | +weak_alias (__vfork, vfork) | ||
| 84 | Index: uClibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | ||
| 85 | =================================================================== | ||
| 86 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 87 | +++ uClibc/libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h 2008-08-28 00:28:04.301636993 +0200 | ||
| 88 | @@ -0,0 +1,130 @@ | ||
| 89 | +/* Copyright (C) 2003, 2005 Free Software Foundation, Inc. | ||
| 90 | + This file is part of the GNU C Library. | ||
| 91 | + Contributed by Phil Blundell <pb@nexus.co.uk>, 2003. | ||
| 92 | + | ||
| 93 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 94 | + modify it under the terms of the GNU Lesser General Public | ||
| 95 | + License as published by the Free Software Foundation; either | ||
| 96 | + version 2.1 of the License, or (at your option) any later version. | ||
| 97 | + | ||
| 98 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 99 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 100 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 101 | + Lesser General Public License for more details. | ||
| 102 | + | ||
| 103 | + You should have received a copy of the GNU Lesser General Public | ||
| 104 | + License along with the GNU C Library; if not, write to the Free | ||
| 105 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 106 | + 02111-1307 USA. */ | ||
| 107 | + | ||
| 108 | +#include <tls.h> | ||
| 109 | +#include <pt-machine.h> | ||
| 110 | +#ifndef __ASSEMBLER__ | ||
| 111 | +# include <linuxthreads/internals.h> | ||
| 112 | +#endif | ||
| 113 | + | ||
| 114 | +#if !defined NOT_IN_libc || defined IS_IN_libpthread | ||
| 115 | + | ||
| 116 | +/* We push lr onto the stack, so we have to use ldmib instead of ldmia | ||
| 117 | + to find the saved arguments. */ | ||
| 118 | +# ifdef PIC | ||
| 119 | +# undef DOARGS_5 | ||
| 120 | +# undef DOARGS_6 | ||
| 121 | +# undef DOARGS_7 | ||
| 122 | +# define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $8]; | ||
| 123 | +# define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmib ip, {r4, r5}; | ||
| 124 | +# define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmib ip, {r4, r5, r6}; | ||
| 125 | +# endif | ||
| 126 | + | ||
| 127 | +# undef PSEUDO_RET | ||
| 128 | +# define PSEUDO_RET \ | ||
| 129 | + ldrcc pc, [sp], $4; \ | ||
| 130 | + ldr lr, [sp], $4; \ | ||
| 131 | + b PLTJMP(SYSCALL_ERROR) | ||
| 132 | + | ||
| 133 | +# undef PSEUDO | ||
| 134 | +# define PSEUDO(name, syscall_name, args) \ | ||
| 135 | + .section ".text"; \ | ||
| 136 | + PSEUDO_PROLOGUE; \ | ||
| 137 | + ENTRY (name); \ | ||
| 138 | + SINGLE_THREAD_P; \ | ||
| 139 | + bne .Lpseudo_cancel; \ | ||
| 140 | + DO_CALL (syscall_name, args); \ | ||
| 141 | + cmn r0, $4096; \ | ||
| 142 | + RETINSTR(cc, lr); \ | ||
| 143 | + b PLTJMP(SYSCALL_ERROR); \ | ||
| 144 | + .Lpseudo_cancel: \ | ||
| 145 | + str lr, [sp, $-4]!; \ | ||
| 146 | + DOCARGS_##args; /* save syscall args around CENABLE. */ \ | ||
| 147 | + CENABLE; \ | ||
| 148 | + mov ip, r0; /* put mask in safe place. */ \ | ||
| 149 | + UNDOCARGS_##args; /* restore syscall args. */ \ | ||
| 150 | + swi SYS_ify (syscall_name); /* do the call. */ \ | ||
| 151 | + str r0, [sp, $-4]!; /* save syscall return value. */ \ | ||
| 152 | + mov r0, ip; /* get mask back. */ \ | ||
| 153 | + CDISABLE; \ | ||
| 154 | + ldr r0, [sp], $4; /* retrieve return value. */ \ | ||
| 155 | + UNDOC2ARGS_##args; /* fix register damage. */ \ | ||
| 156 | + cmn r0, $4096; | ||
| 157 | + | ||
| 158 | +# define DOCARGS_0 | ||
| 159 | +# define UNDOCARGS_0 | ||
| 160 | +# define UNDOC2ARGS_0 | ||
| 161 | + | ||
| 162 | +# define DOCARGS_1 str r0, [sp, #-4]!; | ||
| 163 | +# define UNDOCARGS_1 ldr r0, [sp], #4; | ||
| 164 | +# define UNDOC2ARGS_1 | ||
| 165 | + | ||
| 166 | +# define DOCARGS_2 str r1, [sp, #-4]!; str r0, [sp, #-4]!; | ||
| 167 | +# define UNDOCARGS_2 ldr r0, [sp], #4; ldr r1, [sp], #4; | ||
| 168 | +# define UNDOC2ARGS_2 | ||
| 169 | + | ||
| 170 | +# define DOCARGS_3 str r2, [sp, #-4]!; str r1, [sp, #-4]!; str r0, [sp, #-4]!; | ||
| 171 | +# define UNDOCARGS_3 ldr r0, [sp], #4; ldr r1, [sp], #4; ldr r2, [sp], #4 | ||
| 172 | +# define UNDOC2ARGS_3 | ||
| 173 | + | ||
| 174 | +# define DOCARGS_4 stmfd sp!, {r0-r3} | ||
| 175 | +# define UNDOCARGS_4 ldmfd sp!, {r0-r3} | ||
| 176 | +# define UNDOC2ARGS_4 | ||
| 177 | + | ||
| 178 | +# define DOCARGS_5 stmfd sp!, {r0-r3} | ||
| 179 | +# define UNDOCARGS_5 ldmfd sp, {r0-r3}; str r4, [sp, #-4]!; ldr r4, [sp, #24] | ||
| 180 | +# define UNDOC2ARGS_5 ldr r4, [sp], #20 | ||
| 181 | + | ||
| 182 | +# ifdef IS_IN_libpthread | ||
| 183 | +# define CENABLE bl PLTJMP(__pthread_enable_asynccancel) | ||
| 184 | +# define CDISABLE bl PLTJMP(__pthread_disable_asynccancel) | ||
| 185 | +# define __local_multiple_threads __pthread_multiple_threads | ||
| 186 | +# else | ||
| 187 | +# define CENABLE bl PLTJMP(__libc_enable_asynccancel) | ||
| 188 | +# define CDISABLE bl PLTJMP(__libc_disable_asynccancel) | ||
| 189 | +# define __local_multiple_threads __libc_multiple_threads | ||
| 190 | +# endif | ||
| 191 | + | ||
| 192 | +# ifndef __ASSEMBLER__ | ||
| 193 | +extern int __local_multiple_threads attribute_hidden; | ||
| 194 | +# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) | ||
| 195 | +# else | ||
| 196 | +# if !defined PIC | ||
| 197 | +# define SINGLE_THREAD_P \ | ||
| 198 | + ldr ip, =__local_multiple_threads; \ | ||
| 199 | + ldr ip, [ip]; \ | ||
| 200 | + teq ip, #0; | ||
| 201 | +# define PSEUDO_PROLOGUE | ||
| 202 | +# else | ||
| 203 | +# define SINGLE_THREAD_P \ | ||
| 204 | + ldr ip, 1b; \ | ||
| 205 | +2: \ | ||
| 206 | + ldr ip, [pc, ip]; \ | ||
| 207 | + teq ip, #0; | ||
| 208 | +# define PSEUDO_PROLOGUE \ | ||
| 209 | + 1: .word __local_multiple_threads - 2f - 8; | ||
| 210 | +# endif | ||
| 211 | +# endif | ||
| 212 | + | ||
| 213 | +#elif !defined __ASSEMBLER__ | ||
| 214 | + | ||
| 215 | +/* This code should never be used but we define it anyhow. */ | ||
| 216 | +# define SINGLE_THREAD_P (1) | ||
| 217 | + | ||
| 218 | +#endif | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv5te/uClibc.machine b/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv5te/uClibc.machine deleted file mode 100644 index ec0385bc0f..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv5te/uClibc.machine +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Sun May 13 11:16:02 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | # CONFIG_ARM_OABI is not set | ||
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | # CONFIG_ARM920T is not set | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | CONFIG_ARM_XSCALE=y | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | # UCLIBC_HAS_FPU is not set | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | ||
| 67 | DO_C99_MATH=y | ||
| 68 | KERNEL_HEADERS="/data/build/koen/OE/build/tmp/angstrom/cross/arm-angstrom-linux-uclibcgnueabi/include" | ||
| 69 | HAVE_DOT_CONFIG=y | ||
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv6/uClibc.machine b/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv6/uClibc.machine deleted file mode 100644 index 85f70f70c7..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv6/uClibc.machine +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Sun May 13 11:16:02 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | # CONFIG_ARM_OABI is not set | ||
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | # CONFIG_ARM920T is not set | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | CONFIG_ARM_XSCALE=y | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | UCLIBC_HAS_FPU=y | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=n | ||
| 67 | DO_C99_MATH=y | ||
| 68 | KERNEL_HEADERS="/data/build/koen/OE/build/tmp/angstrom/cross/arm-angstrom-linux-uclibcgnueabi/include" | ||
| 69 | HAVE_DOT_CONFIG=y | ||
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv7a/uClibc.machine b/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv7a/uClibc.machine deleted file mode 100644 index 85f70f70c7..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv7a/uClibc.machine +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Sun May 13 11:16:02 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | # CONFIG_ARM_OABI is not set | ||
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | # CONFIG_ARM920T is not set | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | CONFIG_ARM_XSCALE=y | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | UCLIBC_HAS_FPU=y | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=n | ||
| 67 | DO_C99_MATH=y | ||
| 68 | KERNEL_HEADERS="/data/build/koen/OE/build/tmp/angstrom/cross/arm-angstrom-linux-uclibcgnueabi/include" | ||
| 69 | HAVE_DOT_CONFIG=y | ||
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/gcc-4.4-fixlet.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/gcc-4.4-fixlet.patch deleted file mode 100644 index b9ff6710bc..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/gcc-4.4-fixlet.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | Index: uClibc-0.9.30.1/extra/scripts/unifdef.c | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc-0.9.30.1.orig/extra/scripts/unifdef.c 2009-08-09 11:55:23.000000000 +0200 | ||
| 4 | +++ uClibc-0.9.30.1/extra/scripts/unifdef.c 2009-08-09 11:55:46.000000000 +0200 | ||
| 5 | @@ -206,7 +206,7 @@ | ||
| 6 | static void error(const char *); | ||
| 7 | static int findsym(const char *); | ||
| 8 | static void flushline(bool); | ||
| 9 | -static Linetype getline(void); | ||
| 10 | +static Linetype _getline(void); | ||
| 11 | static Linetype ifeval(const char **); | ||
| 12 | static void ignoreoff(void); | ||
| 13 | static void ignoreon(void); | ||
| 14 | @@ -512,7 +512,7 @@ | ||
| 15 | |||
| 16 | for (;;) { | ||
| 17 | linenum++; | ||
| 18 | - lineval = getline(); | ||
| 19 | + lineval = _getline(); | ||
| 20 | trans_table[ifstate[depth]][lineval](); | ||
| 21 | debug("process %s -> %s depth %d", | ||
| 22 | linetype_name[lineval], | ||
| 23 | @@ -526,7 +526,7 @@ | ||
| 24 | * help from skipcomment(). | ||
| 25 | */ | ||
| 26 | static Linetype | ||
| 27 | -getline(void) | ||
| 28 | +_getline(void) | ||
| 29 | { | ||
| 30 | const char *cp; | ||
| 31 | int cursym; | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/linuxthreads-changes.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/linuxthreads-changes.patch deleted file mode 100644 index f6f32cdd29..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/linuxthreads-changes.patch +++ /dev/null | |||
| @@ -1,291 +0,0 @@ | |||
| 1 | Index: uClibc/libpthread/linuxthreads/descr.h | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc.orig/libpthread/linuxthreads/descr.h 2008-08-27 23:59:46.171809044 +0200 | ||
| 4 | +++ uClibc/libpthread/linuxthreads/descr.h 2008-08-28 00:00:35.435134759 +0200 | ||
| 5 | @@ -123,9 +123,9 @@ | ||
| 6 | union dtv *dtvp; | ||
| 7 | pthread_descr self; /* Pointer to this structure */ | ||
| 8 | int multiple_threads; | ||
| 9 | -# ifdef NEED_DL_SYSINFO | ||
| 10 | uintptr_t sysinfo; | ||
| 11 | -# endif | ||
| 12 | + uintptr_t stack_guard; | ||
| 13 | + uintptr_t pointer_guard; | ||
| 14 | } data; | ||
| 15 | void *__padding[16]; | ||
| 16 | } p_header; | ||
| 17 | @@ -193,6 +193,13 @@ | ||
| 18 | size_t p_alloca_cutoff; /* Maximum size which should be allocated | ||
| 19 | using alloca() instead of malloc(). */ | ||
| 20 | /* New elements must be added at the end. */ | ||
| 21 | + | ||
| 22 | + /* This member must be last. */ | ||
| 23 | + char end_padding[]; | ||
| 24 | + | ||
| 25 | +#define PTHREAD_STRUCT_END_PADDING \ | ||
| 26 | + (sizeof (struct _pthread_descr_struct) \ | ||
| 27 | + - offsetof (struct _pthread_descr_struct, end_padding)) | ||
| 28 | } __attribute__ ((aligned(32))); /* We need to align the structure so that | ||
| 29 | doubles are aligned properly. This is 8 | ||
| 30 | bytes on MIPS and 16 bytes on MIPS64. | ||
| 31 | Index: uClibc/libpthread/linuxthreads/manager.c | ||
| 32 | =================================================================== | ||
| 33 | --- uClibc.orig/libpthread/linuxthreads/manager.c 2008-08-27 23:59:54.185140485 +0200 | ||
| 34 | +++ uClibc/libpthread/linuxthreads/manager.c 2008-08-28 00:00:35.435134759 +0200 | ||
| 35 | @@ -679,6 +679,17 @@ | ||
| 36 | new_thread->p_inheritsched = attr ? attr->__inheritsched : 0; | ||
| 37 | new_thread->p_alloca_cutoff = stksize / 4 > __MAX_ALLOCA_CUTOFF | ||
| 38 | ? __MAX_ALLOCA_CUTOFF : stksize / 4; | ||
| 39 | + | ||
| 40 | + /* Copy the stack guard canary. */ | ||
| 41 | +#ifdef THREAD_COPY_STACK_GUARD | ||
| 42 | + THREAD_COPY_STACK_GUARD (new_thread); | ||
| 43 | +#endif | ||
| 44 | + | ||
| 45 | + /* Copy the pointer guard value. */ | ||
| 46 | +#ifdef THREAD_COPY_POINTER_GUARD | ||
| 47 | + THREAD_COPY_POINTER_GUARD (new_thread); | ||
| 48 | +#endif | ||
| 49 | + | ||
| 50 | /* Initialize the thread handle */ | ||
| 51 | __pthread_init_lock(&__pthread_handles[sseg].h_lock); | ||
| 52 | __pthread_handles[sseg].h_descr = new_thread; | ||
| 53 | @@ -742,15 +753,15 @@ | ||
| 54 | pid = __clone2(pthread_start_thread_event, | ||
| 55 | (void **)new_thread_bottom, | ||
| 56 | (char *)stack_addr - new_thread_bottom, | ||
| 57 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 58 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 59 | __pthread_sig_cancel, new_thread); | ||
| 60 | #elif _STACK_GROWS_UP | ||
| 61 | pid = __clone(pthread_start_thread_event, (void *) new_thread_bottom, | ||
| 62 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 63 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 64 | __pthread_sig_cancel, new_thread); | ||
| 65 | #else | ||
| 66 | pid = __clone(pthread_start_thread_event, stack_addr, | ||
| 67 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 68 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 69 | __pthread_sig_cancel, new_thread); | ||
| 70 | #endif | ||
| 71 | saved_errno = errno; | ||
| 72 | @@ -783,15 +794,15 @@ | ||
| 73 | pid = __clone2(pthread_start_thread, | ||
| 74 | (void **)new_thread_bottom, | ||
| 75 | (char *)stack_addr - new_thread_bottom, | ||
| 76 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 77 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 78 | __pthread_sig_cancel, new_thread); | ||
| 79 | #elif _STACK_GROWS_UP | ||
| 80 | pid = __clone(pthread_start_thread, (void *) new_thread_bottom, | ||
| 81 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 82 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 83 | __pthread_sig_cancel, new_thread); | ||
| 84 | #else | ||
| 85 | pid = __clone(pthread_start_thread, stack_addr, | ||
| 86 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | | ||
| 87 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | | ||
| 88 | __pthread_sig_cancel, new_thread); | ||
| 89 | #endif /* !NEED_SEPARATE_REGISTER_STACK */ | ||
| 90 | saved_errno = errno; | ||
| 91 | @@ -892,10 +903,11 @@ | ||
| 92 | #ifdef _STACK_GROWS_UP | ||
| 93 | # ifdef USE_TLS | ||
| 94 | size_t stacksize = guardaddr - th->p_stackaddr; | ||
| 95 | + guardaddr = th->p_stackaddr; | ||
| 96 | # else | ||
| 97 | size_t stacksize = guardaddr - (char *)th; | ||
| 98 | -# endif | ||
| 99 | guardaddr = (char *)th; | ||
| 100 | +# endif | ||
| 101 | #else | ||
| 102 | /* Guardaddr is always set, even if guardsize is 0. This allows | ||
| 103 | us to compute everything else. */ | ||
| 104 | Index: uClibc/libpthread/linuxthreads/pthread.c | ||
| 105 | =================================================================== | ||
| 106 | --- uClibc.orig/libpthread/linuxthreads/pthread.c 2008-08-28 00:00:00.825141935 +0200 | ||
| 107 | +++ uClibc/libpthread/linuxthreads/pthread.c 2008-08-28 00:00:35.438472147 +0200 | ||
| 108 | @@ -698,6 +698,16 @@ | ||
| 109 | mgr = &__pthread_manager_thread; | ||
| 110 | #endif | ||
| 111 | |||
| 112 | + /* Copy the stack guard canary. */ | ||
| 113 | +#ifdef THREAD_COPY_STACK_GUARD | ||
| 114 | + THREAD_COPY_STACK_GUARD (mgr); | ||
| 115 | +#endif | ||
| 116 | + | ||
| 117 | + /* Copy the pointer guard value. */ | ||
| 118 | +#ifdef THREAD_COPY_POINTER_GUARD | ||
| 119 | + THREAD_COPY_POINTER_GUARD (mgr); | ||
| 120 | +#endif | ||
| 121 | + | ||
| 122 | __pthread_manager_request = manager_pipe[1]; /* writing end */ | ||
| 123 | __pthread_manager_reader = manager_pipe[0]; /* reading end */ | ||
| 124 | |||
| 125 | @@ -738,17 +748,17 @@ | ||
| 126 | pid = __clone2(__pthread_manager_event, | ||
| 127 | (void **) __pthread_manager_thread_bos, | ||
| 128 | THREAD_MANAGER_STACK_SIZE, | ||
| 129 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, | ||
| 130 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, | ||
| 131 | mgr); | ||
| 132 | #elif _STACK_GROWS_UP | ||
| 133 | pid = __clone(__pthread_manager_event, | ||
| 134 | (void **) __pthread_manager_thread_bos, | ||
| 135 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, | ||
| 136 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, | ||
| 137 | mgr); | ||
| 138 | #else | ||
| 139 | pid = __clone(__pthread_manager_event, | ||
| 140 | (void **) __pthread_manager_thread_tos, | ||
| 141 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, | ||
| 142 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, | ||
| 143 | mgr); | ||
| 144 | #endif | ||
| 145 | |||
| 146 | @@ -778,13 +788,13 @@ | ||
| 147 | #ifdef NEED_SEPARATE_REGISTER_STACK | ||
| 148 | pid = __clone2(__pthread_manager, (void **) __pthread_manager_thread_bos, | ||
| 149 | THREAD_MANAGER_STACK_SIZE, | ||
| 150 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr); | ||
| 151 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); | ||
| 152 | #elif _STACK_GROWS_UP | ||
| 153 | pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_bos, | ||
| 154 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr); | ||
| 155 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); | ||
| 156 | #else | ||
| 157 | pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_tos, | ||
| 158 | - CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, mgr); | ||
| 159 | + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); | ||
| 160 | #endif | ||
| 161 | } | ||
| 162 | if (__builtin_expect (pid, 0) == -1) { | ||
| 163 | @@ -971,6 +981,10 @@ | ||
| 164 | struct pthread_request request; | ||
| 165 | pthread_descr self = thread_self(); | ||
| 166 | |||
| 167 | + /* Make sure we come back here after suspend(), in case we entered | ||
| 168 | + from a signal handler. */ | ||
| 169 | + THREAD_SETMEM(self, p_signal_jmp, NULL); | ||
| 170 | + | ||
| 171 | request.req_thread = self; | ||
| 172 | request.req_kind = REQ_PROCESS_EXIT; | ||
| 173 | request.req_args.exit.code = retcode; | ||
| 174 | @@ -1198,13 +1212,13 @@ | ||
| 175 | |||
| 176 | void __pthread_restart_old(pthread_descr th) | ||
| 177 | { | ||
| 178 | - if (atomic_increment(&th->p_resume_count) == -1) | ||
| 179 | + if (pthread_atomic_increment(&th->p_resume_count) == -1) | ||
| 180 | kill(th->p_pid, __pthread_sig_restart); | ||
| 181 | } | ||
| 182 | |||
| 183 | void __pthread_suspend_old(pthread_descr self) | ||
| 184 | { | ||
| 185 | - if (atomic_decrement(&self->p_resume_count) <= 0) | ||
| 186 | + if (pthread_atomic_decrement(&self->p_resume_count) <= 0) | ||
| 187 | __pthread_wait_for_restart_signal(self); | ||
| 188 | } | ||
| 189 | |||
| 190 | @@ -1215,7 +1229,7 @@ | ||
| 191 | int was_signalled = 0; | ||
| 192 | sigjmp_buf jmpbuf; | ||
| 193 | |||
| 194 | - if (atomic_decrement(&self->p_resume_count) == 0) { | ||
| 195 | + if (pthread_atomic_decrement(&self->p_resume_count) == 0) { | ||
| 196 | /* Set up a longjmp handler for the restart signal, unblock | ||
| 197 | the signal and sleep. */ | ||
| 198 | |||
| 199 | @@ -1272,9 +1286,9 @@ | ||
| 200 | being delivered. */ | ||
| 201 | |||
| 202 | if (!was_signalled) { | ||
| 203 | - if (atomic_increment(&self->p_resume_count) != -1) { | ||
| 204 | + if (pthread_atomic_increment(&self->p_resume_count) != -1) { | ||
| 205 | __pthread_wait_for_restart_signal(self); | ||
| 206 | - atomic_decrement(&self->p_resume_count); /* should be zero now! */ | ||
| 207 | + pthread_atomic_decrement(&self->p_resume_count); /* should be zero now! */ | ||
| 208 | /* woke spontaneously and consumed restart signal */ | ||
| 209 | return 1; | ||
| 210 | } | ||
| 211 | Index: uClibc/libpthread/linuxthreads/specific.c | ||
| 212 | =================================================================== | ||
| 213 | --- uClibc.orig/libpthread/linuxthreads/specific.c 2008-08-28 00:00:07.595139286 +0200 | ||
| 214 | +++ uClibc/libpthread/linuxthreads/specific.c 2008-08-28 00:00:35.438472147 +0200 | ||
| 215 | @@ -104,13 +104,14 @@ | ||
| 216 | that if the key is reallocated later by pthread_key_create, its | ||
| 217 | associated values will be NULL in all threads. | ||
| 218 | |||
| 219 | - If no threads have been created yet, clear it just in the | ||
| 220 | - current thread. */ | ||
| 221 | + If no threads have been created yet, or if we are exiting, clear | ||
| 222 | + it just in the current thread. */ | ||
| 223 | |||
| 224 | struct pthread_key_delete_helper_args args; | ||
| 225 | args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; | ||
| 226 | args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; | ||
| 227 | - if (__pthread_manager_request != -1) | ||
| 228 | + if (__pthread_manager_request != -1 | ||
| 229 | + && !(__builtin_expect (__pthread_exit_requested, 0))) | ||
| 230 | { | ||
| 231 | struct pthread_request request; | ||
| 232 | |||
| 233 | @@ -203,8 +204,9 @@ | ||
| 234 | __pthread_lock(THREAD_GETMEM(self, p_lock), self); | ||
| 235 | for (i = 0; i < PTHREAD_KEY_1STLEVEL_SIZE; i++) { | ||
| 236 | if (THREAD_GETMEM_NC(self, p_specific[i]) != NULL) { | ||
| 237 | - free(THREAD_GETMEM_NC(self, p_specific[i])); | ||
| 238 | + void *p = THREAD_GETMEM_NC(self, p_specific[i]); | ||
| 239 | THREAD_SETMEM_NC(self, p_specific[i], NULL); | ||
| 240 | + free(p); | ||
| 241 | } | ||
| 242 | } | ||
| 243 | __pthread_unlock(THREAD_GETMEM(self, p_lock)); | ||
| 244 | Index: uClibc/libpthread/linuxthreads/spinlock.c | ||
| 245 | =================================================================== | ||
| 246 | --- uClibc.orig/libpthread/linuxthreads/spinlock.c 2008-08-28 00:00:17.805140454 +0200 | ||
| 247 | +++ uClibc/libpthread/linuxthreads/spinlock.c 2008-08-28 00:00:35.438472147 +0200 | ||
| 248 | @@ -637,8 +637,20 @@ | ||
| 249 | #if defined HAS_COMPARE_AND_SWAP | ||
| 250 | wait_node_dequeue(pp_head, pp_max_prio, p_max_prio); | ||
| 251 | #endif | ||
| 252 | + | ||
| 253 | + /* Release the spinlock before restarting. */ | ||
| 254 | +#if defined TEST_FOR_COMPARE_AND_SWAP | ||
| 255 | + if (!__pthread_has_cas) | ||
| 256 | +#endif | ||
| 257 | +#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP | ||
| 258 | + { | ||
| 259 | + __pthread_release(&lock->__spinlock); | ||
| 260 | + } | ||
| 261 | +#endif | ||
| 262 | + | ||
| 263 | restart(p_max_prio->thr); | ||
| 264 | - break; | ||
| 265 | + | ||
| 266 | + return; | ||
| 267 | } | ||
| 268 | } | ||
| 269 | |||
| 270 | Index: uClibc/libpthread/linuxthreads/spinlock.h | ||
| 271 | =================================================================== | ||
| 272 | --- uClibc.orig/libpthread/linuxthreads/spinlock.h 2008-08-28 00:00:24.768471655 +0200 | ||
| 273 | +++ uClibc/libpthread/linuxthreads/spinlock.h 2008-08-28 00:02:42.971786951 +0200 | ||
| 274 | @@ -172,7 +172,7 @@ | ||
| 275 | |||
| 276 | /* Operations on pthread_atomic, which is defined in internals.h */ | ||
| 277 | |||
| 278 | -static __inline__ long atomic_increment(struct pthread_atomic *pa) | ||
| 279 | +static __inline__ long pthread_atomic_increment(struct pthread_atomic *pa) | ||
| 280 | { | ||
| 281 | long oldval; | ||
| 282 | |||
| 283 | @@ -184,7 +184,7 @@ | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | -static __inline__ long atomic_decrement(struct pthread_atomic *pa) | ||
| 288 | +static __inline__ long pthread_atomic_decrement(struct pthread_atomic *pa) | ||
| 289 | { | ||
| 290 | long oldval; | ||
| 291 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/pthread_atfork.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/pthread_atfork.patch deleted file mode 100644 index 92accc2a1a..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/pthread_atfork.patch +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | Index: uClibc-0.9.30/libpthread/linuxthreads/Makefile.in | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc-0.9.30.orig/libpthread/linuxthreads/Makefile.in 2009-01-11 01:09:27.008515954 +0100 | ||
| 4 | +++ uClibc-0.9.30/libpthread/linuxthreads/Makefile.in 2009-01-11 01:09:35.295181636 +0100 | ||
| 5 | @@ -45,7 +45,7 @@ | ||
| 6 | pthread_SRC := \ | ||
| 7 | attr barrier cancel condvar errno events join pthread \ | ||
| 8 | lockfile manager mutex pt-machine ptcleanup \ | ||
| 9 | - ptclock_gettime ptclock_settime ptfork pthandles \ | ||
| 10 | + ptclock_gettime ptclock_settime ptfork pthandles pthread_atfork \ | ||
| 11 | pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \ | ||
| 12 | pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \ | ||
| 13 | rwlock semaphore sighandler signals specific spinlock | ||
| 14 | Index: uClibc-0.9.30/libpthread/linuxthreads/pthread_atfork.c | ||
| 15 | =================================================================== | ||
| 16 | --- uClibc-0.9.30.orig/libpthread/linuxthreads/pthread_atfork.c 2009-01-11 01:09:44.931848926 +0100 | ||
| 17 | +++ uClibc-0.9.30/libpthread/linuxthreads/pthread_atfork.c 2009-01-11 01:12:49.926539743 +0100 | ||
| 18 | @@ -43,12 +43,8 @@ | ||
| 19 | |||
| 20 | /* Hide the symbol so that no definition but the one locally in the | ||
| 21 | executable or DSO is used. */ | ||
| 22 | -int | ||
| 23 | -#ifndef __pthread_atfork | ||
| 24 | -/* Don't mark the compatibility function as hidden. */ | ||
| 25 | -attribute_hidden | ||
| 26 | -#endif | ||
| 27 | -__pthread_atfork (prepare, parent, child) | ||
| 28 | + | ||
| 29 | +int attribute_hidden __pthread_atfork (prepare, parent, child) | ||
| 30 | void (*prepare) (void); | ||
| 31 | void (*parent) (void); | ||
| 32 | void (*child) (void); | ||
| 33 | @@ -56,8 +52,5 @@ | ||
| 34 | return __register_atfork (prepare, parent, child, | ||
| 35 | &__dso_handle == NULL ? NULL : __dso_handle); | ||
| 36 | } | ||
| 37 | -#ifndef __pthread_atfork | ||
| 38 | -extern int pthread_atfork (void (*prepare) (void), void (*parent) (void), | ||
| 39 | - void (*child) (void)) attribute_hidden; | ||
| 40 | + | ||
| 41 | strong_alias (__pthread_atfork, pthread_atfork) | ||
| 42 | -#endif | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv4t b/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv4t deleted file mode 100644 index 898b73a33b..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv4t +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Mon May 14 10:23:14 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | # CONFIG_ARM_OABI is not set | ||
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | CONFIG_ARM920T=y | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | # CONFIG_ARM_XSCALE is not set | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | # UCLIBC_HAS_FPU is not set | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | ||
| 67 | KERNEL_HEADERS="/usr/include" | ||
| 68 | HAVE_DOT_CONFIG=y | ||
| 69 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv5te b/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv5te deleted file mode 100644 index ec0385bc0f..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.armv5te +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Sun May 13 11:16:02 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | # CONFIG_ARM_OABI is not set | ||
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | # CONFIG_ARM920T is not set | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | CONFIG_ARM_XSCALE=y | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | # UCLIBC_HAS_FPU is not set | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | ||
| 67 | DO_C99_MATH=y | ||
| 68 | KERNEL_HEADERS="/data/build/koen/OE/build/tmp/angstrom/cross/arm-angstrom-linux-uclibcgnueabi/include" | ||
| 69 | HAVE_DOT_CONFIG=y | ||
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.strongarm b/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.strongarm deleted file mode 100644 index 6e89444a64..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.strongarm +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Sun May 13 11:29:51 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | TARGET_arm=y | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | # TARGET_powerpc is not set | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="arm" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | CONFIG_ARM_OABI=y | ||
| 35 | # CONFIG_ARM_EABI is not set | ||
| 36 | # USE_BX is not set | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | ||
| 39 | # CONFIG_ARM710 is not set | ||
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | ||
| 42 | # CONFIG_ARM920T is not set | ||
| 43 | # CONFIG_ARM922T is not set | ||
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | CONFIG_ARM_SA1100=y | ||
| 51 | # CONFIG_ARM_XSCALE is not set | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | ||
| 54 | |||
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | ||
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | ||
| 65 | # UCLIBC_HAS_FPU is not set | ||
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | ||
| 67 | DO_C99_MATH=y | ||
| 68 | KERNEL_HEADERS="/usr/include" | ||
| 69 | HAVE_DOT_CONFIG=y | ||
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc-c99-ldbl-math.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc-c99-ldbl-math.patch deleted file mode 100644 index f3718431ea..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc-c99-ldbl-math.patch +++ /dev/null | |||
| @@ -1,474 +0,0 @@ | |||
| 1 | Index: uClibc-0.9.30.1/libm/ldouble_wrappers.c | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc-0.9.30.1/libm/ldouble_wrappers.c (revision 25552) | ||
| 4 | +++ uClibc-0.9.30.1/libm/ldouble_wrappers.c (working copy) | ||
| 5 | @@ -13,6 +13,16 @@ | ||
| 6 | #include "math.h" | ||
| 7 | #include <complex.h> | ||
| 8 | |||
| 9 | +#if defined __NO_LONG_DOUBLE_MATH | ||
| 10 | +# define int_WRAPPER_C99(func) /* not needed */ | ||
| 11 | +# else | ||
| 12 | +# define int_WRAPPER_C99(func) \ | ||
| 13 | +int func##l(long double x) \ | ||
| 14 | +{ \ | ||
| 15 | + return func((double) x); \ | ||
| 16 | +} \ | ||
| 17 | +libm_hidden_def(func##l) | ||
| 18 | +#endif | ||
| 19 | |||
| 20 | /* Implement the following, as defined by SuSv3 */ | ||
| 21 | #if 0 | ||
| 22 | @@ -543,46 +553,28 @@ long double truncl (long double x) | ||
| 23 | #endif | ||
| 24 | |||
| 25 | |||
| 26 | -#ifdef __DO_C99_MATH__ | ||
| 27 | +#if defined __DO_C99_MATH__ | ||
| 28 | |||
| 29 | #ifdef L_fpclassifyl | ||
| 30 | -int __fpclassifyl (long double x) | ||
| 31 | -{ | ||
| 32 | - return __fpclassify ( (double) x ); | ||
| 33 | -} | ||
| 34 | -libm_hidden_def(__fpclassifyl) | ||
| 35 | +int_WRAPPER_C99(__fpclassify) | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #ifdef L_finitel | ||
| 39 | -int __finitel (long double x) | ||
| 40 | -{ | ||
| 41 | - return __finite ( (double)x ); | ||
| 42 | -} | ||
| 43 | -libm_hidden_def(__finitel) | ||
| 44 | +int_WRAPPER_C99(__finite) | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef L_signbitl | ||
| 48 | -int __signbitl (long double x) | ||
| 49 | -{ | ||
| 50 | - return __signbitl ( (double)x ); | ||
| 51 | -} | ||
| 52 | -libm_hidden_def(__signbitl) | ||
| 53 | +int_WRAPPER_C99(__signbit) | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #ifdef L_isnanl | ||
| 57 | -int __isnanl (long double x) | ||
| 58 | -{ | ||
| 59 | - return __isnan ( (double)x ); | ||
| 60 | -} | ||
| 61 | -libm_hidden_def(__isnanl) | ||
| 62 | +int_WRAPPER_C99(__isnan) | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #ifdef L_isinfl | ||
| 66 | -int __isinfl (long double x) | ||
| 67 | -{ | ||
| 68 | - return __isinf ( (double)x ); | ||
| 69 | -} | ||
| 70 | -libm_hidden_def(__isinfl) | ||
| 71 | +int_WRAPPER_C99(__isinf) | ||
| 72 | #endif | ||
| 73 | |||
| 74 | -#endif | ||
| 75 | +#endif /* DO_C99_MATH */ | ||
| 76 | + | ||
| 77 | +#undef int_WRAPPER_C99 | ||
| 78 | Index: uClibc-0.9.30.1/libm/nan.c | ||
| 79 | =================================================================== | ||
| 80 | --- uClibc-0.9.30.1/libm/nan.c (revision 25552) | ||
| 81 | +++ uClibc-0.9.30.1/libm/nan.c (working copy) | ||
| 82 | @@ -45,7 +45,7 @@ float nanf (const char *tagp) | ||
| 83 | } | ||
| 84 | libm_hidden_def(nanf) | ||
| 85 | |||
| 86 | -#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 87 | +#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH | ||
| 88 | libm_hidden_proto(nanl) | ||
| 89 | long double nanl (const char *tagp) | ||
| 90 | { | ||
| 91 | Index: uClibc-0.9.30.1/include/math.h | ||
| 92 | =================================================================== | ||
| 93 | --- uClibc-0.9.30.1/include/math.h (revision 25552) | ||
| 94 | +++ uClibc-0.9.30.1/include/math.h (working copy) | ||
| 95 | @@ -118,7 +118,7 @@ __BEGIN_DECLS | ||
| 96 | # undef __MATH_PRECNAME | ||
| 97 | |||
| 98 | # if (__STDC__ - 0 || __GNUC__ - 0) \ | ||
| 99 | - && (defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ || defined __LDBL_COMPAT) | ||
| 100 | + && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT) | ||
| 101 | # ifdef __LDBL_COMPAT | ||
| 102 | |||
| 103 | # ifdef __USE_ISOC99 | ||
| 104 | @@ -230,7 +230,7 @@ enum | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* Return number of classification appropriate for X. */ | ||
| 108 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 109 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 110 | # define fpclassify(x) \ | ||
| 111 | (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) | ||
| 112 | # else | ||
| 113 | @@ -242,7 +242,7 @@ enum | ||
| 114 | # endif | ||
| 115 | |||
| 116 | /* Return nonzero value if sign of X is negative. */ | ||
| 117 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 118 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 119 | # define signbit(x) \ | ||
| 120 | (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x)) | ||
| 121 | # else | ||
| 122 | @@ -254,7 +254,7 @@ enum | ||
| 123 | # endif | ||
| 124 | |||
| 125 | /* Return nonzero value if X is not +-Inf or NaN. */ | ||
| 126 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 127 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 128 | # define isfinite(x) \ | ||
| 129 | (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x)) | ||
| 130 | # else | ||
| 131 | @@ -270,7 +270,7 @@ enum | ||
| 132 | |||
| 133 | /* Return nonzero value if X is a NaN. We could use `fpclassify' but | ||
| 134 | we already have this functions `__isnan' and it is faster. */ | ||
| 135 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 136 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 137 | # define isnan(x) \ | ||
| 138 | (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) | ||
| 139 | # else | ||
| 140 | @@ -282,7 +282,7 @@ enum | ||
| 141 | # endif | ||
| 142 | |||
| 143 | /* Return nonzero value is X is positive or negative infinity. */ | ||
| 144 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 145 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 146 | # define isinf(x) \ | ||
| 147 | (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) | ||
| 148 | # else | ||
| 149 | Index: uClibc-0.9.30.1/include/tgmath.h | ||
| 150 | =================================================================== | ||
| 151 | --- uClibc-0.9.30.1/include/tgmath.h (revision 25552) | ||
| 152 | +++ uClibc-0.9.30.1/include/tgmath.h (working copy) | ||
| 153 | @@ -36,7 +36,7 @@ | ||
| 154 | |||
| 155 | #if __GNUC_PREREQ (2, 7) | ||
| 156 | |||
| 157 | -# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 158 | +# ifdef __NO_LONG_DOUBLE_MATH | ||
| 159 | # define __tgml(fct) fct | ||
| 160 | # else | ||
| 161 | # define __tgml(fct) fct ## l | ||
| 162 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h | ||
| 163 | =================================================================== | ||
| 164 | --- uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h (revision 25552) | ||
| 165 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h (working copy) | ||
| 166 | @@ -7,13 +7,13 @@ | ||
| 167 | # define __WORDSIZE 32 | ||
| 168 | #endif | ||
| 169 | |||
| 170 | -#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL | ||
| 171 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL | ||
| 172 | |||
| 173 | /* Signal the glibc ABI didn't used to have a `long double'. | ||
| 174 | The changes all the `long double' function variants to be redirects | ||
| 175 | to the double functions. */ | ||
| 176 | # define __LONG_DOUBLE_MATH_OPTIONAL 1 | ||
| 177 | # ifndef __LONG_DOUBLE_128__ | ||
| 178 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 179 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 180 | # endif | ||
| 181 | #endif | ||
| 182 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h | ||
| 183 | =================================================================== | ||
| 184 | --- uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h (revision 25552) | ||
| 185 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h (working copy) | ||
| 186 | @@ -65,11 +65,13 @@ typedef double double_t; | ||
| 187 | |||
| 188 | #endif /* ISO C99 */ | ||
| 189 | |||
| 190 | -#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 191 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 192 | #include <bits/wordsize.h> | ||
| 193 | /* Signal that we do not really have a `long double'. The disables the | ||
| 194 | declaration of all the `long double' function variants. */ | ||
| 195 | # if __WORDSIZE == 32 | ||
| 196 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 197 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 198 | +# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 199 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 200 | # endif /* __WORDSIZE == 32 */ | ||
| 201 | -#endif /* __UCLIBC_HAS_LONG_DOUBLE_MATH__ */ | ||
| 202 | +#endif /* __NO_LONG_DOUBLE_MATH */ | ||
| 203 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h | ||
| 204 | =================================================================== | ||
| 205 | --- uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h (revision 25552) | ||
| 206 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h (working copy) | ||
| 207 | @@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp | ||
| 208 | # define FP_ILOGBNAN (2147483647) | ||
| 209 | |||
| 210 | #endif /* ISO C99 */ | ||
| 211 | + | ||
| 212 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 213 | +/* Signal that we do not really have a `long double'. This disables the | ||
| 214 | + declaration of all the `long double' function variants. */ | ||
| 215 | +/* XXX The FPA does support this but the patterns in GCC are currently | ||
| 216 | + turned off. */ | ||
| 217 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 218 | +#endif | ||
| 219 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h | ||
| 220 | =================================================================== | ||
| 221 | --- uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h (revision 25552) | ||
| 222 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h (working copy) | ||
| 223 | @@ -36,3 +36,7 @@ typedef long double double_t; /* `double | ||
| 224 | # define FP_ILOGBNAN (2147483647) | ||
| 225 | |||
| 226 | #endif /* ISO C99 */ | ||
| 227 | + | ||
| 228 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 229 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 230 | +#endif | ||
| 231 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h | ||
| 232 | =================================================================== | ||
| 233 | --- uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h (revision 25552) | ||
| 234 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h (working copy) | ||
| 235 | @@ -18,13 +18,13 @@ | ||
| 236 | |||
| 237 | #define __WORDSIZE 64 | ||
| 238 | |||
| 239 | -#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL | ||
| 240 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL | ||
| 241 | |||
| 242 | /* Signal that we didn't used to have a `long double'. The changes all | ||
| 243 | the `long double' function variants to be redirects to the double | ||
| 244 | functions. */ | ||
| 245 | # define __LONG_DOUBLE_MATH_OPTIONAL 1 | ||
| 246 | # ifndef __LONG_DOUBLE_128__ | ||
| 247 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 248 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 249 | # endif | ||
| 250 | #endif | ||
| 251 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h | ||
| 252 | =================================================================== | ||
| 253 | --- uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h (revision 25552) | ||
| 254 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h (working copy) | ||
| 255 | @@ -78,3 +78,7 @@ typedef double double_t; | ||
| 256 | |||
| 257 | # endif /* GNUC before 3.4 */ | ||
| 258 | #endif /* COMPLEX_H */ | ||
| 259 | + | ||
| 260 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 261 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 262 | +#endif | ||
| 263 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h | ||
| 264 | =================================================================== | ||
| 265 | --- uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h (revision 25552) | ||
| 266 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h (working copy) | ||
| 267 | @@ -35,3 +35,9 @@ typedef double double_t; /* `double' exp | ||
| 268 | # define FP_ILOGBNAN 2147483647 | ||
| 269 | |||
| 270 | #endif /* ISO C99 */ | ||
| 271 | + | ||
| 272 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 273 | +/* Signal that we do not really have a `long double'. The disables the | ||
| 274 | + declaration of all the `long double' function variants. */ | ||
| 275 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 276 | +#endif | ||
| 277 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h | ||
| 278 | =================================================================== | ||
| 279 | --- uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h (revision 25552) | ||
| 280 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h (working copy) | ||
| 281 | @@ -44,3 +44,7 @@ typedef long double double_t; /* `double | ||
| 282 | # define FP_ILOGBNAN (-2147483647 - 1) | ||
| 283 | |||
| 284 | #endif /* ISO C99 */ | ||
| 285 | + | ||
| 286 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 287 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 288 | +#endif | ||
| 289 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h | ||
| 290 | =================================================================== | ||
| 291 | --- uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h (revision 25552) | ||
| 292 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h (working copy) | ||
| 293 | @@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp | ||
| 294 | # define FP_ILOGBNAN (2147483647) | ||
| 295 | |||
| 296 | #endif /* ISO C99 */ | ||
| 297 | + | ||
| 298 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 299 | +/* Signal that we do not really have a `long double'. This disables the | ||
| 300 | + declaration of all the `long double' function variants. */ | ||
| 301 | +/* XXX The FPA does support this but the patterns in GCC are currently | ||
| 302 | + turned off. */ | ||
| 303 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 304 | +#endif | ||
| 305 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h | ||
| 306 | =================================================================== | ||
| 307 | --- uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h (revision 25552) | ||
| 308 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h (working copy) | ||
| 309 | @@ -46,3 +46,7 @@ typedef long double double_t; /* `double | ||
| 310 | # define FP_ILOGBNAN (-2147483647 - 1) | ||
| 311 | |||
| 312 | #endif /* ISO C99 */ | ||
| 313 | + | ||
| 314 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 315 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 316 | +#endif | ||
| 317 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h | ||
| 318 | =================================================================== | ||
| 319 | --- uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h (revision 25552) | ||
| 320 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h (working copy) | ||
| 321 | @@ -36,8 +36,8 @@ typedef double double_t; /* `double' exp | ||
| 322 | |||
| 323 | #endif /* ISO C99 */ | ||
| 324 | |||
| 325 | -#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 326 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 327 | /* Signal that we do not really have a `long double'. The disables the | ||
| 328 | declaration of all the `long double' function variants. */ | ||
| 329 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 330 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 331 | #endif | ||
| 332 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h | ||
| 333 | =================================================================== | ||
| 334 | --- uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h (revision 25552) | ||
| 335 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h (working copy) | ||
| 336 | @@ -35,3 +35,7 @@ typedef double double_t; /* `double' exp | ||
| 337 | # define FP_ILOGBNAN 2147483647 | ||
| 338 | |||
| 339 | #endif /* ISO C99 */ | ||
| 340 | + | ||
| 341 | +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 342 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 343 | +#endif | ||
| 344 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h | ||
| 345 | =================================================================== | ||
| 346 | --- uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h (revision 25552) | ||
| 347 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h (working copy) | ||
| 348 | @@ -39,8 +39,10 @@ typedef double double_t; /* `double' exp | ||
| 349 | |||
| 350 | #endif /* ISO C99 */ | ||
| 351 | |||
| 352 | -#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && _MIPS_SIM == _ABIO32 | ||
| 353 | +#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32 | ||
| 354 | /* Signal that we do not really have a `long double'. This disables the | ||
| 355 | declaration of all the `long double' function variants. */ | ||
| 356 | -# error defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ and _MIPS_SIM == _ABIO32 | ||
| 357 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 358 | +#elif !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 359 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 360 | #endif | ||
| 361 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h | ||
| 362 | =================================================================== | ||
| 363 | --- uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h (revision 25552) | ||
| 364 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h (working copy) | ||
| 365 | @@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp | ||
| 366 | # define FP_ILOGBNAN (2147483647) | ||
| 367 | |||
| 368 | #endif /* ISO C99 */ | ||
| 369 | + | ||
| 370 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 371 | +/* Signal that we do not really have a `long double'. This disables the | ||
| 372 | + declaration of all the `long double' function variants. */ | ||
| 373 | +/* XXX The FPA does support this but the patterns in GCC are currently | ||
| 374 | + turned off. */ | ||
| 375 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 376 | +#endif | ||
| 377 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h | ||
| 378 | =================================================================== | ||
| 379 | --- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h (revision 25552) | ||
| 380 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h (working copy) | ||
| 381 | @@ -6,7 +6,7 @@ | ||
| 382 | # define __WORDSIZE 32 | ||
| 383 | #endif | ||
| 384 | |||
| 385 | -#if 0 /* uClibc: done in mathdefs.h: defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL*/ | ||
| 386 | +#if 0 /* uClibc: done in mathdefs.h: !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL*/ | ||
| 387 | |||
| 388 | # if __WORDSIZE == 32 | ||
| 389 | /* Signal that in 32bit ABI we didn't used to have a `long double'. | ||
| 390 | @@ -14,7 +14,7 @@ | ||
| 391 | to the double functions. */ | ||
| 392 | # define __LONG_DOUBLE_MATH_OPTIONAL 1 | ||
| 393 | # ifndef __LONG_DOUBLE_128__ | ||
| 394 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 395 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 396 | # endif | ||
| 397 | # endif | ||
| 398 | #endif | ||
| 399 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h | ||
| 400 | =================================================================== | ||
| 401 | --- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h (revision 25552) | ||
| 402 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h (working copy) | ||
| 403 | @@ -57,13 +57,15 @@ typedef double double_t; | ||
| 404 | |||
| 405 | #endif /* ISO C99 */ | ||
| 406 | |||
| 407 | -#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 408 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 409 | |||
| 410 | # if __WORDSIZE == 32 | ||
| 411 | /* Signal that in 32bit ABI we do not really have a `long double'. | ||
| 412 | The disables the declaration of all the `long double' function | ||
| 413 | variants. */ | ||
| 414 | -# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 415 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 416 | +# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 417 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 418 | # endif | ||
| 419 | |||
| 420 | #endif | ||
| 421 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h | ||
| 422 | =================================================================== | ||
| 423 | --- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h (revision 25552) | ||
| 424 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h (working copy) | ||
| 425 | @@ -37,7 +37,7 @@ | ||
| 426 | |||
| 427 | # if __WORDSIZE == 32 | ||
| 428 | |||
| 429 | -# ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 430 | +# ifndef __NO_LONG_DOUBLE_MATH | ||
| 431 | |||
| 432 | # define __unordered_cmp(x, y) \ | ||
| 433 | (__extension__ \ | ||
| 434 | @@ -157,7 +157,7 @@ __NTH (__signbit (double __x)) | ||
| 435 | return __u.__i[0] < 0; | ||
| 436 | } | ||
| 437 | |||
| 438 | -# ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 439 | +# ifndef __NO_LONG_DOUBLE_MATH | ||
| 440 | __MATH_INLINE int | ||
| 441 | __NTH (__signbitl (long double __x)) | ||
| 442 | { | ||
| 443 | @@ -219,7 +219,7 @@ __NTH (sqrtl (long double __x)) | ||
| 444 | _Qp_sqrt (&__r, &__x); | ||
| 445 | return __r; | ||
| 446 | } | ||
| 447 | -# elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 448 | +# elif !defined __NO_LONG_DOUBLE_MATH | ||
| 449 | __MATH_INLINE long double | ||
| 450 | sqrtl (long double __x) __THROW | ||
| 451 | { | ||
| 452 | @@ -257,7 +257,7 @@ __ieee754_sqrtl (long double __x) | ||
| 453 | _Qp_sqrt(&__r, &__x); | ||
| 454 | return __r; | ||
| 455 | } | ||
| 456 | -# elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ | ||
| 457 | +# elif !defined __NO_LONG_DOUBLE_MATH | ||
| 458 | __MATH_INLINE long double | ||
| 459 | __ieee754_sqrtl (long double __x) | ||
| 460 | { | ||
| 461 | Index: uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h | ||
| 462 | =================================================================== | ||
| 463 | --- uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h (revision 25552) | ||
| 464 | +++ uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h (working copy) | ||
| 465 | @@ -61,3 +61,9 @@ typedef double double_t; | ||
| 466 | # define FP_ILOGBNAN 0x7fffffff | ||
| 467 | |||
| 468 | #endif /* ISO C99 */ | ||
| 469 | + | ||
| 470 | +#ifndef __NO_LONG_DOUBLE_MATH | ||
| 471 | +/* Signal that we do not really have a `long double'. The disables the | ||
| 472 | + declaration of all the `long double' function variants. */ | ||
| 473 | +# define __NO_LONG_DOUBLE_MATH 1 | ||
| 474 | +#endif | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc_ldso_use_O0.patch b/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc_ldso_use_O0.patch deleted file mode 100644 index 7a89e66621..0000000000 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uclibc_ldso_use_O0.patch +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | Index: uClibc/ldso/ldso/Makefile.in | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc.orig/ldso/ldso/Makefile.in 2009-02-03 17:27:55.000000000 -0800 | ||
| 4 | +++ uClibc/ldso/ldso/Makefile.in 2009-02-03 17:28:11.000000000 -0800 | ||
| 5 | @@ -8,7 +8,7 @@ | ||
| 6 | CFLAGS-ldso := -DNOT_IN_libc -DIS_IN_rtld $(SSP_DISABLE_FLAGS) | ||
| 7 | |||
| 8 | # This stuff will not work with -fomit-frame-pointer | ||
| 9 | -CFLAGS-ldso += -fno-omit-frame-pointer | ||
| 10 | +CFLAGS-ldso += -O0 -fno-omit-frame-pointer | ||
| 11 | |||
| 12 | CFLAGS-ldso += -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso | ||
| 13 | CFLAGS-ldso += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" | ||
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc new file mode 100644 index 0000000000..3679c104c7 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-config.inc | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | # | ||
| 2 | # Set the ARCH environment variable for uClibc compilation. | ||
| 3 | # Return value must match one of the architectures known to uClibc: | ||
| 4 | # libc/sysdeps/*/* | ||
| 5 | # | ||
| 6 | |||
| 7 | valid_archs = "\ | ||
| 8 | alpha \ | ||
| 9 | arm \ | ||
| 10 | avr32 \ | ||
| 11 | bfin \ | ||
| 12 | cris \ | ||
| 13 | e1 \ | ||
| 14 | frv \ | ||
| 15 | h8300 \ | ||
| 16 | hppa \ | ||
| 17 | i386 \ | ||
| 18 | i960 \ | ||
| 19 | ia64 \ | ||
| 20 | m68k \ | ||
| 21 | microblaze \ | ||
| 22 | mips \ | ||
| 23 | nios \ | ||
| 24 | nios2 \ | ||
| 25 | powerpc \ | ||
| 26 | sh \ | ||
| 27 | sh64 \ | ||
| 28 | sparc \ | ||
| 29 | v850 \ | ||
| 30 | vax \ | ||
| 31 | x86_64 \ | ||
| 32 | xtensa \ | ||
| 33 | " | ||
| 34 | def map_uclibc_arch(a, d): | ||
| 35 | """Return the uClibc architecture for the given TARGET_ARCH.""" | ||
| 36 | import re | ||
| 37 | |||
| 38 | valid_archs = bb.data.getVar('valid_archs', d, 1).split() | ||
| 39 | |||
| 40 | if re.match('^(arm|sa110).*', a): return 'arm' | ||
| 41 | elif re.match('^(i.86|athlon)$', a): return 'i386' | ||
| 42 | elif re.match('^mips.*', a): return 'mips' | ||
| 43 | elif re.match('^parisc.*', a): return 'hppa' | ||
| 44 | elif re.match('^ppc.*', a): return 'powerpc' | ||
| 45 | elif re.match('^s390.*', a): return 's390' | ||
| 46 | elif re.match('^sh.*', a): return 'sh' | ||
| 47 | elif re.match('^(sun|sparc).*', a): return 'sparc' | ||
| 48 | elif re.match('^xtensa.*', a): return 'xtensa' | ||
| 49 | elif a in valid_archs: return a | ||
| 50 | else: | ||
| 51 | bb.error("cannot map '%s' to a uClibc architecture" % a) | ||
| 52 | |||
| 53 | export UCLIBC_ARCH = "${@map_uclibc_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}" | ||
| 54 | |||
| 55 | def map_uclibc_abi(o, d): | ||
| 56 | """Return the uClibc ABI for the given TARGET_OS.""" | ||
| 57 | import re | ||
| 58 | |||
| 59 | arch = bb.data.getVar('TARGET_ARCH', d, 1) | ||
| 60 | if map_uclibc_arch(bb.data.getVar('TARGET_ARCH', d, 1), d) == "arm": | ||
| 61 | if re.match('.*eabi$', o): return 'ARM_EABI' | ||
| 62 | else: return 'ARM_OABI' | ||
| 63 | # FIXME: This is inaccurate! Handle o32, n32, n64 | ||
| 64 | elif re.match('^mips.*64$', arch): return 'MIPS_N64_ABI' | ||
| 65 | elif re.match('^mips.*', arch): return 'MIPS_O32_ABI' | ||
| 66 | return "" | ||
| 67 | |||
| 68 | export UCLIBC_ABI = "${@map_uclibc_abi(bb.data.getVar('TARGET_OS', d, 1), d)}" | ||
| 69 | |||
| 70 | def map_uclibc_endian(a, d): | ||
| 71 | """Return the uClibc endianess for the given TARGET_ARCH.""" | ||
| 72 | import re | ||
| 73 | |||
| 74 | # Always BE | ||
| 75 | if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a): | ||
| 76 | return 'BIG' | ||
| 77 | # Possibly BE | ||
| 78 | elif re.match('^((arm|sa110|arm.*eb)|h8300.*eb|(parisc|hppa).*eb|mips|sh.*eb|xtensa.*eb)$', a): | ||
| 79 | return 'BIG' | ||
| 80 | return 'LITTLE' | ||
| 81 | |||
| 82 | export UCLIBC_ENDIAN = "${@map_uclibc_endian(bb.data.getVar('TARGET_ARCH', d, 1), d)}" | ||
| 83 | |||
| 84 | # internal helper | ||
| 85 | def uclibc_cfg(feature, features, tokens, cnf, rem): | ||
| 86 | if type(tokens) == type(""): | ||
| 87 | tokens = [tokens] | ||
| 88 | rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) | ||
| 89 | if type(features) == type([]) and feature in features: | ||
| 90 | cnf.extend([token + '=y' for token in tokens]) | ||
| 91 | else: | ||
| 92 | cnf.extend(['# ' + token + ' is not set' for token in tokens]) | ||
| 93 | |||
| 94 | # Map distro and machine features to config settings | ||
| 95 | def features_to_uclibc_settings(d): | ||
| 96 | cnf, rem = ([], []) | ||
| 97 | distro_features = bb.data.getVar('DISTRO_FEATURES', d, True).split() | ||
| 98 | machine_features = bb.data.getVar('MACHINE_FEATURES', d, True).split() | ||
| 99 | uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem) | ||
| 100 | uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem) | ||
| 101 | uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem) | ||
| 102 | uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem) | ||
| 103 | uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem) | ||
| 104 | uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem) | ||
| 105 | uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem) | ||
| 106 | uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem) | ||
| 107 | uclibc_cfg('kernel24', machine_features,'UCLIBC_LINUX_MODULE_24', cnf, rem) | ||
| 108 | return "\n".join(cnf), "\n".join(rem) | ||
| 109 | # X, Y = ${@features_to_uclibc_settings(d)} | ||
| 110 | # unfortunately doesn't seem to work with bitbake, workaround: | ||
| 111 | def features_to_uclibc_conf(d): | ||
| 112 | cnf, rem = features_to_uclibc_settings(d) | ||
| 113 | return cnf | ||
| 114 | def features_to_uclibc_del(d): | ||
| 115 | cnf, rem = features_to_uclibc_settings(d) | ||
| 116 | return rem | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch b/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch new file mode 100644 index 0000000000..7fd148fed2 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch | |||
| @@ -0,0 +1,581 @@ | |||
| 1 | Added headers file needed by argp sources. | ||
| 2 | |||
| 3 | Signed-off-by: Salvatore Cro <salvatore.cro at st.com> | ||
| 4 | --- | ||
| 5 | include/argp.h | 566 ++++++++++++++++++++++++++++++++++++++++++++ | ||
| 6 | libc/argp/argp-fmtstream.h | 314 ++++++++++++++++++++++++ | ||
| 7 | 2 files changed, 880 insertions(+), 0 deletions(-) | ||
| 8 | create mode 100644 include/argp.h | ||
| 9 | create mode 100644 libc/argp/argp-fmtstream.h | ||
| 10 | |||
| 11 | Index: git/include/argp.h | ||
| 12 | =================================================================== | ||
| 13 | --- /dev/null | ||
| 14 | +++ git/include/argp.h | ||
| 15 | @@ -0,0 +1,566 @@ | ||
| 16 | +/* Hierarchial argument parsing, layered over getopt. | ||
| 17 | + Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009 | ||
| 18 | + Free Software Foundation, Inc. | ||
| 19 | + This file is part of the GNU C Library. | ||
| 20 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 21 | + | ||
| 22 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 23 | + modify it under the terms of the GNU Lesser General Public | ||
| 24 | + License as published by the Free Software Foundation; either | ||
| 25 | + version 2.1 of the License, or (at your option) any later version. | ||
| 26 | + | ||
| 27 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 28 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 29 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 30 | + Lesser General Public License for more details. | ||
| 31 | + | ||
| 32 | + You should have received a copy of the GNU Lesser General Public | ||
| 33 | + License along with the GNU C Library; if not, write to the Free | ||
| 34 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 35 | + 02111-1307 USA. | ||
| 36 | + | ||
| 37 | + Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com> | ||
| 38 | +*/ | ||
| 39 | + | ||
| 40 | +#ifndef _ARGP_H | ||
| 41 | +#define _ARGP_H | ||
| 42 | + | ||
| 43 | +#include <stdio.h> | ||
| 44 | +#include <ctype.h> | ||
| 45 | +#include <limits.h> | ||
| 46 | + | ||
| 47 | +#define __need_error_t | ||
| 48 | +#include <errno.h> | ||
| 49 | + | ||
| 50 | +#ifndef __const | ||
| 51 | +# define __const const | ||
| 52 | +#endif | ||
| 53 | + | ||
| 54 | +#ifndef __THROW | ||
| 55 | +# define __THROW | ||
| 56 | +#endif | ||
| 57 | +#ifndef __NTH | ||
| 58 | +# define __NTH(fct) fct __THROW | ||
| 59 | +#endif | ||
| 60 | + | ||
| 61 | +#ifndef __attribute__ | ||
| 62 | +/* This feature is available in gcc versions 2.5 and later. */ | ||
| 63 | +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__) | ||
| 64 | +# define __attribute__(Spec) /* empty */ | ||
| 65 | +# endif | ||
| 66 | +/* The __-protected variants of `format' and `printf' attributes | ||
| 67 | + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ | ||
| 68 | +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__) | ||
| 69 | +# define __format__ format | ||
| 70 | +# define __printf__ printf | ||
| 71 | +# endif | ||
| 72 | +#endif | ||
| 73 | + | ||
| 74 | +/* GCC 2.95 and later have "__restrict"; C99 compilers have | ||
| 75 | + "restrict", and "configure" may have defined "restrict". */ | ||
| 76 | +#ifndef __restrict | ||
| 77 | +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) | ||
| 78 | +# if defined restrict || 199901L <= __STDC_VERSION__ | ||
| 79 | +# define __restrict restrict | ||
| 80 | +# else | ||
| 81 | +# define __restrict | ||
| 82 | +# endif | ||
| 83 | +# endif | ||
| 84 | +#endif | ||
| 85 | + | ||
| 86 | +#ifndef __error_t_defined | ||
| 87 | +typedef int error_t; | ||
| 88 | +# define __error_t_defined | ||
| 89 | +#endif | ||
| 90 | + | ||
| 91 | +#ifdef __cplusplus | ||
| 92 | +extern "C" { | ||
| 93 | +#endif | ||
| 94 | + | ||
| 95 | +/* A description of a particular option. A pointer to an array of | ||
| 96 | + these is passed in the OPTIONS field of an argp structure. Each option | ||
| 97 | + entry can correspond to one long option and/or one short option; more | ||
| 98 | + names for the same option can be added by following an entry in an option | ||
| 99 | + array with options having the OPTION_ALIAS flag set. */ | ||
| 100 | +struct argp_option | ||
| 101 | +{ | ||
| 102 | + /* The long option name. For more than one name for the same option, you | ||
| 103 | + can use following options with the OPTION_ALIAS flag set. */ | ||
| 104 | + __const char *name; | ||
| 105 | + | ||
| 106 | + /* What key is returned for this option. If > 0 and printable, then it's | ||
| 107 | + also accepted as a short option. */ | ||
| 108 | + int key; | ||
| 109 | + | ||
| 110 | + /* If non-NULL, this is the name of the argument associated with this | ||
| 111 | + option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ | ||
| 112 | + __const char *arg; | ||
| 113 | + | ||
| 114 | + /* OPTION_ flags. */ | ||
| 115 | + int flags; | ||
| 116 | + | ||
| 117 | + /* The doc string for this option. If both NAME and KEY are 0, This string | ||
| 118 | + will be printed outdented from the normal option column, making it | ||
| 119 | + useful as a group header (it will be the first thing printed in its | ||
| 120 | + group); in this usage, it's conventional to end the string with a `:'. */ | ||
| 121 | + __const char *doc; | ||
| 122 | + | ||
| 123 | + /* The group this option is in. In a long help message, options are sorted | ||
| 124 | + alphabetically within each group, and the groups presented in the order | ||
| 125 | + 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with | ||
| 126 | + if this field 0 will inherit the group number of the previous entry, or | ||
| 127 | + zero if it's the first one, unless its a group header (NAME and KEY both | ||
| 128 | + 0), in which case, the previous entry + 1 is the default. Automagic | ||
| 129 | + options such as --help are put into group -1. */ | ||
| 130 | + int group; | ||
| 131 | +}; | ||
| 132 | + | ||
| 133 | +/* The argument associated with this option is optional. */ | ||
| 134 | +#define OPTION_ARG_OPTIONAL 0x1 | ||
| 135 | + | ||
| 136 | +/* This option isn't displayed in any help messages. */ | ||
| 137 | +#define OPTION_HIDDEN 0x2 | ||
| 138 | + | ||
| 139 | +/* This option is an alias for the closest previous non-alias option. This | ||
| 140 | + means that it will be displayed in the same help entry, and will inherit | ||
| 141 | + fields other than NAME and KEY from the aliased option. */ | ||
| 142 | +#define OPTION_ALIAS 0x4 | ||
| 143 | + | ||
| 144 | +/* This option isn't actually an option (and so should be ignored by the | ||
| 145 | + actual option parser), but rather an arbitrary piece of documentation that | ||
| 146 | + should be displayed in much the same manner as the options. If this flag | ||
| 147 | + is set, then the option NAME field is displayed unmodified (e.g., no `--' | ||
| 148 | + prefix is added) at the left-margin (where a *short* option would normally | ||
| 149 | + be displayed), and the documentation string in the normal place. For | ||
| 150 | + purposes of sorting, any leading whitespace and punctuation is ignored, | ||
| 151 | + except that if the first non-whitespace character is not `-', this entry | ||
| 152 | + is displayed after all options (and OPTION_DOC entries with a leading `-') | ||
| 153 | + in the same group. */ | ||
| 154 | +#define OPTION_DOC 0x8 | ||
| 155 | + | ||
| 156 | +/* This option shouldn't be included in `long' usage messages (but is still | ||
| 157 | + included in help messages). This is mainly intended for options that are | ||
| 158 | + completely documented in an argp's ARGS_DOC field, in which case including | ||
| 159 | + the option in the generic usage list would be redundant. For instance, | ||
| 160 | + if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to | ||
| 161 | + distinguish these two cases, -x should probably be marked | ||
| 162 | + OPTION_NO_USAGE. */ | ||
| 163 | +#define OPTION_NO_USAGE 0x10 | ||
| 164 | + | ||
| 165 | +struct argp; /* fwd declare this type */ | ||
| 166 | +struct argp_state; /* " */ | ||
| 167 | +struct argp_child; /* " */ | ||
| 168 | + | ||
| 169 | +/* The type of a pointer to an argp parsing function. */ | ||
| 170 | +typedef error_t (*argp_parser_t) (int __key, char *__arg, | ||
| 171 | + struct argp_state *__state); | ||
| 172 | + | ||
| 173 | +/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such | ||
| 174 | + returns will simply be ignored. For user keys, this error will be turned | ||
| 175 | + into EINVAL (if the call to argp_parse is such that errors are propagated | ||
| 176 | + back to the user instead of exiting); returning EINVAL itself would result | ||
| 177 | + in an immediate stop to parsing in *all* cases. */ | ||
| 178 | +#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ | ||
| 179 | + | ||
| 180 | +/* Special values for the KEY argument to an argument parsing function. | ||
| 181 | + ARGP_ERR_UNKNOWN should be returned if they aren't understood. | ||
| 182 | + | ||
| 183 | + The sequence of keys to a parsing function is either (where each | ||
| 184 | + uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): | ||
| 185 | + | ||
| 186 | + INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all | ||
| 187 | + or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed | ||
| 188 | + or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized | ||
| 189 | + | ||
| 190 | + The third case is where every parser returned ARGP_KEY_UNKNOWN for an | ||
| 191 | + argument, in which case parsing stops at that argument (returning the | ||
| 192 | + unparsed arguments to the caller of argp_parse if requested, or stopping | ||
| 193 | + with an error message if not). | ||
| 194 | + | ||
| 195 | + If an error occurs (either detected by argp, or because the parsing | ||
| 196 | + function returned an error value), then the parser is called with | ||
| 197 | + ARGP_KEY_ERROR, and no further calls are made. */ | ||
| 198 | + | ||
| 199 | +/* This is not an option at all, but rather a command line argument. If a | ||
| 200 | + parser receiving this key returns success, the fact is recorded, and the | ||
| 201 | + ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the | ||
| 202 | + argument, a parser function decrements the NEXT field of the state it's | ||
| 203 | + passed, the option won't be considered processed; this is to allow you to | ||
| 204 | + actually modify the argument (perhaps into an option), and have it | ||
| 205 | + processed again. */ | ||
| 206 | +#define ARGP_KEY_ARG 0 | ||
| 207 | +/* There are remaining arguments not parsed by any parser, which may be found | ||
| 208 | + starting at (STATE->argv + STATE->next). If success is returned, but | ||
| 209 | + STATE->next left untouched, it's assumed that all arguments were consume, | ||
| 210 | + otherwise, the parser should adjust STATE->next to reflect any arguments | ||
| 211 | + consumed. */ | ||
| 212 | +#define ARGP_KEY_ARGS 0x1000006 | ||
| 213 | +/* There are no more command line arguments at all. */ | ||
| 214 | +#define ARGP_KEY_END 0x1000001 | ||
| 215 | +/* Because it's common to want to do some special processing if there aren't | ||
| 216 | + any non-option args, user parsers are called with this key if they didn't | ||
| 217 | + successfully process any non-option arguments. Called just before | ||
| 218 | + ARGP_KEY_END (where more general validity checks on previously parsed | ||
| 219 | + arguments can take place). */ | ||
| 220 | +#define ARGP_KEY_NO_ARGS 0x1000002 | ||
| 221 | +/* Passed in before any parsing is done. Afterwards, the values of each | ||
| 222 | + element of the CHILD_INPUT field, if any, in the state structure is | ||
| 223 | + copied to each child's state to be the initial value of the INPUT field. */ | ||
| 224 | +#define ARGP_KEY_INIT 0x1000003 | ||
| 225 | +/* Use after all other keys, including SUCCESS & END. */ | ||
| 226 | +#define ARGP_KEY_FINI 0x1000007 | ||
| 227 | +/* Passed in when parsing has successfully been completed (even if there are | ||
| 228 | + still arguments remaining). */ | ||
| 229 | +#define ARGP_KEY_SUCCESS 0x1000004 | ||
| 230 | +/* Passed in if an error occurs. */ | ||
| 231 | +#define ARGP_KEY_ERROR 0x1000005 | ||
| 232 | + | ||
| 233 | +/* An argp structure contains a set of options declarations, a function to | ||
| 234 | + deal with parsing one, documentation string, a possible vector of child | ||
| 235 | + argp's, and perhaps a function to filter help output. When actually | ||
| 236 | + parsing options, getopt is called with the union of all the argp | ||
| 237 | + structures chained together through their CHILD pointers, with conflicts | ||
| 238 | + being resolved in favor of the first occurrence in the chain. */ | ||
| 239 | +struct argp | ||
| 240 | +{ | ||
| 241 | + /* An array of argp_option structures, terminated by an entry with both | ||
| 242 | + NAME and KEY having a value of 0. */ | ||
| 243 | + __const struct argp_option *options; | ||
| 244 | + | ||
| 245 | + /* What to do with an option from this structure. KEY is the key | ||
| 246 | + associated with the option, and ARG is any associated argument (NULL if | ||
| 247 | + none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be | ||
| 248 | + returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then | ||
| 249 | + parsing is stopped immediately, and that value is returned from | ||
| 250 | + argp_parse(). For special (non-user-supplied) values of KEY, see the | ||
| 251 | + ARGP_KEY_ definitions below. */ | ||
| 252 | + argp_parser_t parser; | ||
| 253 | + | ||
| 254 | + /* A string describing what other arguments are wanted by this program. It | ||
| 255 | + is only used by argp_usage to print the `Usage:' message. If it | ||
| 256 | + contains newlines, the strings separated by them are considered | ||
| 257 | + alternative usage patterns, and printed on separate lines (lines after | ||
| 258 | + the first are prefix by ` or: ' instead of `Usage:'). */ | ||
| 259 | + __const char *args_doc; | ||
| 260 | + | ||
| 261 | + /* If non-NULL, a string containing extra text to be printed before and | ||
| 262 | + after the options in a long help message (separated by a vertical tab | ||
| 263 | + `\v' character). */ | ||
| 264 | + __const char *doc; | ||
| 265 | + | ||
| 266 | + /* A vector of argp_children structures, terminated by a member with a 0 | ||
| 267 | + argp field, pointing to child argps should be parsed with this one. Any | ||
| 268 | + conflicts are resolved in favor of this argp, or early argps in the | ||
| 269 | + CHILDREN list. This field is useful if you use libraries that supply | ||
| 270 | + their own argp structure, which you want to use in conjunction with your | ||
| 271 | + own. */ | ||
| 272 | + __const struct argp_child *children; | ||
| 273 | + | ||
| 274 | + /* If non-zero, this should be a function to filter the output of help | ||
| 275 | + messages. KEY is either a key from an option, in which case TEXT is | ||
| 276 | + that option's help text, or a special key from the ARGP_KEY_HELP_ | ||
| 277 | + defines, below, describing which other help text TEXT is. The function | ||
| 278 | + should return either TEXT, if it should be used as-is, a replacement | ||
| 279 | + string, which should be malloced, and will be freed by argp, or NULL, | ||
| 280 | + meaning `print nothing'. The value for TEXT is *after* any translation | ||
| 281 | + has been done, so if any of the replacement text also needs translation, | ||
| 282 | + that should be done by the filter function. INPUT is either the input | ||
| 283 | + supplied to argp_parse, or NULL, if argp_help was called directly. */ | ||
| 284 | + char *(*help_filter) (int __key, __const char *__text, void *__input); | ||
| 285 | + | ||
| 286 | + /* If non-zero the strings used in the argp library are translated using | ||
| 287 | + the domain described by this string. Otherwise the currently installed | ||
| 288 | + default domain is used. */ | ||
| 289 | + const char *argp_domain; | ||
| 290 | +}; | ||
| 291 | + | ||
| 292 | +/* Possible KEY arguments to a help filter function. */ | ||
| 293 | +#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ | ||
| 294 | +#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ | ||
| 295 | +#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ | ||
| 296 | +#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; | ||
| 297 | + TEXT is NULL for this key. */ | ||
| 298 | +/* Explanatory note emitted when duplicate option arguments have been | ||
| 299 | + suppressed. */ | ||
| 300 | +#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 | ||
| 301 | +#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ | ||
| 302 | + | ||
| 303 | +/* When an argp has a non-zero CHILDREN field, it should point to a vector of | ||
| 304 | + argp_child structures, each of which describes a subsidiary argp. */ | ||
| 305 | +struct argp_child | ||
| 306 | +{ | ||
| 307 | + /* The child parser. */ | ||
| 308 | + __const struct argp *argp; | ||
| 309 | + | ||
| 310 | + /* Flags for this child. */ | ||
| 311 | + int flags; | ||
| 312 | + | ||
| 313 | + /* If non-zero, an optional header to be printed in help output before the | ||
| 314 | + child options. As a side-effect, a non-zero value forces the child | ||
| 315 | + options to be grouped together; to achieve this effect without actually | ||
| 316 | + printing a header string, use a value of "". */ | ||
| 317 | + __const char *header; | ||
| 318 | + | ||
| 319 | + /* Where to group the child options relative to the other (`consolidated') | ||
| 320 | + options in the parent argp; the values are the same as the GROUP field | ||
| 321 | + in argp_option structs, but all child-groupings follow parent options at | ||
| 322 | + a particular group level. If both this field and HEADER are zero, then | ||
| 323 | + they aren't grouped at all, but rather merged with the parent options | ||
| 324 | + (merging the child's grouping levels with the parents). */ | ||
| 325 | + int group; | ||
| 326 | +}; | ||
| 327 | + | ||
| 328 | +/* Parsing state. This is provided to parsing functions called by argp, | ||
| 329 | + which may examine and, as noted, modify fields. */ | ||
| 330 | +struct argp_state | ||
| 331 | +{ | ||
| 332 | + /* The top level ARGP being parsed. */ | ||
| 333 | + __const struct argp *root_argp; | ||
| 334 | + | ||
| 335 | + /* The argument vector being parsed. May be modified. */ | ||
| 336 | + int argc; | ||
| 337 | + char **argv; | ||
| 338 | + | ||
| 339 | + /* The index in ARGV of the next arg that to be parsed. May be modified. */ | ||
| 340 | + int next; | ||
| 341 | + | ||
| 342 | + /* The flags supplied to argp_parse. May be modified. */ | ||
| 343 | + unsigned flags; | ||
| 344 | + | ||
| 345 | + /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the | ||
| 346 | + number of the current arg, starting at zero, and incremented after each | ||
| 347 | + such call returns. At all other times, this is the number of such | ||
| 348 | + arguments that have been processed. */ | ||
| 349 | + unsigned arg_num; | ||
| 350 | + | ||
| 351 | + /* If non-zero, the index in ARGV of the first argument following a special | ||
| 352 | + `--' argument (which prevents anything following being interpreted as an | ||
| 353 | + option). Only set once argument parsing has proceeded past this point. */ | ||
| 354 | + int quoted; | ||
| 355 | + | ||
| 356 | + /* An arbitrary pointer passed in from the user. */ | ||
| 357 | + void *input; | ||
| 358 | + /* Values to pass to child parsers. This vector will be the same length as | ||
| 359 | + the number of children for the current parser. */ | ||
| 360 | + void **child_inputs; | ||
| 361 | + | ||
| 362 | + /* For the parser's use. Initialized to 0. */ | ||
| 363 | + void *hook; | ||
| 364 | + | ||
| 365 | + /* The name used when printing messages. This is initialized to ARGV[0], | ||
| 366 | + or PROGRAM_INVOCATION_NAME if that is unavailable. */ | ||
| 367 | + char *name; | ||
| 368 | + | ||
| 369 | + /* Streams used when argp prints something. */ | ||
| 370 | + FILE *err_stream; /* For errors; initialized to stderr. */ | ||
| 371 | + FILE *out_stream; /* For information; initialized to stdout. */ | ||
| 372 | + | ||
| 373 | + void *pstate; /* Private, for use by argp. */ | ||
| 374 | +}; | ||
| 375 | + | ||
| 376 | +/* Flags for argp_parse (note that the defaults are those that are | ||
| 377 | + convenient for program command line parsing): */ | ||
| 378 | + | ||
| 379 | +/* Don't ignore the first element of ARGV. Normally (and always unless | ||
| 380 | + ARGP_NO_ERRS is set) the first element of the argument vector is | ||
| 381 | + skipped for option parsing purposes, as it corresponds to the program name | ||
| 382 | + in a command line. */ | ||
| 383 | +#define ARGP_PARSE_ARGV0 0x01 | ||
| 384 | + | ||
| 385 | +/* Don't print error messages for unknown options to stderr; unless this flag | ||
| 386 | + is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program | ||
| 387 | + name in the error messages. This flag implies ARGP_NO_EXIT (on the | ||
| 388 | + assumption that silent exiting upon errors is bad behaviour). */ | ||
| 389 | +#define ARGP_NO_ERRS 0x02 | ||
| 390 | + | ||
| 391 | +/* Don't parse any non-option args. Normally non-option args are parsed by | ||
| 392 | + calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg | ||
| 393 | + as the value. Since it's impossible to know which parse function wants to | ||
| 394 | + handle it, each one is called in turn, until one returns 0 or an error | ||
| 395 | + other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the | ||
| 396 | + argp_parse returns prematurely (but with a return value of 0). If all | ||
| 397 | + args have been parsed without error, all parsing functions are called one | ||
| 398 | + last time with a key of ARGP_KEY_END. This flag needn't normally be set, | ||
| 399 | + as the normal behavior is to stop parsing as soon as some argument can't | ||
| 400 | + be handled. */ | ||
| 401 | +#define ARGP_NO_ARGS 0x04 | ||
| 402 | + | ||
| 403 | +/* Parse options and arguments in the same order they occur on the command | ||
| 404 | + line -- normally they're rearranged so that all options come first. */ | ||
| 405 | +#define ARGP_IN_ORDER 0x08 | ||
| 406 | + | ||
| 407 | +/* Don't provide the standard long option --help, which causes usage and | ||
| 408 | + option help information to be output to stdout, and exit (0) called. */ | ||
| 409 | +#define ARGP_NO_HELP 0x10 | ||
| 410 | + | ||
| 411 | +/* Don't exit on errors (they may still result in error messages). */ | ||
| 412 | +#define ARGP_NO_EXIT 0x20 | ||
| 413 | + | ||
| 414 | +/* Use the gnu getopt `long-only' rules for parsing arguments. */ | ||
| 415 | +#define ARGP_LONG_ONLY 0x40 | ||
| 416 | + | ||
| 417 | +/* Turns off any message-printing/exiting options. */ | ||
| 418 | +#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) | ||
| 419 | + | ||
| 420 | +/* Parse the options strings in ARGC & ARGV according to the options in ARGP. | ||
| 421 | + FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the | ||
| 422 | + index in ARGV of the first unparsed option is returned in it. If an | ||
| 423 | + unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser | ||
| 424 | + routine returned a non-zero value, it is returned; otherwise 0 is | ||
| 425 | + returned. This function may also call exit unless the ARGP_NO_HELP flag | ||
| 426 | + is set. INPUT is a pointer to a value to be passed in to the parser. */ | ||
| 427 | +extern error_t argp_parse (__const struct argp *__restrict __argp, | ||
| 428 | + int __argc, char **__restrict __argv, | ||
| 429 | + unsigned __flags, int *__restrict __arg_index, | ||
| 430 | + void *__restrict __input); | ||
| 431 | + | ||
| 432 | +/* Global variables. */ | ||
| 433 | + | ||
| 434 | +/* If defined or set by the user program to a non-zero value, then a default | ||
| 435 | + option --version is added (unless the ARGP_NO_HELP flag is used), which | ||
| 436 | + will print this string followed by a newline and exit (unless the | ||
| 437 | + ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ | ||
| 438 | +extern __const char *argp_program_version; | ||
| 439 | + | ||
| 440 | +/* If defined or set by the user program to a non-zero value, then a default | ||
| 441 | + option --version is added (unless the ARGP_NO_HELP flag is used), which | ||
| 442 | + calls this function with a stream to print the version to and a pointer to | ||
| 443 | + the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is | ||
| 444 | + used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ | ||
| 445 | +extern void (*argp_program_version_hook) (FILE *__restrict __stream, | ||
| 446 | + struct argp_state *__restrict | ||
| 447 | + __state); | ||
| 448 | + | ||
| 449 | +/* If defined or set by the user program, it should point to string that is | ||
| 450 | + the bug-reporting address for the program. It will be printed by | ||
| 451 | + argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various | ||
| 452 | + standard help messages), embedded in a sentence that says something like | ||
| 453 | + `Report bugs to ADDR.'. */ | ||
| 454 | +extern __const char *argp_program_bug_address; | ||
| 455 | + | ||
| 456 | +/* The exit status that argp will use when exiting due to a parsing error. | ||
| 457 | + If not defined or set by the user program, this defaults to EX_USAGE from | ||
| 458 | + <sysexits.h>. */ | ||
| 459 | +extern error_t argp_err_exit_status; | ||
| 460 | + | ||
| 461 | +/* Flags for argp_help. */ | ||
| 462 | +#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ | ||
| 463 | +#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ | ||
| 464 | +#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ | ||
| 465 | +#define ARGP_HELP_LONG 0x08 /* a long help message. */ | ||
| 466 | +#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ | ||
| 467 | +#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ | ||
| 468 | +#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) | ||
| 469 | +#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ | ||
| 470 | +#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to | ||
| 471 | + reflect ARGP_LONG_ONLY mode. */ | ||
| 472 | + | ||
| 473 | +/* These ARGP_HELP flags are only understood by argp_state_help. */ | ||
| 474 | +#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ | ||
| 475 | +#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ | ||
| 476 | + | ||
| 477 | +/* The standard thing to do after a program command line parsing error, if an | ||
| 478 | + error message has already been printed. */ | ||
| 479 | +#define ARGP_HELP_STD_ERR \ | ||
| 480 | + (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) | ||
| 481 | +/* The standard thing to do after a program command line parsing error, if no | ||
| 482 | + more specific error message has been printed. */ | ||
| 483 | +#define ARGP_HELP_STD_USAGE \ | ||
| 484 | + (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) | ||
| 485 | +/* The standard thing to do in response to a --help option. */ | ||
| 486 | +#define ARGP_HELP_STD_HELP \ | ||
| 487 | + (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ | ||
| 488 | + | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) | ||
| 489 | + | ||
| 490 | +/* Output a usage message for ARGP to STREAM. FLAGS are from the set | ||
| 491 | + ARGP_HELP_*. */ | ||
| 492 | +extern void argp_help (__const struct argp *__restrict __argp, | ||
| 493 | + FILE *__restrict __stream, | ||
| 494 | + unsigned __flags, char *__restrict __name); | ||
| 495 | + | ||
| 496 | +/* The following routines are intended to be called from within an argp | ||
| 497 | + parsing routine (thus taking an argp_state structure as the first | ||
| 498 | + argument). They may or may not print an error message and exit, depending | ||
| 499 | + on the flags in STATE -- in any case, the caller should be prepared for | ||
| 500 | + them *not* to exit, and should return an appropiate error after calling | ||
| 501 | + them. [argp_usage & argp_error should probably be called argp_state_..., | ||
| 502 | + but they're used often enough that they should be short] */ | ||
| 503 | + | ||
| 504 | +/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are | ||
| 505 | + from the set ARGP_HELP_*. */ | ||
| 506 | +extern void argp_state_help (__const struct argp_state *__restrict __state, | ||
| 507 | + FILE *__restrict __stream, | ||
| 508 | + unsigned int __flags); | ||
| 509 | +/* Possibly output the standard usage message for ARGP to stderr and exit. */ | ||
| 510 | +extern void argp_usage (__const struct argp_state *__state); | ||
| 511 | + | ||
| 512 | +/* If appropriate, print the printf string FMT and following args, preceded | ||
| 513 | + by the program name and `:', to stderr, and followed by a `Try ... --help' | ||
| 514 | + message, then exit (1). */ | ||
| 515 | +extern void argp_error (__const struct argp_state *__restrict __state, | ||
| 516 | + __const char *__restrict __fmt, ...) | ||
| 517 | + __attribute__ ((__format__ (__printf__, 2, 3))); | ||
| 518 | +/* Similar to the standard gnu error-reporting function error(), but will | ||
| 519 | + respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print | ||
| 520 | + to STATE->err_stream. This is useful for argument parsing code that is | ||
| 521 | + shared between program startup (when exiting is desired) and runtime | ||
| 522 | + option parsing (when typically an error code is returned instead). The | ||
| 523 | + difference between this function and argp_error is that the latter is for | ||
| 524 | + *parsing errors*, and the former is for other problems that occur during | ||
| 525 | + parsing but don't reflect a (syntactic) problem with the input. */ | ||
| 526 | +extern void argp_failure (__const struct argp_state *__restrict __state, | ||
| 527 | + int __status, int __errnum, | ||
| 528 | + __const char *__restrict __fmt, ...) | ||
| 529 | + __attribute__ ((__format__ (__printf__, 4, 5))); | ||
| 530 | +/* Returns true if the option OPT is a valid short option. */ | ||
| 531 | +extern int _option_is_short (__const struct argp_option *__opt) __THROW; | ||
| 532 | +extern int __option_is_short (__const struct argp_option *__opt) __THROW; | ||
| 533 | + | ||
| 534 | +/* Returns true if the option OPT is in fact the last (unused) entry in an | ||
| 535 | + options array. */ | ||
| 536 | +extern int _option_is_end (__const struct argp_option *__opt) __THROW; | ||
| 537 | +extern int __option_is_end (__const struct argp_option *__opt) __THROW; | ||
| 538 | + | ||
| 539 | +/* Return the input field for ARGP in the parser corresponding to STATE; used | ||
| 540 | + by the help routines. */ | ||
| 541 | +/* We think this should not be exported */ | ||
| 542 | +extern void *__argp_input (__const struct argp *__restrict __argp, | ||
| 543 | + __const struct argp_state *__restrict __state) | ||
| 544 | + __THROW; | ||
| 545 | + | ||
| 546 | +#ifdef __USE_EXTERN_INLINES | ||
| 547 | + | ||
| 548 | +# ifndef ARGP_EI | ||
| 549 | +# define ARGP_EI __extern_inline | ||
| 550 | +# endif | ||
| 551 | + | ||
| 552 | +ARGP_EI void | ||
| 553 | +argp_usage (__const struct argp_state *__state) | ||
| 554 | +{ | ||
| 555 | + argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); | ||
| 556 | +} | ||
| 557 | + | ||
| 558 | +ARGP_EI int | ||
| 559 | +__NTH (__option_is_short (__const struct argp_option *__opt)) | ||
| 560 | +{ | ||
| 561 | + if (__opt->flags & OPTION_DOC) | ||
| 562 | + return 0; | ||
| 563 | + else | ||
| 564 | + { | ||
| 565 | + int __key = __opt->key; | ||
| 566 | + return __key > 0 && __key <= UCHAR_MAX && isprint (__key); | ||
| 567 | + } | ||
| 568 | +} | ||
| 569 | + | ||
| 570 | +ARGP_EI int | ||
| 571 | +__NTH (__option_is_end (__const struct argp_option *__opt)) | ||
| 572 | +{ | ||
| 573 | + return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; | ||
| 574 | +} | ||
| 575 | +#endif /* Use extern inlines. */ | ||
| 576 | + | ||
| 577 | +#ifdef __cplusplus | ||
| 578 | +} | ||
| 579 | +#endif | ||
| 580 | + | ||
| 581 | +#endif /* argp.h */ | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/argp-support.patch b/meta/recipes-core/uclibc/uclibc-git/argp-support.patch new file mode 100644 index 0000000000..04a3c7824c --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/argp-support.patch | |||
| @@ -0,0 +1,5189 @@ | |||
| 1 | From: Salvatore Cro <salvatore.cro at st.com> | ||
| 2 | |||
| 3 | Argp is an advanced support for parsing unix-style argument vectors. | ||
| 4 | In addition to the common getopt interface, it provides automatic response | ||
| 5 | to `--help' and `--version' options and use of custom parser in conjunction | ||
| 6 | with argp native option parser, among others. | ||
| 7 | Argp support is required by elfutils package and prelink. | ||
| 8 | |||
| 9 | In uClibc argp functionalities has been moved from C library to libuargp.so | ||
| 10 | Further the libc.so linker script contains an AS_NEEDED entry so that | ||
| 11 | it doesn't need to link libuargp.so explicitely. | ||
| 12 | |||
| 13 | Signed-off-by: Salvatore Cro <salvatore.cro at st.com> | ||
| 14 | Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com> | ||
| 15 | Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com> | ||
| 16 | --- | ||
| 17 | Makefile.in | 8 + | ||
| 18 | Makerules | 8 +- | ||
| 19 | Rules.mak | 7 + | ||
| 20 | extra/Configs/Config.in | 17 + | ||
| 21 | libc/sysdeps/linux/common/bits/getopt_int.h | 136 ++ | ||
| 22 | libc/unistd/getopt.c | 18 +- | ||
| 23 | libc/unistd/getopt_int.h | 134 -- | ||
| 24 | libuargp/Makefile | 14 + | ||
| 25 | libuargp/Makefile.in | 76 ++ | ||
| 26 | libuargp/argp-ba.c | 26 + | ||
| 27 | libuargp/argp-eexst.c | 32 + | ||
| 28 | libuargp/argp-fmtstream.c | 439 +++++++ | ||
| 29 | libuargp/argp-fmtstream.h | 314 +++++ | ||
| 30 | libuargp/argp-fs-xinl.c | 44 + | ||
| 31 | libuargp/argp-help.c | 1882 +++++++++++++++++++++++++++ | ||
| 32 | libuargp/argp-parse.c | 949 ++++++++++++++ | ||
| 33 | libuargp/argp-pv.c | 25 + | ||
| 34 | libuargp/argp-pvh.c | 32 + | ||
| 35 | libuargp/argp-xinl.c | 35 + | ||
| 36 | test/argp/Makefile | 7 + | ||
| 37 | test/argp/Makefile.in | 12 + | ||
| 38 | test/argp/argp-ex1.c | 15 + | ||
| 39 | test/argp/argp-ex2.c | 45 + | ||
| 40 | test/argp/argp-ex3.c | 153 +++ | ||
| 41 | test/argp/argp-ex4.c | 167 +++ | ||
| 42 | test/argp/argp-test.c | 209 +++ | ||
| 43 | test/argp/bug-argp1.c | 26 + | ||
| 44 | test/argp/tst-argp1.c | 118 ++ | ||
| 45 | test/argp/tst-argp2.c | 101 ++ | ||
| 46 | 29 files changed, 4911 insertions(+), 138 deletions(-) | ||
| 47 | create mode 100644 libc/sysdeps/linux/common/bits/getopt_int.h | ||
| 48 | delete mode 100644 libc/unistd/getopt_int.h | ||
| 49 | create mode 100644 libuargp/Makefile | ||
| 50 | create mode 100644 libuargp/Makefile.in | ||
| 51 | create mode 100644 libuargp/argp-ba.c | ||
| 52 | create mode 100644 libuargp/argp-eexst.c | ||
| 53 | create mode 100644 libuargp/argp-fmtstream.c | ||
| 54 | create mode 100644 libuargp/argp-fmtstream.h | ||
| 55 | create mode 100644 libuargp/argp-fs-xinl.c | ||
| 56 | create mode 100644 libuargp/argp-help.c | ||
| 57 | create mode 100644 libuargp/argp-parse.c | ||
| 58 | create mode 100644 libuargp/argp-pv.c | ||
| 59 | create mode 100644 libuargp/argp-pvh.c | ||
| 60 | create mode 100644 libuargp/argp-xinl.c | ||
| 61 | create mode 100644 test/argp/Makefile | ||
| 62 | create mode 100644 test/argp/Makefile.in | ||
| 63 | create mode 100644 test/argp/argp-ex1.c | ||
| 64 | create mode 100644 test/argp/argp-ex2.c | ||
| 65 | create mode 100644 test/argp/argp-ex3.c | ||
| 66 | create mode 100644 test/argp/argp-ex4.c | ||
| 67 | create mode 100644 test/argp/argp-test.c | ||
| 68 | create mode 100644 test/argp/bug-argp1.c | ||
| 69 | create mode 100644 test/argp/tst-argp1.c | ||
| 70 | create mode 100644 test/argp/tst-argp2.c | ||
| 71 | |||
| 72 | Index: git/Makefile.in | ||
| 73 | =================================================================== | ||
| 74 | --- git.orig/Makefile.in | ||
| 75 | +++ git/Makefile.in | ||
| 76 | @@ -48,6 +48,7 @@ include $(top_srcdir)libresolv/Makefile. | ||
| 77 | include $(top_srcdir)libutil/Makefile.in | ||
| 78 | include $(top_srcdir)libpthread/Makefile.in | ||
| 79 | include $(top_srcdir)librt/Makefile.in | ||
| 80 | +include $(top_srcdir)libuargp/Makefile.in | ||
| 81 | include $(top_srcdir)libubacktrace/Makefile.in | ||
| 82 | include $(top_srcdir)extra/locale/Makefile.in | ||
| 83 | |||
| 84 | @@ -230,6 +231,7 @@ HEADERS_RM- += sgtty.h | ||
| 85 | endif | ||
| 86 | HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h | ||
| 87 | HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h | ||
| 88 | +HEADERS_RM-$(UCLIBC_HAS_ARGP) += argp.h | ||
| 89 | HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h | ||
| 90 | HEADERS_RM-$(UCLIBC_HAS_CRYPT) += crypt.h | ||
| 91 | HEADERS_RM-$(UCLIBC_HAS_EPOLL) += sys/epoll.h | ||
| 92 | @@ -340,6 +342,12 @@ ifeq ($(UCLIBC_HAS_BACKTRACE),y) | ||
| 93 | echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \ | ||
| 94 | fi | ||
| 95 | endif | ||
| 96 | +ifeq ($(UCLIBC_HAS_ARGP),y) | ||
| 97 | +# Add the AS_NEEDED entry for libuargp.so | ||
| 98 | + if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \ | ||
| 99 | + echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \ | ||
| 100 | + fi | ||
| 101 | +endif | ||
| 102 | ifeq ($(UCLIBC_HAS_THREADS),y) | ||
| 103 | ifneq ($(LINUXTHREADS_OLD),y) | ||
| 104 | ifeq ($(HARDWIRED_ABSPATH),y) | ||
| 105 | Index: git/Makerules | ||
| 106 | =================================================================== | ||
| 107 | --- git.orig/Makerules | ||
| 108 | +++ git/Makerules | ||
| 109 | @@ -32,12 +32,12 @@ shared_objs = $(libc-y:.o=.os) $(libc-sh | ||
| 110 | $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \ | ||
| 111 | $(libresolv-so-y) $(librt-so-y) \ | ||
| 112 | $(ldso-y) \ | ||
| 113 | - $(libutil-so-y) $(libubacktrace-so-y) | ||
| 114 | + $(libutil-so-y) $(libubacktrace-so-y) $(libuargp-so-y) | ||
| 115 | |||
| 116 | ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \ | ||
| 117 | $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \ | ||
| 118 | $(libpthread-a-y) $(libthread_db-a-y) \ | ||
| 119 | - $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) | ||
| 120 | + $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) $(libuargp-a-y) | ||
| 121 | ifeq ($(DOPIC),y) | ||
| 122 | ar_objs := $(ar_objs:.o=.os) | ||
| 123 | endif | ||
| 124 | @@ -464,7 +464,7 @@ files.dep := $(libc-a-y) $(libc-so-y) $( | ||
| 125 | $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \ | ||
| 126 | $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \ | ||
| 127 | $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \ | ||
| 128 | - $(libubacktrace-a-y) $(libubacktrace-so-y) | ||
| 129 | + $(libubacktrace-a-y) $(libubacktrace-so-y) $(libuargp-so-y) $(libuargp-a-y) | ||
| 130 | .depends.dep := \ | ||
| 131 | $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \ | ||
| 132 | $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \ | ||
| 133 | Index: git/Rules.mak | ||
| 134 | =================================================================== | ||
| 135 | --- git.orig/Rules.mak | ||
| 136 | +++ git/Rules.mak | ||
| 137 | @@ -525,6 +525,13 @@ export UBACKTRACE_ASNEEDED:=$(shell $(LD | ||
| 138 | else | ||
| 139 | export UBACKTRACE_ASNEEDED:="" | ||
| 140 | endif | ||
| 141 | +ifeq ($(UCLIBC_HAS_ARGP),y) | ||
| 142 | +# Only used in installed libc.so linker script | ||
| 143 | +UARGP_FULL_NAME := $(RUNTIME_PREFIX)lib/libuargp.so.$(MAJOR_VERSION) | ||
| 144 | +export UARGP_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UARGP_FULL_NAME) )" || echo "$(UARGP_FULL_NAME)") | ||
| 145 | +else | ||
| 146 | +export UARGP_ASNEEDED:="" | ||
| 147 | +endif | ||
| 148 | endif | ||
| 149 | |||
| 150 | # Add a bunch of extra pedantic annoyingly strict checks | ||
| 151 | Index: git/extra/Configs/Config.in | ||
| 152 | =================================================================== | ||
| 153 | --- git.orig/extra/Configs/Config.in | ||
| 154 | +++ git/extra/Configs/Config.in | ||
| 155 | @@ -1814,6 +1814,23 @@ config UCLIBC_HAS_GNU_GETSUBOPT | ||
| 156 | smaller SUSv3 compatible getsubopt(). | ||
| 157 | |||
| 158 | Most people will answer Y. | ||
| 159 | + | ||
| 160 | +config UCLIBC_HAS_ARGP | ||
| 161 | + bool "Support argp (as standalone shared object)" | ||
| 162 | + default n | ||
| 163 | + help | ||
| 164 | + Argp is an interface for parsing unix-style argument vectors. Unlike | ||
| 165 | + the common getopt interface, it provides many advanced features in | ||
| 166 | + addition to parsing options, such as automatic output in response to | ||
| 167 | + `--help' and `--version' options. | ||
| 168 | + A library can export an argp option parser, which programs can easily | ||
| 169 | + use in conjunction with their own option parser. | ||
| 170 | + A new shared object "libuargp" is created. The "libc.so" linker script | ||
| 171 | + contains the AS_NEEDED entry for getting the libuargp linked automatically. | ||
| 172 | + Argp support is needed by elfutils libdw. | ||
| 173 | + | ||
| 174 | + Most people can safely answer N. | ||
| 175 | + | ||
| 176 | endmenu | ||
| 177 | |||
| 178 | |||
| 179 | Index: git/libc/sysdeps/linux/common/bits/getopt_int.h | ||
| 180 | =================================================================== | ||
| 181 | --- /dev/null | ||
| 182 | +++ git/libc/sysdeps/linux/common/bits/getopt_int.h | ||
| 183 | @@ -0,0 +1,136 @@ | ||
| 184 | +/* Internal declarations for getopt. | ||
| 185 | + Copyright (C) 1989-1994,1996-1999,2001,2003,2004 | ||
| 186 | + Free Software Foundation, Inc. | ||
| 187 | + This file is part of the GNU C Library. | ||
| 188 | + | ||
| 189 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 190 | + modify it under the terms of the GNU Lesser General Public | ||
| 191 | + License as published by the Free Software Foundation; either | ||
| 192 | + version 2.1 of the License, or (at your option) any later version. | ||
| 193 | + | ||
| 194 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 195 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 196 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 197 | + Lesser General Public License for more details. | ||
| 198 | + | ||
| 199 | + You should have received a copy of the GNU Lesser General Public | ||
| 200 | + License along with the GNU C Library; if not, write to the Free | ||
| 201 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 202 | + 02111-1307 USA. */ | ||
| 203 | + | ||
| 204 | +#ifndef _GETOPT_INT_H | ||
| 205 | +#define _GETOPT_INT_H 1 | ||
| 206 | + | ||
| 207 | +extern int _getopt_internal (int ___argc, char *const *___argv, | ||
| 208 | + const char *__shortopts, | ||
| 209 | + const struct option *__longopts, int *__longind, | ||
| 210 | + int __long_only) attribute_hidden; | ||
| 211 | + | ||
| 212 | + | ||
| 213 | +/* Reentrant versions which can handle parsing multiple argument | ||
| 214 | + vectors at the same time. */ | ||
| 215 | + | ||
| 216 | +/* For __ordering member */ | ||
| 217 | +enum { | ||
| 218 | + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER | ||
| 219 | +}; | ||
| 220 | + | ||
| 221 | +/* Data type for reentrant functions. */ | ||
| 222 | + | ||
| 223 | +struct _getopt_data | ||
| 224 | +{ | ||
| 225 | + /* These have exactly the same meaning as the corresponding global | ||
| 226 | + variables, except that they are used for the reentrant | ||
| 227 | + versions of getopt. */ | ||
| 228 | + int optind; | ||
| 229 | + int opterr; | ||
| 230 | + char *optarg; | ||
| 231 | + smalluint optopt; /* we store characters here, a byte is enough */ | ||
| 232 | + | ||
| 233 | + /* Internal members. */ | ||
| 234 | + | ||
| 235 | + /* True if the internal members have been initialized. */ | ||
| 236 | + smallint __initialized; | ||
| 237 | + | ||
| 238 | + /* Describe how to deal with options that follow non-option ARGV-elements. | ||
| 239 | + | ||
| 240 | + If the caller did not specify anything, | ||
| 241 | + the default is REQUIRE_ORDER if the environment variable | ||
| 242 | + POSIXLY_CORRECT is defined, PERMUTE otherwise. | ||
| 243 | + | ||
| 244 | + REQUIRE_ORDER means don't recognize them as options; | ||
| 245 | + stop option processing when the first non-option is seen. | ||
| 246 | + This is what Unix does. | ||
| 247 | + This mode of operation is selected by either setting the environment | ||
| 248 | + variable POSIXLY_CORRECT, or using `+' as the first character | ||
| 249 | + of the list of option characters. | ||
| 250 | + | ||
| 251 | + PERMUTE is the default. We permute the contents of ARGV as we | ||
| 252 | + scan, so that eventually all the non-options are at the end. | ||
| 253 | + This allows options to be given in any order, even with programs | ||
| 254 | + that were not written to expect this. | ||
| 255 | + | ||
| 256 | + RETURN_IN_ORDER is an option available to programs that were | ||
| 257 | + written to expect options and other ARGV-elements in any order | ||
| 258 | + and that care about the ordering of the two. We describe each | ||
| 259 | + non-option ARGV-element as if it were the argument of an option | ||
| 260 | + with character code 1. Using `-' as the first character of the | ||
| 261 | + list of option characters selects this mode of operation. | ||
| 262 | + | ||
| 263 | + The special argument `--' forces an end of option-scanning regardless | ||
| 264 | + of the value of `ordering'. In the case of RETURN_IN_ORDER, only | ||
| 265 | + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ | ||
| 266 | + smallint __ordering; | ||
| 267 | + | ||
| 268 | + /* If the POSIXLY_CORRECT environment variable is set. */ | ||
| 269 | + smallint __posixly_correct; | ||
| 270 | + | ||
| 271 | + /* The next char to be scanned in the option-element | ||
| 272 | + in which the last option character we returned was found. | ||
| 273 | + This allows us to pick up the scan where we left off. | ||
| 274 | + | ||
| 275 | + If this is zero, or a null string, it means resume the scan | ||
| 276 | + by advancing to the next ARGV-element. */ | ||
| 277 | + char *__nextchar; | ||
| 278 | + | ||
| 279 | + | ||
| 280 | + /* Handle permutation of arguments. */ | ||
| 281 | + | ||
| 282 | + /* Describe the part of ARGV that contains non-options that have | ||
| 283 | + been skipped. `first_nonopt' is the index in ARGV of the first | ||
| 284 | + of them; `last_nonopt' is the index after the last of them. */ | ||
| 285 | + | ||
| 286 | + int __first_nonopt; | ||
| 287 | + int __last_nonopt; | ||
| 288 | + | ||
| 289 | +#if defined _LIBC && defined USE_NONOPTION_FLAGS | ||
| 290 | + int __nonoption_flags_max_len; | ||
| 291 | + int __nonoption_flags_len; | ||
| 292 | +# endif | ||
| 293 | +}; | ||
| 294 | + | ||
| 295 | +/* The initializer is necessary to set OPTIND and OPTERR to their | ||
| 296 | + default values and to clear the initialization flag. */ | ||
| 297 | +#define _GETOPT_DATA_INITIALIZER { 1, 1 } | ||
| 298 | + | ||
| 299 | +#if 0 /* first is static on uClibc, the others not used */ | ||
| 300 | +extern int _getopt_internal_r (int ___argc, char *const *___argv, | ||
| 301 | + const char *__shortopts, | ||
| 302 | + const struct option *__longopts, int *__longind, | ||
| 303 | + int __long_only, struct _getopt_data *__data); | ||
| 304 | +#endif | ||
| 305 | +#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ | ||
| 306 | +#ifndef __need_getopt | ||
| 307 | +extern int _getopt_long_r (int ___argc, char *const *___argv, | ||
| 308 | + const char *__shortopts, | ||
| 309 | + const struct option *__longopts, int *__longind, | ||
| 310 | + struct _getopt_data *__data); | ||
| 311 | + | ||
| 312 | +extern int _getopt_long_only_r (int ___argc, char *const *___argv, | ||
| 313 | + const char *__shortopts, | ||
| 314 | + const struct option *__longopts, | ||
| 315 | + int *__longind, | ||
| 316 | + struct _getopt_data *__data); | ||
| 317 | +#endif | ||
| 318 | +#endif | ||
| 319 | +#endif /* getopt_int.h */ | ||
| 320 | Index: git/libc/unistd/getopt.c | ||
| 321 | =================================================================== | ||
| 322 | --- git.orig/libc/unistd/getopt.c | ||
| 323 | +++ git/libc/unistd/getopt.c | ||
| 324 | @@ -119,7 +119,7 @@ | ||
| 325 | they can distinguish the relative order of options and other arguments. */ | ||
| 326 | |||
| 327 | #include <getopt.h> | ||
| 328 | -#include "getopt_int.h" | ||
| 329 | +#include <bits/getopt_int.h> | ||
| 330 | |||
| 331 | |||
| 332 | /* For communication from `getopt' to the caller. | ||
| 333 | @@ -1183,6 +1183,15 @@ getopt_long (int argc, char *const *argv | ||
| 334 | return _getopt_internal (argc, argv, options, long_options, opt_index, 0); | ||
| 335 | } | ||
| 336 | |||
| 337 | +int | ||
| 338 | +_getopt_long_r (int argc, char *const *argv, const char *options, | ||
| 339 | + const struct option *long_options, int *opt_index, | ||
| 340 | + struct _getopt_data *d) | ||
| 341 | +{ | ||
| 342 | + return _getopt_internal_r (argc, argv, options, long_options, opt_index, | ||
| 343 | + 0, d); | ||
| 344 | +} | ||
| 345 | + | ||
| 346 | /* Like getopt_long, but '-' as well as '--' can indicate a long option. | ||
| 347 | If an option that starts with '-' (not '--') doesn't match a long option, | ||
| 348 | but does match a short option, it is parsed as a short option | ||
| 349 | @@ -1195,4 +1204,12 @@ getopt_long_only (int argc, char *const | ||
| 350 | return _getopt_internal (argc, argv, options, long_options, opt_index, 1); | ||
| 351 | } | ||
| 352 | |||
| 353 | +int | ||
| 354 | +_getopt_long_only_r (int argc, char *const *argv, const char *options, | ||
| 355 | + const struct option *long_options, int *opt_index, | ||
| 356 | + struct _getopt_data *d) | ||
| 357 | +{ | ||
| 358 | + return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d); | ||
| 359 | +} | ||
| 360 | + | ||
| 361 | #endif /* Not ELIDE_CODE. */ | ||
| 362 | Index: git/libuargp/Makefile | ||
| 363 | =================================================================== | ||
| 364 | --- /dev/null | ||
| 365 | +++ git/libuargp/Makefile | ||
| 366 | @@ -0,0 +1,14 @@ | ||
| 367 | +# Makefile for uClibc (libuargp) | ||
| 368 | +# | ||
| 369 | +# Copyright (C) 2010 STMicroelectronics Ltd | ||
| 370 | +# Author(s): Filippo Arcidiacono <filippo.arcidiacono at st.com> | ||
| 371 | +# | ||
| 372 | +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
| 373 | +# | ||
| 374 | + | ||
| 375 | +top_srcdir=../ | ||
| 376 | +top_builddir=../ | ||
| 377 | +include $(top_builddir)Rules.mak | ||
| 378 | +all: libs | ||
| 379 | +include Makefile.in | ||
| 380 | +include $(top_srcdir)Makerules | ||
| 381 | Index: git/libuargp/Makefile.in | ||
| 382 | =================================================================== | ||
| 383 | --- /dev/null | ||
| 384 | +++ git/libuargp/Makefile.in | ||
| 385 | @@ -0,0 +1,73 @@ | ||
| 386 | +# Makefile for uClibc (libuargp) | ||
| 387 | +# | ||
| 388 | +# Copyright (C) 2009, 2010 STMicroelectronics Ltd. | ||
| 389 | +# Author(s): Salvatore Cro <salvatore.cro at st.com> | ||
| 390 | +# - First implementation, embedded into libc | ||
| 391 | +# Filippo Arcidiacono <filippo.arcidiacono at st.com> | ||
| 392 | +# - Reworked for stand-alone libuargp implementation | ||
| 393 | + | ||
| 394 | +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
| 395 | +# | ||
| 396 | + | ||
| 397 | +CFLAGS-libuargp := -DNOT_IN_libc -DIS_IN_libuargp $(SSP_ALL_CFLAGS) | ||
| 398 | + | ||
| 399 | +LDFLAGS-libuargp.so := $(LDFLAGS) | ||
| 400 | + | ||
| 401 | +LIBS-libuargp.so := $(LIBS) | ||
| 402 | + | ||
| 403 | +libuargp_FULL_NAME := libuargp-$(VERSION).so | ||
| 404 | + | ||
| 405 | +libuargp_DIR := $(top_srcdir)libuargp | ||
| 406 | +libuargp_OUT := $(top_builddir)libuargp | ||
| 407 | + | ||
| 408 | +libuargp_SRC-y := | ||
| 409 | +libuargp_SRC-$(UCLIBC_HAS_ARGP) := $(addsuffix .c,$(addprefix argp-, ba \ | ||
| 410 | + eexst fmtstream fs-xinl help parse pv pvh xinl)) | ||
| 411 | + | ||
| 412 | +CFLAGS-argp-xinl.c = -fgnu89-inline | ||
| 413 | + | ||
| 414 | +libuargp_SRC := $(addprefix $(libuargp_DIR)/,$(libuargp_SRC-y)) | ||
| 415 | +libuargp_OBJ := $(patsubst $(libuargp_DIR)/%.c,$(libuargp_OUT)/%.o,$(libuargp_SRC)) | ||
| 416 | + | ||
| 417 | +libuargp_SRCS := $(libuargp_SRC) | ||
| 418 | +libuargp_OBJS := $(libuargp_OBJ) | ||
| 419 | + | ||
| 420 | +ifeq ($(DOPIC),y) | ||
| 421 | +libuargp-a-y := $(libuargp_OBJS:.o=.os) | ||
| 422 | +else | ||
| 423 | +libuargp-a-y := $(libuargp_OBJS) | ||
| 424 | +endif | ||
| 425 | +libuargp-so-y := $(libuargp_OBJS:.o=.os) | ||
| 426 | + | ||
| 427 | +lib-a-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.a | ||
| 428 | +lib-so-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.so | ||
| 429 | + | ||
| 430 | +objclean-y += CLEAN_libuargp | ||
| 431 | + | ||
| 432 | +ifeq ($(DOMULTI),n) | ||
| 433 | +ifeq ($(DOPIC),y) | ||
| 434 | +$(top_builddir)lib/libuargp.so: $(top_builddir)lib/libuargp.a $(libc.depend) | ||
| 435 | +else | ||
| 436 | +$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp_so.a $(libc.depend) | ||
| 437 | +endif | ||
| 438 | + $(call link.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION)) | ||
| 439 | +else | ||
| 440 | +$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp.oS $(libc.depend) | ||
| 441 | + $(call linkm.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION)) | ||
| 442 | +endif | ||
| 443 | + | ||
| 444 | +$(libuargp_OUT)/libuargp_so.a: $(libuargp-so-y) | ||
| 445 | + $(Q)$(RM) $@ | ||
| 446 | + $(do_ar) | ||
| 447 | + | ||
| 448 | +$(libuargp_OUT)/libuargp.oS: $(libuargp_SRCS) | ||
| 449 | + $(Q)$(RM) $@ | ||
| 450 | + $(compile-m) | ||
| 451 | + | ||
| 452 | +$(top_builddir)lib/libuargp.a: $(libuargp-a-y) | ||
| 453 | + $(Q)$(INSTALL) -d $(dir $@) | ||
| 454 | + $(Q)$(RM) $@ | ||
| 455 | + $(do_ar) | ||
| 456 | + | ||
| 457 | +CLEAN_libuargp: | ||
| 458 | + $(do_rm) $(addprefix $(libuargp_OUT)/*., o os oS a) | ||
| 459 | Index: git/libuargp/argp-ba.c | ||
| 460 | =================================================================== | ||
| 461 | --- /dev/null | ||
| 462 | +++ git/libuargp/argp-ba.c | ||
| 463 | @@ -0,0 +1,26 @@ | ||
| 464 | +/* Default definition for ARGP_PROGRAM_BUG_ADDRESS. | ||
| 465 | + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. | ||
| 466 | + This file is part of the GNU C Library. | ||
| 467 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 468 | + | ||
| 469 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 470 | + modify it under the terms of the GNU Lesser General Public | ||
| 471 | + License as published by the Free Software Foundation; either | ||
| 472 | + version 2.1 of the License, or (at your option) any later version. | ||
| 473 | + | ||
| 474 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 475 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 476 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 477 | + Lesser General Public License for more details. | ||
| 478 | + | ||
| 479 | + You should have received a copy of the GNU Lesser General Public | ||
| 480 | + License along with the GNU C Library; if not, write to the Free | ||
| 481 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 482 | + 02111-1307 USA. */ | ||
| 483 | + | ||
| 484 | +/* If set by the user program, it should point to string that is the | ||
| 485 | + bug-reporting address for the program. It will be printed by argp_help if | ||
| 486 | + the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help | ||
| 487 | + messages), embedded in a sentence that says something like `Report bugs to | ||
| 488 | + ADDR.'. */ | ||
| 489 | +const char *argp_program_bug_address; | ||
| 490 | Index: git/libuargp/argp-eexst.c | ||
| 491 | =================================================================== | ||
| 492 | --- /dev/null | ||
| 493 | +++ git/libuargp/argp-eexst.c | ||
| 494 | @@ -0,0 +1,32 @@ | ||
| 495 | +/* Default definition for ARGP_ERR_EXIT_STATUS | ||
| 496 | + Copyright (C) 1997 Free Software Foundation, Inc. | ||
| 497 | + This file is part of the GNU C Library. | ||
| 498 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 499 | + | ||
| 500 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 501 | + modify it under the terms of the GNU Lesser General Public | ||
| 502 | + License as published by the Free Software Foundation; either | ||
| 503 | + version 2.1 of the License, or (at your option) any later version. | ||
| 504 | + | ||
| 505 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 506 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 507 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 508 | + Lesser General Public License for more details. | ||
| 509 | + | ||
| 510 | + You should have received a copy of the GNU Lesser General Public | ||
| 511 | + License along with the GNU C Library; if not, write to the Free | ||
| 512 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 513 | + 02111-1307 USA. */ | ||
| 514 | + | ||
| 515 | +#ifdef HAVE_CONFIG_H | ||
| 516 | +# include <config.h> | ||
| 517 | +#endif | ||
| 518 | + | ||
| 519 | +#include <sysexits.h> | ||
| 520 | + | ||
| 521 | +#include <argp.h> | ||
| 522 | + | ||
| 523 | +/* The exit status that argp will use when exiting due to a parsing error. | ||
| 524 | + If not defined or set by the user program, this defaults to EX_USAGE from | ||
| 525 | + <sysexits.h>. */ | ||
| 526 | +error_t argp_err_exit_status = EX_USAGE; | ||
| 527 | Index: git/libuargp/argp-fmtstream.c | ||
| 528 | =================================================================== | ||
| 529 | --- /dev/null | ||
| 530 | +++ git/libuargp/argp-fmtstream.c | ||
| 531 | @@ -0,0 +1,439 @@ | ||
| 532 | +/* Word-wrapping and line-truncating streams | ||
| 533 | + Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc. | ||
| 534 | + This file is part of the GNU C Library. | ||
| 535 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 536 | + | ||
| 537 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 538 | + modify it under the terms of the GNU Lesser General Public | ||
| 539 | + License as published by the Free Software Foundation; either | ||
| 540 | + version 2.1 of the License, or (at your option) any later version. | ||
| 541 | + | ||
| 542 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 543 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 544 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 545 | + Lesser General Public License for more details. | ||
| 546 | + | ||
| 547 | + You should have received a copy of the GNU Lesser General Public | ||
| 548 | + License along with the GNU C Library; if not, write to the Free | ||
| 549 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 550 | + 02111-1307 USA. | ||
| 551 | + | ||
| 552 | + Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com> | ||
| 553 | +*/ | ||
| 554 | + | ||
| 555 | +/* This package emulates glibc `line_wrap_stream' semantics for systems that | ||
| 556 | + don't have that. */ | ||
| 557 | + | ||
| 558 | +#ifdef HAVE_CONFIG_H | ||
| 559 | +# include <config.h> | ||
| 560 | +#endif | ||
| 561 | + | ||
| 562 | +#include <stdlib.h> | ||
| 563 | +#include <string.h> | ||
| 564 | +#include <errno.h> | ||
| 565 | +#include <stdarg.h> | ||
| 566 | +#include <ctype.h> | ||
| 567 | + | ||
| 568 | +#include "argp-fmtstream.h" | ||
| 569 | + | ||
| 570 | +#ifndef ARGP_FMTSTREAM_USE_LINEWRAP | ||
| 571 | + | ||
| 572 | +#ifndef isblank | ||
| 573 | +#define isblank(ch) ((ch)==' ' || (ch)=='\t') | ||
| 574 | +#endif | ||
| 575 | + | ||
| 576 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 577 | +# include <wchar.h> | ||
| 578 | +# include <libio/libioP.h> | ||
| 579 | +# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) | ||
| 580 | +#else | ||
| 581 | +# define __vsnprintf(s, l, f, a) vsnprintf (s, l, f, a) | ||
| 582 | +#endif | ||
| 583 | + | ||
| 584 | +#define INIT_BUF_SIZE 200 | ||
| 585 | +#define PRINTF_SIZE_GUESS 150 | ||
| 586 | + | ||
| 587 | +/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines | ||
| 588 | + written on it with LMARGIN spaces and limits them to RMARGIN columns | ||
| 589 | + total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by | ||
| 590 | + replacing the whitespace before them with a newline and WMARGIN spaces. | ||
| 591 | + Otherwise, chars beyond RMARGIN are simply dropped until a newline. | ||
| 592 | + Returns NULL if there was an error. */ | ||
| 593 | +argp_fmtstream_t | ||
| 594 | +__argp_make_fmtstream (FILE *stream, | ||
| 595 | + size_t lmargin, size_t rmargin, ssize_t wmargin) | ||
| 596 | +{ | ||
| 597 | + argp_fmtstream_t fs; | ||
| 598 | + | ||
| 599 | + fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream)); | ||
| 600 | + if (fs != NULL) | ||
| 601 | + { | ||
| 602 | + fs->stream = stream; | ||
| 603 | + | ||
| 604 | + fs->lmargin = lmargin; | ||
| 605 | + fs->rmargin = rmargin; | ||
| 606 | + fs->wmargin = wmargin; | ||
| 607 | + fs->point_col = 0; | ||
| 608 | + fs->point_offs = 0; | ||
| 609 | + | ||
| 610 | + fs->buf = (char *) malloc (INIT_BUF_SIZE); | ||
| 611 | + if (! fs->buf) | ||
| 612 | + { | ||
| 613 | + free (fs); | ||
| 614 | + fs = 0; | ||
| 615 | + } | ||
| 616 | + else | ||
| 617 | + { | ||
| 618 | + fs->p = fs->buf; | ||
| 619 | + fs->end = fs->buf + INIT_BUF_SIZE; | ||
| 620 | + } | ||
| 621 | + } | ||
| 622 | + | ||
| 623 | + return fs; | ||
| 624 | +} | ||
| 625 | +#if 0 | ||
| 626 | +/* Not exported. */ | ||
| 627 | +#ifdef weak_alias | ||
| 628 | +weak_alias (__argp_make_fmtstream, argp_make_fmtstream) | ||
| 629 | +#endif | ||
| 630 | +#endif | ||
| 631 | + | ||
| 632 | +/* Flush FS to its stream, and free it (but don't close the stream). */ | ||
| 633 | +void | ||
| 634 | +__argp_fmtstream_free (argp_fmtstream_t fs) | ||
| 635 | +{ | ||
| 636 | + __argp_fmtstream_update (fs); | ||
| 637 | + if (fs->p > fs->buf) | ||
| 638 | + { | ||
| 639 | +#ifdef USE_IN_LIBIO | ||
| 640 | + __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); | ||
| 641 | +#else | ||
| 642 | + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); | ||
| 643 | +#endif | ||
| 644 | + } | ||
| 645 | + free (fs->buf); | ||
| 646 | + free (fs); | ||
| 647 | +} | ||
| 648 | +#if 0 | ||
| 649 | +/* Not exported. */ | ||
| 650 | +#ifdef weak_alias | ||
| 651 | +weak_alias (__argp_fmtstream_free, argp_fmtstream_free) | ||
| 652 | +#endif | ||
| 653 | +#endif | ||
| 654 | + | ||
| 655 | +/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the | ||
| 656 | + end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ | ||
| 657 | +void | ||
| 658 | +__argp_fmtstream_update (argp_fmtstream_t fs) | ||
| 659 | +{ | ||
| 660 | + char *buf, *nl; | ||
| 661 | + size_t len; | ||
| 662 | + | ||
| 663 | + /* Scan the buffer for newlines. */ | ||
| 664 | + buf = fs->buf + fs->point_offs; | ||
| 665 | + while (buf < fs->p) | ||
| 666 | + { | ||
| 667 | + size_t r; | ||
| 668 | + | ||
| 669 | + if (fs->point_col == 0 && fs->lmargin != 0) | ||
| 670 | + { | ||
| 671 | + /* We are starting a new line. Print spaces to the left margin. */ | ||
| 672 | + const size_t pad = fs->lmargin; | ||
| 673 | + if (fs->p + pad < fs->end) | ||
| 674 | + { | ||
| 675 | + /* We can fit in them in the buffer by moving the | ||
| 676 | + buffer text up and filling in the beginning. */ | ||
| 677 | + memmove (buf + pad, buf, fs->p - buf); | ||
| 678 | + fs->p += pad; /* Compensate for bigger buffer. */ | ||
| 679 | + memset (buf, ' ', pad); /* Fill in the spaces. */ | ||
| 680 | + buf += pad; /* Don't bother searching them. */ | ||
| 681 | + } | ||
| 682 | + else | ||
| 683 | + { | ||
| 684 | + /* No buffer space for spaces. Must flush. */ | ||
| 685 | + size_t i; | ||
| 686 | + for (i = 0; i < pad; i++) | ||
| 687 | + { | ||
| 688 | +#ifdef USE_IN_LIBIO | ||
| 689 | + if (_IO_fwide (fs->stream, 0) > 0) | ||
| 690 | + putwc_unlocked (L' ', fs->stream); | ||
| 691 | + else | ||
| 692 | +#endif | ||
| 693 | + putc_unlocked (' ', fs->stream); | ||
| 694 | + } | ||
| 695 | + } | ||
| 696 | + fs->point_col = pad; | ||
| 697 | + } | ||
| 698 | + | ||
| 699 | + len = fs->p - buf; | ||
| 700 | + nl = memchr (buf, '\n', len); | ||
| 701 | + | ||
| 702 | + if (fs->point_col < 0) | ||
| 703 | + fs->point_col = 0; | ||
| 704 | + | ||
| 705 | + if (!nl) | ||
| 706 | + { | ||
| 707 | + /* The buffer ends in a partial line. */ | ||
| 708 | + | ||
| 709 | + if (fs->point_col + len < fs->rmargin) | ||
| 710 | + { | ||
| 711 | + /* The remaining buffer text is a partial line and fits | ||
| 712 | + within the maximum line width. Advance point for the | ||
| 713 | + characters to be written and stop scanning. */ | ||
| 714 | + fs->point_col += len; | ||
| 715 | + break; | ||
| 716 | + } | ||
| 717 | + else | ||
| 718 | + /* Set the end-of-line pointer for the code below to | ||
| 719 | + the end of the buffer. */ | ||
| 720 | + nl = fs->p; | ||
| 721 | + } | ||
| 722 | + else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) | ||
| 723 | + { | ||
| 724 | + /* The buffer contains a full line that fits within the maximum | ||
| 725 | + line width. Reset point and scan the next line. */ | ||
| 726 | + fs->point_col = 0; | ||
| 727 | + buf = nl + 1; | ||
| 728 | + continue; | ||
| 729 | + } | ||
| 730 | + | ||
| 731 | + /* This line is too long. */ | ||
| 732 | + r = fs->rmargin - 1; | ||
| 733 | + | ||
| 734 | + if (fs->wmargin < 0) | ||
| 735 | + { | ||
| 736 | + /* Truncate the line by overwriting the excess with the | ||
| 737 | + newline and anything after it in the buffer. */ | ||
| 738 | + if (nl < fs->p) | ||
| 739 | + { | ||
| 740 | + memmove (buf + (r - fs->point_col), nl, fs->p - nl); | ||
| 741 | + fs->p -= buf + (r - fs->point_col) - nl; | ||
| 742 | + /* Reset point for the next line and start scanning it. */ | ||
| 743 | + fs->point_col = 0; | ||
| 744 | + buf += r + 1; /* Skip full line plus \n. */ | ||
| 745 | + } | ||
| 746 | + else | ||
| 747 | + { | ||
| 748 | + /* The buffer ends with a partial line that is beyond the | ||
| 749 | + maximum line width. Advance point for the characters | ||
| 750 | + written, and discard those past the max from the buffer. */ | ||
| 751 | + fs->point_col += len; | ||
| 752 | + fs->p -= fs->point_col - r; | ||
| 753 | + break; | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + else | ||
| 757 | + { | ||
| 758 | + /* Do word wrap. Go to the column just past the maximum line | ||
| 759 | + width and scan back for the beginning of the word there. | ||
| 760 | + Then insert a line break. */ | ||
| 761 | + | ||
| 762 | + char *p, *nextline; | ||
| 763 | + int i; | ||
| 764 | + | ||
| 765 | + p = buf + (r + 1 - fs->point_col); | ||
| 766 | + while (p >= buf && !isblank (*p)) | ||
| 767 | + --p; | ||
| 768 | + nextline = p + 1; /* This will begin the next line. */ | ||
| 769 | + | ||
| 770 | + if (nextline > buf) | ||
| 771 | + { | ||
| 772 | + /* Swallow separating blanks. */ | ||
| 773 | + if (p >= buf) | ||
| 774 | + do | ||
| 775 | + --p; | ||
| 776 | + while (p >= buf && isblank (*p)); | ||
| 777 | + nl = p + 1; /* The newline will replace the first blank. */ | ||
| 778 | + } | ||
| 779 | + else | ||
| 780 | + { | ||
| 781 | + /* A single word that is greater than the maximum line width. | ||
| 782 | + Oh well. Put it on an overlong line by itself. */ | ||
| 783 | + p = buf + (r + 1 - fs->point_col); | ||
| 784 | + /* Find the end of the long word. */ | ||
| 785 | + do | ||
| 786 | + ++p; | ||
| 787 | + while (p < nl && !isblank (*p)); | ||
| 788 | + if (p == nl) | ||
| 789 | + { | ||
| 790 | + /* It already ends a line. No fussing required. */ | ||
| 791 | + fs->point_col = 0; | ||
| 792 | + buf = nl + 1; | ||
| 793 | + continue; | ||
| 794 | + } | ||
| 795 | + /* We will move the newline to replace the first blank. */ | ||
| 796 | + nl = p; | ||
| 797 | + /* Swallow separating blanks. */ | ||
| 798 | + do | ||
| 799 | + ++p; | ||
| 800 | + while (isblank (*p)); | ||
| 801 | + /* The next line will start here. */ | ||
| 802 | + nextline = p; | ||
| 803 | + } | ||
| 804 | + | ||
| 805 | + /* Note: There are a bunch of tests below for | ||
| 806 | + NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall | ||
| 807 | + at the end of the buffer, and NEXTLINE is in fact empty (and so | ||
| 808 | + we need not be careful to maintain its contents). */ | ||
| 809 | + | ||
| 810 | + if ((nextline == buf + len + 1 | ||
| 811 | + ? fs->end - nl < fs->wmargin + 1 | ||
| 812 | + : nextline - (nl + 1) < fs->wmargin) | ||
| 813 | + && fs->p > nextline) | ||
| 814 | + { | ||
| 815 | + /* The margin needs more blanks than we removed. */ | ||
| 816 | + if (fs->end - fs->p > fs->wmargin + 1) | ||
| 817 | + /* Make some space for them. */ | ||
| 818 | + { | ||
| 819 | + size_t mv = fs->p - nextline; | ||
| 820 | + memmove (nl + 1 + fs->wmargin, nextline, mv); | ||
| 821 | + nextline = nl + 1 + fs->wmargin; | ||
| 822 | + len = nextline + mv - buf; | ||
| 823 | + *nl++ = '\n'; | ||
| 824 | + } | ||
| 825 | + else | ||
| 826 | + /* Output the first line so we can use the space. */ | ||
| 827 | + { | ||
| 828 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 829 | + __fxprintf (fs->stream, "%.*s\n", | ||
| 830 | + (int) (nl - fs->buf), fs->buf); | ||
| 831 | +#else | ||
| 832 | + if (nl > fs->buf) | ||
| 833 | + fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); | ||
| 834 | + putc_unlocked ('\n', fs->stream); | ||
| 835 | +#endif | ||
| 836 | + | ||
| 837 | + len += buf - fs->buf; | ||
| 838 | + nl = buf = fs->buf; | ||
| 839 | + } | ||
| 840 | + } | ||
| 841 | + else | ||
| 842 | + /* We can fit the newline and blanks in before | ||
| 843 | + the next word. */ | ||
| 844 | + *nl++ = '\n'; | ||
| 845 | + | ||
| 846 | + if (nextline - nl >= fs->wmargin | ||
| 847 | + || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) | ||
| 848 | + /* Add blanks up to the wrap margin column. */ | ||
| 849 | + for (i = 0; i < fs->wmargin; ++i) | ||
| 850 | + *nl++ = ' '; | ||
| 851 | + else | ||
| 852 | + for (i = 0; i < fs->wmargin; ++i) | ||
| 853 | +#ifdef USE_IN_LIBIO | ||
| 854 | + if (_IO_fwide (fs->stream, 0) > 0) | ||
| 855 | + putwc_unlocked (L' ', fs->stream); | ||
| 856 | + else | ||
| 857 | +#endif | ||
| 858 | + putc_unlocked (' ', fs->stream); | ||
| 859 | + | ||
| 860 | + /* Copy the tail of the original buffer into the current buffer | ||
| 861 | + position. */ | ||
| 862 | + if (nl < nextline) | ||
| 863 | + memmove (nl, nextline, buf + len - nextline); | ||
| 864 | + len -= nextline - buf; | ||
| 865 | + | ||
| 866 | + /* Continue the scan on the remaining lines in the buffer. */ | ||
| 867 | + buf = nl; | ||
| 868 | + | ||
| 869 | + /* Restore bufp to include all the remaining text. */ | ||
| 870 | + fs->p = nl + len; | ||
| 871 | + | ||
| 872 | + /* Reset the counter of what has been output this line. If wmargin | ||
| 873 | + is 0, we want to avoid the lmargin getting added, so we set | ||
| 874 | + point_col to a magic value of -1 in that case. */ | ||
| 875 | + fs->point_col = fs->wmargin ? fs->wmargin : -1; | ||
| 876 | + } | ||
| 877 | + } | ||
| 878 | + | ||
| 879 | + /* Remember that we've scanned as far as the end of the buffer. */ | ||
| 880 | + fs->point_offs = fs->p - fs->buf; | ||
| 881 | +} | ||
| 882 | + | ||
| 883 | +/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by | ||
| 884 | + growing the buffer, or by flushing it. True is returned iff we succeed. */ | ||
| 885 | +int | ||
| 886 | +__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) | ||
| 887 | +{ | ||
| 888 | + if ((size_t) (fs->end - fs->p) < amount) | ||
| 889 | + { | ||
| 890 | + ssize_t wrote; | ||
| 891 | + | ||
| 892 | + /* Flush FS's buffer. */ | ||
| 893 | + __argp_fmtstream_update (fs); | ||
| 894 | + | ||
| 895 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 896 | + __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); | ||
| 897 | + wrote = fs->p - fs->buf; | ||
| 898 | +#else | ||
| 899 | + wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); | ||
| 900 | +#endif | ||
| 901 | + if (wrote == fs->p - fs->buf) | ||
| 902 | + { | ||
| 903 | + fs->p = fs->buf; | ||
| 904 | + fs->point_offs = 0; | ||
| 905 | + } | ||
| 906 | + else | ||
| 907 | + { | ||
| 908 | + fs->p -= wrote; | ||
| 909 | + fs->point_offs -= wrote; | ||
| 910 | + memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf); | ||
| 911 | + return 0; | ||
| 912 | + } | ||
| 913 | + | ||
| 914 | + if ((size_t) (fs->end - fs->buf) < amount) | ||
| 915 | + /* Gotta grow the buffer. */ | ||
| 916 | + { | ||
| 917 | + size_t old_size = fs->end - fs->buf; | ||
| 918 | + size_t new_size = old_size + amount; | ||
| 919 | + char *new_buf; | ||
| 920 | + | ||
| 921 | + if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size))) | ||
| 922 | + { | ||
| 923 | + __set_errno (ENOMEM); | ||
| 924 | + return 0; | ||
| 925 | + } | ||
| 926 | + | ||
| 927 | + fs->buf = new_buf; | ||
| 928 | + fs->end = new_buf + new_size; | ||
| 929 | + fs->p = fs->buf; | ||
| 930 | + } | ||
| 931 | + } | ||
| 932 | + | ||
| 933 | + return 1; | ||
| 934 | +} | ||
| 935 | + | ||
| 936 | +ssize_t | ||
| 937 | +__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...) | ||
| 938 | +{ | ||
| 939 | + int out; | ||
| 940 | + size_t avail; | ||
| 941 | + size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */ | ||
| 942 | + | ||
| 943 | + do | ||
| 944 | + { | ||
| 945 | + va_list args; | ||
| 946 | + | ||
| 947 | + if (! __argp_fmtstream_ensure (fs, size_guess)) | ||
| 948 | + return -1; | ||
| 949 | + | ||
| 950 | + va_start (args, fmt); | ||
| 951 | + avail = fs->end - fs->p; | ||
| 952 | + out = __vsnprintf (fs->p, avail, fmt, args); | ||
| 953 | + va_end (args); | ||
| 954 | + if ((size_t) out >= avail) | ||
| 955 | + size_guess = out + 1; | ||
| 956 | + } | ||
| 957 | + while ((size_t) out >= avail); | ||
| 958 | + | ||
| 959 | + fs->p += out; | ||
| 960 | + | ||
| 961 | + return out; | ||
| 962 | +} | ||
| 963 | +#if 0 | ||
| 964 | +/* Not exported. */ | ||
| 965 | +#ifdef weak_alias | ||
| 966 | +weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf) | ||
| 967 | +#endif | ||
| 968 | +#endif | ||
| 969 | + | ||
| 970 | +#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */ | ||
| 971 | Index: git/libuargp/argp-fmtstream.h | ||
| 972 | =================================================================== | ||
| 973 | --- /dev/null | ||
| 974 | +++ git/libuargp/argp-fmtstream.h | ||
| 975 | @@ -0,0 +1,314 @@ | ||
| 976 | +/* Word-wrapping and line-truncating streams. | ||
| 977 | + Copyright (C) 1997 Free Software Foundation, Inc. | ||
| 978 | + This file is part of the GNU C Library. | ||
| 979 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 980 | + | ||
| 981 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 982 | + modify it under the terms of the GNU Lesser General Public | ||
| 983 | + License as published by the Free Software Foundation; either | ||
| 984 | + version 2.1 of the License, or (at your option) any later version. | ||
| 985 | + | ||
| 986 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 987 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 988 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 989 | + Lesser General Public License for more details. | ||
| 990 | + | ||
| 991 | + You should have received a copy of the GNU Lesser General Public | ||
| 992 | + License along with the GNU C Library; if not, write to the Free | ||
| 993 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 994 | + 02111-1307 USA. | ||
| 995 | + | ||
| 996 | + Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com> | ||
| 997 | +*/ | ||
| 998 | + | ||
| 999 | +/* This package emulates glibc `line_wrap_stream' semantics for systems that | ||
| 1000 | + don't have that. If the system does have it, it is just a wrapper for | ||
| 1001 | + that. This header file is only used internally while compiling argp, and | ||
| 1002 | + shouldn't be installed. */ | ||
| 1003 | + | ||
| 1004 | +#ifndef _ARGP_FMTSTREAM_H | ||
| 1005 | +#define _ARGP_FMTSTREAM_H | ||
| 1006 | + | ||
| 1007 | +#include <stdio.h> | ||
| 1008 | +#include <string.h> | ||
| 1009 | +#include <unistd.h> | ||
| 1010 | + | ||
| 1011 | +#ifndef __attribute__ | ||
| 1012 | +/* This feature is available in gcc versions 2.5 and later. */ | ||
| 1013 | +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__) | ||
| 1014 | +# define __attribute__(Spec) /* empty */ | ||
| 1015 | +# endif | ||
| 1016 | +/* The __-protected variants of `format' and `printf' attributes | ||
| 1017 | + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ | ||
| 1018 | +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__) | ||
| 1019 | +# define __format__ format | ||
| 1020 | +# define __printf__ printf | ||
| 1021 | +# endif | ||
| 1022 | +#endif | ||
| 1023 | + | ||
| 1024 | +#if 0 /* uClibc: disabled */ | ||
| 1025 | +#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ | ||
| 1026 | + || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)) | ||
| 1027 | +/* line_wrap_stream is available, so use that. */ | ||
| 1028 | +#define ARGP_FMTSTREAM_USE_LINEWRAP | ||
| 1029 | +#endif | ||
| 1030 | +#else | ||
| 1031 | +/* line_wrap stream NOT available */ | ||
| 1032 | +# undef ARGP_FMTSTREAM_USE_LINEWRAP | ||
| 1033 | +#endif | ||
| 1034 | + | ||
| 1035 | +#ifdef ARGP_FMTSTREAM_USE_LINEWRAP | ||
| 1036 | +/* Just be a simple wrapper for line_wrap_stream; the semantics are | ||
| 1037 | + *slightly* different, as line_wrap_stream doesn't actually make a new | ||
| 1038 | + object, it just modifies the given stream (reversibly) to do | ||
| 1039 | + line-wrapping. Since we control who uses this code, it doesn't matter. */ | ||
| 1040 | + | ||
| 1041 | +#include <linewrap.h> | ||
| 1042 | + | ||
| 1043 | +typedef FILE *argp_fmtstream_t; | ||
| 1044 | + | ||
| 1045 | +#define argp_make_fmtstream line_wrap_stream | ||
| 1046 | +#define __argp_make_fmtstream line_wrap_stream | ||
| 1047 | +#define argp_fmtstream_free line_unwrap_stream | ||
| 1048 | +#define __argp_fmtstream_free line_unwrap_stream | ||
| 1049 | + | ||
| 1050 | +#define __argp_fmtstream_putc(fs,ch) putc(ch,fs) | ||
| 1051 | +#define argp_fmtstream_putc(fs,ch) putc(ch,fs) | ||
| 1052 | +#define __argp_fmtstream_puts(fs,str) fputs(str,fs) | ||
| 1053 | +#define argp_fmtstream_puts(fs,str) fputs(str,fs) | ||
| 1054 | +#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) | ||
| 1055 | +#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) | ||
| 1056 | +#define __argp_fmtstream_printf fprintf | ||
| 1057 | +#define argp_fmtstream_printf fprintf | ||
| 1058 | + | ||
| 1059 | +#define __argp_fmtstream_lmargin line_wrap_lmargin | ||
| 1060 | +#define argp_fmtstream_lmargin line_wrap_lmargin | ||
| 1061 | +#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin | ||
| 1062 | +#define argp_fmtstream_set_lmargin line_wrap_set_lmargin | ||
| 1063 | +#define __argp_fmtstream_rmargin line_wrap_rmargin | ||
| 1064 | +#define argp_fmtstream_rmargin line_wrap_rmargin | ||
| 1065 | +#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin | ||
| 1066 | +#define argp_fmtstream_set_rmargin line_wrap_set_rmargin | ||
| 1067 | +#define __argp_fmtstream_wmargin line_wrap_wmargin | ||
| 1068 | +#define argp_fmtstream_wmargin line_wrap_wmargin | ||
| 1069 | +#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin | ||
| 1070 | +#define argp_fmtstream_set_wmargin line_wrap_set_wmargin | ||
| 1071 | +#define __argp_fmtstream_point line_wrap_point | ||
| 1072 | +#define argp_fmtstream_point line_wrap_point | ||
| 1073 | + | ||
| 1074 | +#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */ | ||
| 1075 | +/* Guess we have to define our own version. */ | ||
| 1076 | + | ||
| 1077 | +#ifndef __const | ||
| 1078 | +#define __const const | ||
| 1079 | +#endif | ||
| 1080 | + | ||
| 1081 | +struct argp_fmtstream | ||
| 1082 | +{ | ||
| 1083 | + FILE *stream; /* The stream we're outputting to. */ | ||
| 1084 | + | ||
| 1085 | + size_t lmargin, rmargin; /* Left and right margins. */ | ||
| 1086 | + ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ | ||
| 1087 | + | ||
| 1088 | + /* Point in buffer to which we've processed for wrapping, but not output. */ | ||
| 1089 | + size_t point_offs; | ||
| 1090 | + /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */ | ||
| 1091 | + ssize_t point_col; | ||
| 1092 | + | ||
| 1093 | + char *buf; /* Output buffer. */ | ||
| 1094 | + char *p; /* Current end of text in BUF. */ | ||
| 1095 | + char *end; /* Absolute end of BUF. */ | ||
| 1096 | +}; | ||
| 1097 | + | ||
| 1098 | +typedef struct argp_fmtstream *argp_fmtstream_t; | ||
| 1099 | + | ||
| 1100 | +/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines | ||
| 1101 | + written on it with LMARGIN spaces and limits them to RMARGIN columns | ||
| 1102 | + total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by | ||
| 1103 | + replacing the whitespace before them with a newline and WMARGIN spaces. | ||
| 1104 | + Otherwise, chars beyond RMARGIN are simply dropped until a newline. | ||
| 1105 | + Returns NULL if there was an error. */ | ||
| 1106 | +extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, | ||
| 1107 | + size_t __lmargin, | ||
| 1108 | + size_t __rmargin, | ||
| 1109 | + ssize_t __wmargin); | ||
| 1110 | +extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, | ||
| 1111 | + size_t __lmargin, | ||
| 1112 | + size_t __rmargin, | ||
| 1113 | + ssize_t __wmargin); | ||
| 1114 | + | ||
| 1115 | +/* Flush __FS to its stream, and free it (but don't close the stream). */ | ||
| 1116 | +extern void __argp_fmtstream_free (argp_fmtstream_t __fs); | ||
| 1117 | +extern void argp_fmtstream_free (argp_fmtstream_t __fs); | ||
| 1118 | + | ||
| 1119 | +extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, | ||
| 1120 | + __const char *__fmt, ...) | ||
| 1121 | + __attribute__ ((__format__ (printf, 2, 3))); | ||
| 1122 | +extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, | ||
| 1123 | + __const char *__fmt, ...) | ||
| 1124 | + __attribute__ ((__format__ (printf, 2, 3))); | ||
| 1125 | + | ||
| 1126 | +extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); | ||
| 1127 | +extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); | ||
| 1128 | + | ||
| 1129 | +extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); | ||
| 1130 | +extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); | ||
| 1131 | + | ||
| 1132 | +extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, | ||
| 1133 | + __const char *__str, size_t __len); | ||
| 1134 | +extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, | ||
| 1135 | + __const char *__str, size_t __len); | ||
| 1136 | + | ||
| 1137 | +/* Access macros for various bits of state. */ | ||
| 1138 | +#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) | ||
| 1139 | +#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin) | ||
| 1140 | +#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin) | ||
| 1141 | +#define __argp_fmtstream_lmargin argp_fmtstream_lmargin | ||
| 1142 | +#define __argp_fmtstream_rmargin argp_fmtstream_rmargin | ||
| 1143 | +#define __argp_fmtstream_wmargin argp_fmtstream_wmargin | ||
| 1144 | + | ||
| 1145 | +/* Set __FS's left margin to LMARGIN and return the old value. */ | ||
| 1146 | +extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, | ||
| 1147 | + size_t __lmargin); | ||
| 1148 | +extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, | ||
| 1149 | + size_t __lmargin); | ||
| 1150 | + | ||
| 1151 | +/* Set __FS's right margin to __RMARGIN and return the old value. */ | ||
| 1152 | +extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, | ||
| 1153 | + size_t __rmargin); | ||
| 1154 | +extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, | ||
| 1155 | + size_t __rmargin); | ||
| 1156 | + | ||
| 1157 | +/* Set __FS's wrap margin to __WMARGIN and return the old value. */ | ||
| 1158 | +extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, | ||
| 1159 | + size_t __wmargin); | ||
| 1160 | +extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, | ||
| 1161 | + size_t __wmargin); | ||
| 1162 | + | ||
| 1163 | +/* Return the column number of the current output point in __FS. */ | ||
| 1164 | +extern size_t argp_fmtstream_point (argp_fmtstream_t __fs); | ||
| 1165 | +extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs); | ||
| 1166 | + | ||
| 1167 | +/* Internal routines. */ | ||
| 1168 | +extern void _argp_fmtstream_update (argp_fmtstream_t __fs); | ||
| 1169 | +extern void __argp_fmtstream_update (argp_fmtstream_t __fs); | ||
| 1170 | +extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); | ||
| 1171 | +extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); | ||
| 1172 | + | ||
| 1173 | +#ifdef __OPTIMIZE__ | ||
| 1174 | +/* Inline versions of above routines. */ | ||
| 1175 | + | ||
| 1176 | +#if !_LIBC | ||
| 1177 | +#define __argp_fmtstream_putc argp_fmtstream_putc | ||
| 1178 | +#define __argp_fmtstream_puts argp_fmtstream_puts | ||
| 1179 | +#define __argp_fmtstream_write argp_fmtstream_write | ||
| 1180 | +#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin | ||
| 1181 | +#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin | ||
| 1182 | +#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin | ||
| 1183 | +#define __argp_fmtstream_point argp_fmtstream_point | ||
| 1184 | +#define __argp_fmtstream_update _argp_fmtstream_update | ||
| 1185 | +#define __argp_fmtstream_ensure _argp_fmtstream_ensure | ||
| 1186 | +#endif | ||
| 1187 | + | ||
| 1188 | +#ifndef ARGP_FS_EI | ||
| 1189 | +#define ARGP_FS_EI __extern_inline | ||
| 1190 | +#endif | ||
| 1191 | + | ||
| 1192 | +ARGP_FS_EI size_t | ||
| 1193 | +__argp_fmtstream_write (argp_fmtstream_t __fs, | ||
| 1194 | + __const char *__str, size_t __len) | ||
| 1195 | +{ | ||
| 1196 | + if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) | ||
| 1197 | + { | ||
| 1198 | + memcpy (__fs->p, __str, __len); | ||
| 1199 | + __fs->p += __len; | ||
| 1200 | + return __len; | ||
| 1201 | + } | ||
| 1202 | + else | ||
| 1203 | + return 0; | ||
| 1204 | +} | ||
| 1205 | + | ||
| 1206 | +ARGP_FS_EI int | ||
| 1207 | +__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str) | ||
| 1208 | +{ | ||
| 1209 | + size_t __len = strlen (__str); | ||
| 1210 | + if (__len) | ||
| 1211 | + { | ||
| 1212 | + size_t __wrote = __argp_fmtstream_write (__fs, __str, __len); | ||
| 1213 | + return __wrote == __len ? 0 : -1; | ||
| 1214 | + } | ||
| 1215 | + else | ||
| 1216 | + return 0; | ||
| 1217 | +} | ||
| 1218 | + | ||
| 1219 | +ARGP_FS_EI int | ||
| 1220 | +__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch) | ||
| 1221 | +{ | ||
| 1222 | + if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1)) | ||
| 1223 | + return *__fs->p++ = __ch; | ||
| 1224 | + else | ||
| 1225 | + return EOF; | ||
| 1226 | +} | ||
| 1227 | + | ||
| 1228 | +/* Set __FS's left margin to __LMARGIN and return the old value. */ | ||
| 1229 | +ARGP_FS_EI size_t | ||
| 1230 | +__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin) | ||
| 1231 | +{ | ||
| 1232 | + size_t __old; | ||
| 1233 | + if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) | ||
| 1234 | + __argp_fmtstream_update (__fs); | ||
| 1235 | + __old = __fs->lmargin; | ||
| 1236 | + __fs->lmargin = __lmargin; | ||
| 1237 | + return __old; | ||
| 1238 | +} | ||
| 1239 | + | ||
| 1240 | +/* Set __FS's right margin to __RMARGIN and return the old value. */ | ||
| 1241 | +ARGP_FS_EI size_t | ||
| 1242 | +__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin) | ||
| 1243 | +{ | ||
| 1244 | + size_t __old; | ||
| 1245 | + if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) | ||
| 1246 | + __argp_fmtstream_update (__fs); | ||
| 1247 | + __old = __fs->rmargin; | ||
| 1248 | + __fs->rmargin = __rmargin; | ||
| 1249 | + return __old; | ||
| 1250 | +} | ||
| 1251 | + | ||
| 1252 | +/* Set FS's wrap margin to __WMARGIN and return the old value. */ | ||
| 1253 | +ARGP_FS_EI size_t | ||
| 1254 | +__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin) | ||
| 1255 | +{ | ||
| 1256 | + size_t __old; | ||
| 1257 | + if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) | ||
| 1258 | + __argp_fmtstream_update (__fs); | ||
| 1259 | + __old = __fs->wmargin; | ||
| 1260 | + __fs->wmargin = __wmargin; | ||
| 1261 | + return __old; | ||
| 1262 | +} | ||
| 1263 | + | ||
| 1264 | +/* Return the column number of the current output point in __FS. */ | ||
| 1265 | +ARGP_FS_EI size_t | ||
| 1266 | +__argp_fmtstream_point (argp_fmtstream_t __fs) | ||
| 1267 | +{ | ||
| 1268 | + if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs) | ||
| 1269 | + __argp_fmtstream_update (__fs); | ||
| 1270 | + return __fs->point_col >= 0 ? __fs->point_col : 0; | ||
| 1271 | +} | ||
| 1272 | + | ||
| 1273 | +#if !_LIBC | ||
| 1274 | +#undef __argp_fmtstream_putc | ||
| 1275 | +#undef __argp_fmtstream_puts | ||
| 1276 | +#undef __argp_fmtstream_write | ||
| 1277 | +#undef __argp_fmtstream_set_lmargin | ||
| 1278 | +#undef __argp_fmtstream_set_rmargin | ||
| 1279 | +#undef __argp_fmtstream_set_wmargin | ||
| 1280 | +#undef __argp_fmtstream_point | ||
| 1281 | +#undef __argp_fmtstream_update | ||
| 1282 | +#undef __argp_fmtstream_ensure | ||
| 1283 | +#endif | ||
| 1284 | + | ||
| 1285 | +#endif /* __OPTIMIZE__ */ | ||
| 1286 | + | ||
| 1287 | +#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ | ||
| 1288 | + | ||
| 1289 | +#endif /* argp-fmtstream.h */ | ||
| 1290 | Index: git/libuargp/argp-fs-xinl.c | ||
| 1291 | =================================================================== | ||
| 1292 | --- /dev/null | ||
| 1293 | +++ git/libuargp/argp-fs-xinl.c | ||
| 1294 | @@ -0,0 +1,44 @@ | ||
| 1295 | +/* Real definitions for extern inline functions in argp-fmtstream.h | ||
| 1296 | + Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. | ||
| 1297 | + This file is part of the GNU C Library. | ||
| 1298 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 1299 | + | ||
| 1300 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 1301 | + modify it under the terms of the GNU Lesser General Public | ||
| 1302 | + License as published by the Free Software Foundation; either | ||
| 1303 | + version 2.1 of the License, or (at your option) any later version. | ||
| 1304 | + | ||
| 1305 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 1306 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1307 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 1308 | + Lesser General Public License for more details. | ||
| 1309 | + | ||
| 1310 | + You should have received a copy of the GNU Lesser General Public | ||
| 1311 | + License along with the GNU C Library; if not, write to the Free | ||
| 1312 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 1313 | + 02111-1307 USA. */ | ||
| 1314 | + | ||
| 1315 | +#ifdef HAVE_CONFIG_H | ||
| 1316 | +# include <config.h> | ||
| 1317 | +#endif | ||
| 1318 | + | ||
| 1319 | +#define ARGP_FS_EI | ||
| 1320 | +#undef __OPTIMIZE__ | ||
| 1321 | +#define __OPTIMIZE__ 1 | ||
| 1322 | +#include "argp-fmtstream.h" | ||
| 1323 | + | ||
| 1324 | +#if 0 | ||
| 1325 | +/* Not exported. */ | ||
| 1326 | +/* Add weak aliases. */ | ||
| 1327 | +#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias) | ||
| 1328 | + | ||
| 1329 | +weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc) | ||
| 1330 | +weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts) | ||
| 1331 | +weak_alias (__argp_fmtstream_write, argp_fmtstream_write) | ||
| 1332 | +weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin) | ||
| 1333 | +weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin) | ||
| 1334 | +weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin) | ||
| 1335 | +weak_alias (__argp_fmtstream_point, argp_fmtstream_point) | ||
| 1336 | + | ||
| 1337 | +#endif | ||
| 1338 | +#endif | ||
| 1339 | Index: git/libuargp/argp-help.c | ||
| 1340 | =================================================================== | ||
| 1341 | --- /dev/null | ||
| 1342 | +++ git/libuargp/argp-help.c | ||
| 1343 | @@ -0,0 +1,1882 @@ | ||
| 1344 | +/* Hierarchial argument parsing help output | ||
| 1345 | + Copyright (C) 1995-2003, 2004, 2005, 2006, 2007 | ||
| 1346 | + Free Software Foundation, Inc. | ||
| 1347 | + This file is part of the GNU C Library. | ||
| 1348 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 1349 | + | ||
| 1350 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 1351 | + modify it under the terms of the GNU Lesser General Public | ||
| 1352 | + License as published by the Free Software Foundation; either | ||
| 1353 | + version 2.1 of the License, or (at your option) any later version. | ||
| 1354 | + | ||
| 1355 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 1356 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 1357 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 1358 | + Lesser General Public License for more details. | ||
| 1359 | + | ||
| 1360 | + You should have received a copy of the GNU Lesser General Public | ||
| 1361 | + License along with the GNU C Library; if not, write to the Free | ||
| 1362 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 1363 | + 02111-1307 USA. | ||
| 1364 | + | ||
| 1365 | + Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com> | ||
| 1366 | +*/ | ||
| 1367 | + | ||
| 1368 | +#ifndef _GNU_SOURCE | ||
| 1369 | +# define _GNU_SOURCE 1 | ||
| 1370 | +#endif | ||
| 1371 | + | ||
| 1372 | +#ifdef HAVE_CONFIG_H | ||
| 1373 | +#include <config.h> | ||
| 1374 | +#endif | ||
| 1375 | + | ||
| 1376 | +/* AIX requires this to be the first thing in the file. */ | ||
| 1377 | +#ifndef __GNUC__ | ||
| 1378 | +# if HAVE_ALLOCA_H || defined _LIBC | ||
| 1379 | +# include <alloca.h> | ||
| 1380 | +# else | ||
| 1381 | +# ifdef _AIX | ||
| 1382 | +#pragma alloca | ||
| 1383 | +# else | ||
| 1384 | +# ifndef alloca /* predefined by HP cc +Olibcalls */ | ||
| 1385 | +char *alloca (); | ||
| 1386 | +# endif | ||
| 1387 | +# endif | ||
| 1388 | +# endif | ||
| 1389 | +#endif | ||
| 1390 | + | ||
| 1391 | +#include <stddef.h> | ||
| 1392 | +#include <stdlib.h> | ||
| 1393 | +#include <string.h> | ||
| 1394 | +#include <assert.h> | ||
| 1395 | +#include <stdarg.h> | ||
| 1396 | +#include <ctype.h> | ||
| 1397 | +#include <limits.h> | ||
| 1398 | +#ifdef _LIBC | ||
| 1399 | +# include <wchar.h> | ||
| 1400 | +#endif | ||
| 1401 | + | ||
| 1402 | +#include <features.h> | ||
| 1403 | +#ifndef _ | ||
| 1404 | +/* This is for other GNU distributions with internationalized messages. */ | ||
| 1405 | +# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__ | ||
| 1406 | +# include <libintl.h> | ||
| 1407 | +# ifdef _LIBC | ||
| 1408 | +# undef dgettext | ||
| 1409 | +# define dgettext(domain, msgid) \ | ||
| 1410 | + INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES) | ||
| 1411 | +# endif | ||
| 1412 | +# else | ||
| 1413 | +# define dgettext(domain, msgid) (msgid) | ||
| 1414 | +# endif | ||
| 1415 | +#endif | ||
| 1416 | + | ||
| 1417 | +#ifndef _LIBC | ||
| 1418 | +# if HAVE_STRERROR_R | ||
| 1419 | +# if !HAVE_DECL_STRERROR_R | ||
| 1420 | +char *strerror_r (int errnum, char *buf, size_t buflen); | ||
| 1421 | +# endif | ||
| 1422 | +# else | ||
| 1423 | +# if !HAVE_DECL_STRERROR | ||
| 1424 | +char *strerror (int errnum); | ||
| 1425 | +# endif | ||
| 1426 | +# endif | ||
| 1427 | +#endif | ||
| 1428 | + | ||
| 1429 | +#include <argp.h> | ||
| 1430 | +#include "argp-fmtstream.h" | ||
| 1431 | +#include <stdbool.h> | ||
| 1432 | +#include <stdint.h> | ||
| 1433 | + | ||
| 1434 | +#ifndef SIZE_MAX | ||
| 1435 | +# define SIZE_MAX ((size_t) -1) | ||
| 1436 | +#endif | ||
| 1437 | + | ||
| 1438 | +/* User-selectable (using an environment variable) formatting parameters. | ||
| 1439 | + | ||
| 1440 | + These may be specified in an environment variable called `ARGP_HELP_FMT', | ||
| 1441 | + with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2 | ||
| 1442 | + Where VALn must be a positive integer. The list of variables is in the | ||
| 1443 | + UPARAM_NAMES vector, below. */ | ||
| 1444 | + | ||
| 1445 | +/* Default parameters. */ | ||
| 1446 | +#define DUP_ARGS 0 /* True if option argument can be duplicated. */ | ||
| 1447 | +#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ | ||
| 1448 | +#define SHORT_OPT_COL 2 /* column in which short options start */ | ||
| 1449 | +#define LONG_OPT_COL 6 /* column in which long options start */ | ||
| 1450 | +#define DOC_OPT_COL 2 /* column in which doc options start */ | ||
| 1451 | +#define OPT_DOC_COL 29 /* column in which option text starts */ | ||
| 1452 | +#define HEADER_COL 1 /* column in which group headers are printed */ | ||
| 1453 | +#define USAGE_INDENT 12 /* indentation of wrapped usage lines */ | ||
| 1454 | +#define RMARGIN 79 /* right margin used for wrapping */ | ||
| 1455 | + | ||
| 1456 | +/* User-selectable (using an environment variable) formatting parameters. | ||
| 1457 | + They must all be of type `int' for the parsing code to work. */ | ||
| 1458 | +struct uparams | ||
| 1459 | +{ | ||
| 1460 | + /* If true, arguments for an option are shown with both short and long | ||
| 1461 | + options, even when a given option has both, e.g. `-x ARG, --longx=ARG'. | ||
| 1462 | + If false, then if an option has both, the argument is only shown with | ||
| 1463 | + the long one, e.g., `-x, --longx=ARG', and a message indicating that | ||
| 1464 | + this really means both is printed below the options. */ | ||
| 1465 | + int dup_args; | ||
| 1466 | + | ||
| 1467 | + /* This is true if when DUP_ARGS is false, and some duplicate arguments have | ||
| 1468 | + been suppressed, an explanatory message should be printed. */ | ||
| 1469 | + int dup_args_note; | ||
| 1470 | + | ||
| 1471 | + /* Various output columns. */ | ||
| 1472 | + int short_opt_col; | ||
| 1473 | + int long_opt_col; | ||
| 1474 | + int doc_opt_col; | ||
| 1475 | + int opt_doc_col; | ||
| 1476 | + int header_col; | ||
| 1477 | + int usage_indent; | ||
| 1478 | + int rmargin; | ||
| 1479 | +}; | ||
| 1480 | + | ||
| 1481 | +/* This is a global variable, as user options are only ever read once. */ | ||
| 1482 | +static struct uparams uparams = { | ||
| 1483 | + DUP_ARGS, DUP_ARGS_NOTE, | ||
| 1484 | + SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL, | ||
| 1485 | + USAGE_INDENT, RMARGIN | ||
| 1486 | +}; | ||
| 1487 | + | ||
| 1488 | +/* A particular uparam, and what the user name is. */ | ||
| 1489 | +struct uparam_name | ||
| 1490 | +{ | ||
| 1491 | + const char name[14]; /* User name. */ | ||
| 1492 | + bool is_bool; /* Whether it's `boolean'. */ | ||
| 1493 | + uint8_t uparams_offs; /* Location of the (int) field in UPARAMS. */ | ||
| 1494 | +}; | ||
| 1495 | + | ||
| 1496 | +/* The name-field mappings we know about. */ | ||
| 1497 | +static const struct uparam_name uparam_names[] = | ||
| 1498 | +{ | ||
| 1499 | + { "dup-args", true, offsetof (struct uparams, dup_args) }, | ||
| 1500 | + { "dup-args-note", true, offsetof (struct uparams, dup_args_note) }, | ||
| 1501 | + { "short-opt-col", false, offsetof (struct uparams, short_opt_col) }, | ||
| 1502 | + { "long-opt-col", false, offsetof (struct uparams, long_opt_col) }, | ||
| 1503 | + { "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) }, | ||
| 1504 | + { "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) }, | ||
| 1505 | + { "header-col", false, offsetof (struct uparams, header_col) }, | ||
| 1506 | + { "usage-indent", false, offsetof (struct uparams, usage_indent) }, | ||
| 1507 | + { "rmargin", false, offsetof (struct uparams, rmargin) } | ||
| 1508 | +}; | ||
| 1509 | +#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0])) | ||
| 1510 | + | ||
| 1511 | +/* Read user options from the environment, and fill in UPARAMS appropiately. */ | ||
| 1512 | +static void | ||
| 1513 | +fill_in_uparams (const struct argp_state *state) | ||
| 1514 | +{ | ||
| 1515 | + const char *var = getenv ("ARGP_HELP_FMT"); | ||
| 1516 | + | ||
| 1517 | +#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); | ||
| 1518 | + | ||
| 1519 | + if (var) | ||
| 1520 | + /* Parse var. */ | ||
| 1521 | + while (*var) | ||
| 1522 | + { | ||
| 1523 | + SKIPWS (var); | ||
| 1524 | + | ||
| 1525 | + if (isalpha (*var)) | ||
| 1526 | + { | ||
| 1527 | + size_t var_len; | ||
| 1528 | + const struct uparam_name *un; | ||
| 1529 | + int unspec = 0, val = 0; | ||
| 1530 | + const char *arg = var; | ||
| 1531 | + | ||
| 1532 | + while (isalnum (*arg) || *arg == '-' || *arg == '_') | ||
| 1533 | + arg++; | ||
| 1534 | + var_len = arg - var; | ||
| 1535 | + | ||
| 1536 | + SKIPWS (arg); | ||
| 1537 | + | ||
| 1538 | + if (*arg == '\0' || *arg == ',') | ||
| 1539 | + unspec = 1; | ||
| 1540 | + else if (*arg == '=') | ||
| 1541 | + { | ||
| 1542 | + arg++; | ||
| 1543 | + SKIPWS (arg); | ||
| 1544 | + } | ||
| 1545 | + | ||
| 1546 | + if (unspec) | ||
| 1547 | + { | ||
| 1548 | + if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') | ||
| 1549 | + { | ||
| 1550 | + val = 0; | ||
| 1551 | + var += 3; | ||
| 1552 | + var_len -= 3; | ||
| 1553 | + } | ||
| 1554 | + else | ||
| 1555 | + val = 1; | ||
| 1556 | + } | ||
| 1557 | + else if (isdigit (*arg)) | ||
| 1558 | + { | ||
| 1559 | + val = atoi (arg); | ||
| 1560 | + while (isdigit (*arg)) | ||
| 1561 | + arg++; | ||
| 1562 | + SKIPWS (arg); | ||
| 1563 | + } | ||
| 1564 | + | ||
| 1565 | + un = uparam_names; | ||
| 1566 | + size_t u; | ||
| 1567 | + for (u = 0; u < nuparam_names; ++un, ++u) | ||
| 1568 | + if (strlen (un->name) == var_len | ||
| 1569 | + && strncmp (var, un->name, var_len) == 0) | ||
| 1570 | + { | ||
| 1571 | + if (unspec && !un->is_bool) | ||
| 1572 | + argp_failure (state, 0, 0, | ||
| 1573 | + dgettext (state == NULL ? NULL | ||
| 1574 | + : state->root_argp->argp_domain, | ||
| 1575 | + "\ | ||
| 1576 | +%.*s: ARGP_HELP_FMT parameter requires a value"), | ||
| 1577 | + (int) var_len, var); | ||
| 1578 | + else | ||
| 1579 | + *(int *)((char *)&uparams + un->uparams_offs) = val; | ||
| 1580 | + break; | ||
| 1581 | + } | ||
| 1582 | + if (u == nuparam_names) | ||
| 1583 | + argp_failure (state, 0, 0, | ||
| 1584 | + dgettext (state == NULL ? NULL | ||
| 1585 | + : state->root_argp->argp_domain, "\ | ||
| 1586 | +%.*s: Unknown ARGP_HELP_FMT parameter"), | ||
| 1587 | + (int) var_len, var); | ||
| 1588 | + | ||
| 1589 | + var = arg; | ||
| 1590 | + if (*var == ',') | ||
| 1591 | + var++; | ||
| 1592 | + } | ||
| 1593 | + else if (*var) | ||
| 1594 | + { | ||
| 1595 | + argp_failure (state, 0, 0, | ||
| 1596 | + dgettext (state == NULL ? NULL | ||
| 1597 | + : state->root_argp->argp_domain, | ||
| 1598 | + "Garbage in ARGP_HELP_FMT: %s"), var); | ||
| 1599 | + break; | ||
| 1600 | + } | ||
| 1601 | + } | ||
| 1602 | +} | ||
| 1603 | + | ||
| 1604 | +/* Returns true if OPT hasn't been marked invisible. Visibility only affects | ||
| 1605 | + whether OPT is displayed or used in sorting, not option shadowing. */ | ||
| 1606 | +#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN)) | ||
| 1607 | + | ||
| 1608 | +/* Returns true if OPT is an alias for an earlier option. */ | ||
| 1609 | +#define oalias(opt) ((opt)->flags & OPTION_ALIAS) | ||
| 1610 | + | ||
| 1611 | +/* Returns true if OPT is an documentation-only entry. */ | ||
| 1612 | +#define odoc(opt) ((opt)->flags & OPTION_DOC) | ||
| 1613 | + | ||
| 1614 | +/* Returns true if OPT is the end-of-list marker for a list of options. */ | ||
| 1615 | +#define oend(opt) __option_is_end (opt) | ||
| 1616 | + | ||
| 1617 | +/* Returns true if OPT has a short option. */ | ||
| 1618 | +#define oshort(opt) __option_is_short (opt) | ||
| 1619 | + | ||
| 1620 | +/* | ||
| 1621 | + The help format for a particular option is like: | ||
| 1622 | + | ||
| 1623 | + -xARG, -yARG, --long1=ARG, --long2=ARG Documentation... | ||
| 1624 | + | ||
| 1625 | + Where ARG will be omitted if there's no argument, for this option, or | ||
| 1626 | + will be surrounded by "[" and "]" appropiately if the argument is | ||
| 1627 | + optional. The documentation string is word-wrapped appropiately, and if | ||
| 1628 | + the list of options is long enough, it will be started on a separate line. | ||
| 1629 | + If there are no short options for a given option, the first long option is | ||
| 1630 | + indented slighly in a way that's supposed to make most long options appear | ||
| 1631 | + to be in a separate column. | ||
| 1632 | + | ||
| 1633 | + For example, the following output (from ps): | ||
| 1634 | + | ||
| 1635 | + -p PID, --pid=PID List the process PID | ||
| 1636 | + --pgrp=PGRP List processes in the process group PGRP | ||
| 1637 | + -P, -x, --no-parent Include processes without parents | ||
| 1638 | + -Q, --all-fields Don't elide unusable fields (normally if there's | ||
| 1639 | + some reason ps can't print a field for any | ||
| 1640 | + process, it's removed from the output entirely) | ||
| 1641 | + -r, --reverse, --gratuitously-long-reverse-option | ||
| 1642 | + Reverse the order of any sort | ||
| 1643 | + --session[=SID] Add the processes from the session SID (which | ||
| 1644 | + defaults to the sid of the current process) | ||
| 1645 | + | ||
| 1646 | + Here are some more options: | ||
| 1647 | + -f ZOT, --foonly=ZOT Glork a foonly | ||
| 1648 | + -z, --zaza Snit a zar | ||
| 1649 | + | ||
| 1650 | + -?, --help Give this help list | ||
| 1651 | + --usage Give a short usage message | ||
| 1652 | + -V, --version Print program version | ||
| 1653 | + | ||
| 1654 | + The struct argp_option array for the above could look like: | ||
| 1655 | + | ||
| 1656 | + { | ||
| 1657 | + {"pid", 'p', "PID", 0, "List the process PID"}, | ||
| 1658 | + {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"}, | ||
| 1659 | + {"no-parent", 'P', 0, 0, "Include processes without parents"}, | ||
| 1660 | + {0, 'x', 0, OPTION_ALIAS}, | ||
| 1661 | + {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" | ||
| 1662 | + " if there's some reason ps can't" | ||
| 1663 | + " print a field for any process, it's" | ||
| 1664 | + " removed from the output entirely)" }, | ||
| 1665 | + {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, | ||
| 1666 | + {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, | ||
| 1667 | + {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL, | ||
| 1668 | + "Add the processes from the session" | ||
| 1669 | + " SID (which defaults to the sid of" | ||
| 1670 | + " the current process)" }, | ||
| 1671 | + | ||
| 1672 | + {0,0,0,0, "Here are some more options:"}, | ||
| 1673 | + {"foonly", 'f', "ZOT", 0, "Glork a foonly"}, | ||
| 1674 | + {"zaza", 'z', 0, 0, "Snit a zar"}, | ||
| 1675 | + | ||
| 1676 | + {0} | ||
| 1677 | + } | ||
| 1678 | + | ||
| 1679 | + Note that the last three options are automatically supplied by argp_parse, | ||
| 1680 | + unless you tell it not to with ARGP_NO_HELP. | ||
| 1681 | + | ||
| 1682 | +*/ | ||
| 1683 | + | ||
| 1684 | +/* Returns true if CH occurs between BEG and END. */ | ||
| 1685 | +static int | ||
| 1686 | +find_char (char ch, char *beg, char *end) | ||
| 1687 | +{ | ||
| 1688 | + while (beg < end) | ||
| 1689 | + if (*beg == ch) | ||
| 1690 | + return 1; | ||
| 1691 | + else | ||
| 1692 | + beg++; | ||
| 1693 | + return 0; | ||
| 1694 | +} | ||
| 1695 | + | ||
| 1696 | +struct hol_cluster; /* fwd decl */ | ||
| 1697 | + | ||
| 1698 | +struct hol_entry | ||
| 1699 | +{ | ||
| 1700 | + /* First option. */ | ||
| 1701 | + const struct argp_option *opt; | ||
| 1702 | + /* Number of options (including aliases). */ | ||
| 1703 | + unsigned num; | ||
| 1704 | + | ||
| 1705 | + /* A pointers into the HOL's short_options field, to the first short option | ||
| 1706 | + letter for this entry. The order of the characters following this point | ||
| 1707 | + corresponds to the order of options pointed to by OPT, and there are at | ||
| 1708 | + most NUM. A short option recorded in a option following OPT is only | ||
| 1709 | + valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's | ||
| 1710 | + probably been shadowed by some other entry). */ | ||
| 1711 | + char *short_options; | ||
| 1712 | + | ||
| 1713 | + /* Entries are sorted by their group first, in the order: | ||
| 1714 | + 1, 2, ..., n, 0, -m, ..., -2, -1 | ||
| 1715 | + and then alphabetically within each group. The default is 0. */ | ||
| 1716 | + int group; | ||
| 1717 | + | ||
| 1718 | + /* The cluster of options this entry belongs to, or 0 if none. */ | ||
| 1719 | + struct hol_cluster *cluster; | ||
| 1720 | + | ||
| 1721 | + /* The argp from which this option came. */ | ||
| 1722 | + const struct argp *argp; | ||
| 1723 | +}; | ||
| 1724 | + | ||
| 1725 | +/* A cluster of entries to reflect the argp tree structure. */ | ||
| 1726 | +struct hol_cluster | ||
| 1727 | +{ | ||
| 1728 | + /* A descriptive header printed before options in this cluster. */ | ||
| 1729 | + const char *header; | ||
| 1730 | + | ||
| 1731 | + /* Used to order clusters within the same group with the same parent, | ||
| 1732 | + according to the order in which they occurred in the parent argp's child | ||
| 1733 | + list. */ | ||
| 1734 | + int index; | ||
| 1735 | + | ||
| 1736 | + /* How to sort this cluster with respect to options and other clusters at the | ||
| 1737 | + same depth (clusters always follow options in the same group). */ | ||
| 1738 | + int group; | ||
| 1739 | + | ||
| 1740 | + /* The cluster to which this cluster belongs, or 0 if it's at the base | ||
| 1741 | + level. */ | ||
| 1742 | + struct hol_cluster *parent; | ||
| 1743 | + | ||
| 1744 | + /* The argp from which this cluster is (eventually) derived. */ | ||
| 1745 | + const struct argp *argp; | ||
| 1746 | + | ||
| 1747 | + /* The distance this cluster is from the root. */ | ||
| 1748 | + int depth; | ||
| 1749 | + | ||
| 1750 | + /* Clusters in a given hol are kept in a linked list, to make freeing them | ||
| 1751 | + possible. */ | ||
| 1752 | + struct hol_cluster *next; | ||
| 1753 | +}; | ||
| 1754 | + | ||
| 1755 | +/* A list of options for help. */ | ||
| 1756 | +struct hol | ||
| 1757 | +{ | ||
| 1758 | + /* An array of hol_entry's. */ | ||
| 1759 | + struct hol_entry *entries; | ||
| 1760 | + /* The number of entries in this hol. If this field is zero, the others | ||
| 1761 | + are undefined. */ | ||
| 1762 | + unsigned num_entries; | ||
| 1763 | + | ||
| 1764 | + /* A string containing all short options in this HOL. Each entry contains | ||
| 1765 | + pointers into this string, so the order can't be messed with blindly. */ | ||
| 1766 | + char *short_options; | ||
| 1767 | + | ||
| 1768 | + /* Clusters of entries in this hol. */ | ||
| 1769 | + struct hol_cluster *clusters; | ||
| 1770 | +}; | ||
| 1771 | + | ||
| 1772 | +/* Create a struct hol from the options in ARGP. CLUSTER is the | ||
| 1773 | + hol_cluster in which these entries occur, or 0, if at the root. */ | ||
| 1774 | +static struct hol * | ||
| 1775 | +make_hol (const struct argp *argp, struct hol_cluster *cluster) | ||
| 1776 | +{ | ||
| 1777 | + char *so; | ||
| 1778 | + const struct argp_option *o; | ||
| 1779 | + const struct argp_option *opts = argp->options; | ||
| 1780 | + struct hol_entry *entry; | ||
| 1781 | + unsigned num_short_options = 0; | ||
| 1782 | + struct hol *hol = malloc (sizeof (struct hol)); | ||
| 1783 | + | ||
| 1784 | + assert (hol); | ||
| 1785 | + | ||
| 1786 | + hol->num_entries = 0; | ||
| 1787 | + hol->clusters = 0; | ||
| 1788 | + | ||
| 1789 | + if (opts) | ||
| 1790 | + { | ||
| 1791 | + int cur_group = 0; | ||
| 1792 | + | ||
| 1793 | + /* The first option must not be an alias. */ | ||
| 1794 | + assert (! oalias (opts)); | ||
| 1795 | + | ||
| 1796 | + /* Calculate the space needed. */ | ||
| 1797 | + for (o = opts; ! oend (o); o++) | ||
| 1798 | + { | ||
| 1799 | + if (! oalias (o)) | ||
| 1800 | + hol->num_entries++; | ||
| 1801 | + if (oshort (o)) | ||
| 1802 | + num_short_options++; /* This is an upper bound. */ | ||
| 1803 | + } | ||
| 1804 | + | ||
| 1805 | + hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); | ||
| 1806 | + hol->short_options = malloc (num_short_options + 1); | ||
| 1807 | + | ||
| 1808 | + assert (hol->entries && hol->short_options); | ||
| 1809 | +#if SIZE_MAX <= UINT_MAX | ||
| 1810 | + assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); | ||
| 1811 | +#endif | ||
| 1812 | + | ||
| 1813 | + /* Fill in the entries. */ | ||
| 1814 | + so = hol->short_options; | ||
| 1815 | + for (o = opts, entry = hol->entries; ! oend (o); entry++) | ||
| 1816 | + { | ||
| 1817 | + entry->opt = o; | ||
| 1818 | + entry->num = 0; | ||
| 1819 | + entry->short_options = so; | ||
| 1820 | + entry->group = cur_group = | ||
| 1821 | + o->group | ||
| 1822 | + ? o->group | ||
| 1823 | + : ((!o->name && !o->key) | ||
| 1824 | + ? cur_group + 1 | ||
| 1825 | + : cur_group); | ||
| 1826 | + entry->cluster = cluster; | ||
| 1827 | + entry->argp = argp; | ||
| 1828 | + | ||
| 1829 | + do | ||
| 1830 | + { | ||
| 1831 | + entry->num++; | ||
| 1832 | + if (oshort (o) && ! find_char (o->key, hol->short_options, so)) | ||
| 1833 | + /* O has a valid short option which hasn't already been used.*/ | ||
| 1834 | + *so++ = o->key; | ||
| 1835 | + o++; | ||
| 1836 | + } | ||
| 1837 | + while (! oend (o) && oalias (o)); | ||
| 1838 | + } | ||
| 1839 | + *so = '\0'; /* null terminated so we can find the length */ | ||
| 1840 | + } | ||
| 1841 | + | ||
| 1842 | + return hol; | ||
| 1843 | +} | ||
| 1844 | + | ||
| 1845 | +/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the | ||
| 1846 | + associated argp child list entry), INDEX, and PARENT, and return a pointer | ||
| 1847 | + to it. ARGP is the argp that this cluster results from. */ | ||
| 1848 | +static struct hol_cluster * | ||
| 1849 | +hol_add_cluster (struct hol *hol, int group, const char *header, int index, | ||
| 1850 | + struct hol_cluster *parent, const struct argp *argp) | ||
| 1851 | +{ | ||
| 1852 | + struct hol_cluster *cl = malloc (sizeof (struct hol_cluster)); | ||
| 1853 | + if (cl) | ||
| 1854 | + { | ||
| 1855 | + cl->group = group; | ||
| 1856 | + cl->header = header; | ||
| 1857 | + | ||
| 1858 | + cl->index = index; | ||
| 1859 | + cl->parent = parent; | ||
| 1860 | + cl->argp = argp; | ||
| 1861 | + cl->depth = parent ? parent->depth + 1 : 0; | ||
| 1862 | + | ||
| 1863 | + cl->next = hol->clusters; | ||
| 1864 | + hol->clusters = cl; | ||
| 1865 | + } | ||
| 1866 | + return cl; | ||
| 1867 | +} | ||
| 1868 | + | ||
| 1869 | +/* Free HOL and any resources it uses. */ | ||
| 1870 | +static void | ||
| 1871 | +hol_free (struct hol *hol) | ||
| 1872 | +{ | ||
| 1873 | + struct hol_cluster *cl = hol->clusters; | ||
| 1874 | + | ||
| 1875 | + while (cl) | ||
| 1876 | + { | ||
| 1877 | + struct hol_cluster *next = cl->next; | ||
| 1878 | + free (cl); | ||
| 1879 | + cl = next; | ||
| 1880 | + } | ||
| 1881 | + | ||
| 1882 | + if (hol->num_entries > 0) | ||
| 1883 | + { | ||
| 1884 | + free (hol->entries); | ||
| 1885 | + free (hol->short_options); | ||
| 1886 | + } | ||
| 1887 | + | ||
| 1888 | + free (hol); | ||
| 1889 | +} | ||
| 1890 | + | ||
| 1891 | +static int | ||
| 1892 | +hol_entry_short_iterate (const struct hol_entry *entry, | ||
| 1893 | + int (*func)(const struct argp_option *opt, | ||
| 1894 | + const struct argp_option *real, | ||
| 1895 | + const char *domain, void *cookie), | ||
| 1896 | + const char *domain, void *cookie) | ||
| 1897 | +{ | ||
| 1898 | + unsigned nopts; | ||
| 1899 | + int val = 0; | ||
| 1900 | + const struct argp_option *opt, *real = entry->opt; | ||
| 1901 | + char *so = entry->short_options; | ||
| 1902 | + | ||
| 1903 | + for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) | ||
| 1904 | + if (oshort (opt) && *so == opt->key) | ||
| 1905 | + { | ||
| 1906 | + if (!oalias (opt)) | ||
| 1907 | + real = opt; | ||
| 1908 | + if (ovisible (opt)) | ||
| 1909 | + val = (*func)(opt, real, domain, cookie); | ||
| 1910 | + so++; | ||
| 1911 | + } | ||
| 1912 | + | ||
| 1913 | + return val; | ||
| 1914 | +} | ||
| 1915 | + | ||
| 1916 | +static __inline__ int | ||
| 1917 | +__attribute__ ((always_inline)) | ||
| 1918 | +hol_entry_long_iterate (const struct hol_entry *entry, | ||
| 1919 | + int (*func)(const struct argp_option *opt, | ||
| 1920 | + const struct argp_option *real, | ||
| 1921 | + const char *domain, void *cookie), | ||
| 1922 | + const char *domain, void *cookie) | ||
| 1923 | +{ | ||
| 1924 | + unsigned nopts; | ||
| 1925 | + int val = 0; | ||
| 1926 | + const struct argp_option *opt, *real = entry->opt; | ||
| 1927 | + | ||
| 1928 | + for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) | ||
| 1929 | + if (opt->name) | ||
| 1930 | + { | ||
| 1931 | + if (!oalias (opt)) | ||
| 1932 | + real = opt; | ||
| 1933 | + if (ovisible (opt)) | ||
| 1934 | + val = (*func)(opt, real, domain, cookie); | ||
| 1935 | + } | ||
| 1936 | + | ||
| 1937 | + return val; | ||
| 1938 | +} | ||
| 1939 | + | ||
| 1940 | +/* Iterator that returns true for the first short option. */ | ||
| 1941 | +static __inline__ int | ||
| 1942 | +until_short (const struct argp_option *opt, const struct argp_option *real, | ||
| 1943 | + const char *domain, void *cookie) | ||
| 1944 | +{ | ||
| 1945 | + return oshort (opt) ? opt->key : 0; | ||
| 1946 | +} | ||
| 1947 | + | ||
| 1948 | +/* Returns the first valid short option in ENTRY, or 0 if there is none. */ | ||
| 1949 | +static char | ||
| 1950 | +hol_entry_first_short (const struct hol_entry *entry) | ||
| 1951 | +{ | ||
| 1952 | + return hol_entry_short_iterate (entry, until_short, | ||
| 1953 | + entry->argp->argp_domain, 0); | ||
| 1954 | +} | ||
| 1955 | + | ||
| 1956 | +/* Returns the first valid long option in ENTRY, or 0 if there is none. */ | ||
| 1957 | +static const char * | ||
| 1958 | +hol_entry_first_long (const struct hol_entry *entry) | ||
| 1959 | +{ | ||
| 1960 | + const struct argp_option *opt; | ||
| 1961 | + unsigned num; | ||
| 1962 | + for (opt = entry->opt, num = entry->num; num > 0; opt++, num--) | ||
| 1963 | + if (opt->name && ovisible (opt)) | ||
| 1964 | + return opt->name; | ||
| 1965 | + return 0; | ||
| 1966 | +} | ||
| 1967 | + | ||
| 1968 | +/* Returns the entry in HOL with the long option name NAME, or 0 if there is | ||
| 1969 | + none. */ | ||
| 1970 | +static struct hol_entry * | ||
| 1971 | +hol_find_entry (struct hol *hol, const char *name) | ||
| 1972 | +{ | ||
| 1973 | + struct hol_entry *entry = hol->entries; | ||
| 1974 | + unsigned num_entries = hol->num_entries; | ||
| 1975 | + | ||
| 1976 | + while (num_entries-- > 0) | ||
| 1977 | + { | ||
| 1978 | + const struct argp_option *opt = entry->opt; | ||
| 1979 | + unsigned num_opts = entry->num; | ||
| 1980 | + | ||
| 1981 | + while (num_opts-- > 0) | ||
| 1982 | + if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) | ||
| 1983 | + return entry; | ||
| 1984 | + else | ||
| 1985 | + opt++; | ||
| 1986 | + | ||
| 1987 | + entry++; | ||
| 1988 | + } | ||
| 1989 | + | ||
| 1990 | + return 0; | ||
| 1991 | +} | ||
| 1992 | + | ||
| 1993 | +/* If an entry with the long option NAME occurs in HOL, set it's special | ||
| 1994 | + sort position to GROUP. */ | ||
| 1995 | +static void | ||
| 1996 | +hol_set_group (struct hol *hol, const char *name, int group) | ||
| 1997 | +{ | ||
| 1998 | + struct hol_entry *entry = hol_find_entry (hol, name); | ||
| 1999 | + if (entry) | ||
| 2000 | + entry->group = group; | ||
| 2001 | +} | ||
| 2002 | + | ||
| 2003 | +/* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1. | ||
| 2004 | + EQ is what to return if GROUP1 and GROUP2 are the same. */ | ||
| 2005 | +static int | ||
| 2006 | +group_cmp (int group1, int group2, int eq) | ||
| 2007 | +{ | ||
| 2008 | + if (group1 == group2) | ||
| 2009 | + return eq; | ||
| 2010 | + else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0)) | ||
| 2011 | + return group1 - group2; | ||
| 2012 | + else | ||
| 2013 | + return group2 - group1; | ||
| 2014 | +} | ||
| 2015 | + | ||
| 2016 | +/* Compare clusters CL1 & CL2 by the order that they should appear in | ||
| 2017 | + output. */ | ||
| 2018 | +static int | ||
| 2019 | +hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) | ||
| 2020 | +{ | ||
| 2021 | + /* If one cluster is deeper than the other, use its ancestor at the same | ||
| 2022 | + level, so that finding the common ancestor is straightforward. */ | ||
| 2023 | + while (cl1->depth > cl2->depth) | ||
| 2024 | + cl1 = cl1->parent; | ||
| 2025 | + while (cl2->depth > cl1->depth) | ||
| 2026 | + cl2 = cl2->parent; | ||
| 2027 | + | ||
| 2028 | + /* Now reduce both clusters to their ancestors at the point where both have | ||
| 2029 | + a common parent; these can be directly compared. */ | ||
| 2030 | + while (cl1->parent != cl2->parent) | ||
| 2031 | + cl1 = cl1->parent, cl2 = cl2->parent; | ||
| 2032 | + | ||
| 2033 | + return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index); | ||
| 2034 | +} | ||
| 2035 | + | ||
| 2036 | +/* Return the ancestor of CL that's just below the root (i.e., has a parent | ||
| 2037 | + of 0). */ | ||
| 2038 | +static struct hol_cluster * | ||
| 2039 | +hol_cluster_base (struct hol_cluster *cl) | ||
| 2040 | +{ | ||
| 2041 | + while (cl->parent) | ||
| 2042 | + cl = cl->parent; | ||
| 2043 | + return cl; | ||
| 2044 | +} | ||
| 2045 | + | ||
| 2046 | +/* Return true if CL1 is a child of CL2. */ | ||
| 2047 | +static int | ||
| 2048 | +hol_cluster_is_child (const struct hol_cluster *cl1, | ||
| 2049 | + const struct hol_cluster *cl2) | ||
| 2050 | +{ | ||
| 2051 | + while (cl1 && cl1 != cl2) | ||
| 2052 | + cl1 = cl1->parent; | ||
| 2053 | + return cl1 == cl2; | ||
| 2054 | +} | ||
| 2055 | + | ||
| 2056 | +/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail | ||
| 2057 | + that should be used for comparisons, and returns true iff it should be | ||
| 2058 | + treated as a non-option. */ | ||
| 2059 | +static int | ||
| 2060 | +canon_doc_option (const char **name) | ||
| 2061 | +{ | ||
| 2062 | + int non_opt; | ||
| 2063 | + /* Skip initial whitespace. */ | ||
| 2064 | + while (isspace (**name)) | ||
| 2065 | + (*name)++; | ||
| 2066 | + /* Decide whether this looks like an option (leading `-') or not. */ | ||
| 2067 | + non_opt = (**name != '-'); | ||
| 2068 | + /* Skip until part of name used for sorting. */ | ||
| 2069 | + while (**name && !isalnum (**name)) | ||
| 2070 | + (*name)++; | ||
| 2071 | + return non_opt; | ||
| 2072 | +} | ||
| 2073 | + | ||
| 2074 | +/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help | ||
| 2075 | + listing. */ | ||
| 2076 | +static int | ||
| 2077 | +hol_entry_cmp (const struct hol_entry *entry1, | ||
| 2078 | + const struct hol_entry *entry2) | ||
| 2079 | +{ | ||
| 2080 | + /* The group numbers by which the entries should be ordered; if either is | ||
| 2081 | + in a cluster, then this is just the group within the cluster. */ | ||
| 2082 | + int group1 = entry1->group, group2 = entry2->group; | ||
| 2083 | + | ||
| 2084 | + if (entry1->cluster != entry2->cluster) | ||
| 2085 | + { | ||
| 2086 | + /* The entries are not within the same cluster, so we can't compare them | ||
| 2087 | + directly, we have to use the appropiate clustering level too. */ | ||
| 2088 | + if (! entry1->cluster) | ||
| 2089 | + /* ENTRY1 is at the `base level', not in a cluster, so we have to | ||
| 2090 | + compare it's group number with that of the base cluster in which | ||
| 2091 | + ENTRY2 resides. Note that if they're in the same group, the | ||
| 2092 | + clustered option always comes laster. */ | ||
| 2093 | + return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); | ||
| 2094 | + else if (! entry2->cluster) | ||
| 2095 | + /* Likewise, but ENTRY2's not in a cluster. */ | ||
| 2096 | + return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); | ||
| 2097 | + else | ||
| 2098 | + /* Both entries are in clusters, we can just compare the clusters. */ | ||
| 2099 | + return hol_cluster_cmp (entry1->cluster, entry2->cluster); | ||
| 2100 | + } | ||
| 2101 | + else if (group1 == group2) | ||
| 2102 | + /* The entries are both in the same cluster and group, so compare them | ||
| 2103 | + alphabetically. */ | ||
| 2104 | + { | ||
| 2105 | + int short1 = hol_entry_first_short (entry1); | ||
| 2106 | + int short2 = hol_entry_first_short (entry2); | ||
| 2107 | + int doc1 = odoc (entry1->opt); | ||
| 2108 | + int doc2 = odoc (entry2->opt); | ||
| 2109 | + const char *long1 = hol_entry_first_long (entry1); | ||
| 2110 | + const char *long2 = hol_entry_first_long (entry2); | ||
| 2111 | + | ||
| 2112 | + if (doc1) | ||
| 2113 | + doc1 = long1 != NULL && canon_doc_option (&long1); | ||
| 2114 | + if (doc2) | ||
| 2115 | + doc2 = long2 != NULL && canon_doc_option (&long2); | ||
| 2116 | + | ||
| 2117 | + if (doc1 != doc2) | ||
| 2118 | + /* `documentation' options always follow normal options (or | ||
| 2119 | + documentation options that *look* like normal options). */ | ||
| 2120 | + return doc1 - doc2; | ||
| 2121 | + else if (!short1 && !short2 && long1 && long2) | ||
| 2122 | + /* Only long options. */ | ||
| 2123 | + return strcasecmp (long1, long2); | ||
| 2124 | + else | ||
| 2125 | + /* Compare short/short, long/short, short/long, using the first | ||
| 2126 | + character of long options. Entries without *any* valid | ||
| 2127 | + options (such as options with OPTION_HIDDEN set) will be put | ||
| 2128 | + first, but as they're not displayed, it doesn't matter where | ||
| 2129 | + they are. */ | ||
| 2130 | + { | ||
| 2131 | + char first1 = short1 ? short1 : long1 ? *long1 : 0; | ||
| 2132 | + char first2 = short2 ? short2 : long2 ? *long2 : 0; | ||
| 2133 | +#ifdef _tolower | ||
| 2134 | + int lower_cmp = _tolower (first1) - _tolower (first2); | ||
| 2135 | +#else | ||
| 2136 | + int lower_cmp = tolower (first1) - tolower (first2); | ||
| 2137 | +#endif | ||
| 2138 | + /* Compare ignoring case, except when the options are both the | ||
| 2139 | + same letter, in which case lower-case always comes first. */ | ||
| 2140 | + return lower_cmp ? lower_cmp : first2 - first1; | ||
| 2141 | + } | ||
| 2142 | + } | ||
| 2143 | + else | ||
| 2144 | + /* Within the same cluster, but not the same group, so just compare | ||
| 2145 | + groups. */ | ||
| 2146 | + return group_cmp (group1, group2, 0); | ||
| 2147 | +} | ||
| 2148 | + | ||
| 2149 | +/* Version of hol_entry_cmp with correct signature for qsort. */ | ||
| 2150 | +static int | ||
| 2151 | +hol_entry_qcmp (const void *entry1_v, const void *entry2_v) | ||
| 2152 | +{ | ||
| 2153 | + return hol_entry_cmp (entry1_v, entry2_v); | ||
| 2154 | +} | ||
| 2155 | + | ||
| 2156 | +/* Sort HOL by group and alphabetically by option name (with short options | ||
| 2157 | + taking precedence over long). Since the sorting is for display purposes | ||
| 2158 | + only, the shadowing of options isn't effected. */ | ||
| 2159 | +static void | ||
| 2160 | +hol_sort (struct hol *hol) | ||
| 2161 | +{ | ||
| 2162 | + if (hol->num_entries > 0) | ||
| 2163 | + qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), | ||
| 2164 | + hol_entry_qcmp); | ||
| 2165 | +} | ||
| 2166 | + | ||
| 2167 | +/* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow | ||
| 2168 | + any in MORE with the same name. */ | ||
| 2169 | +static void | ||
| 2170 | +hol_append (struct hol *hol, struct hol *more) | ||
| 2171 | +{ | ||
| 2172 | + struct hol_cluster **cl_end = &hol->clusters; | ||
| 2173 | + | ||
| 2174 | + /* Steal MORE's cluster list, and add it to the end of HOL's. */ | ||
| 2175 | + while (*cl_end) | ||
| 2176 | + cl_end = &(*cl_end)->next; | ||
| 2177 | + *cl_end = more->clusters; | ||
| 2178 | + more->clusters = 0; | ||
| 2179 | + | ||
| 2180 | + /* Merge entries. */ | ||
| 2181 | + if (more->num_entries > 0) | ||
| 2182 | + { | ||
| 2183 | + if (hol->num_entries == 0) | ||
| 2184 | + { | ||
| 2185 | + hol->num_entries = more->num_entries; | ||
| 2186 | + hol->entries = more->entries; | ||
| 2187 | + hol->short_options = more->short_options; | ||
| 2188 | + more->num_entries = 0; /* Mark MORE's fields as invalid. */ | ||
| 2189 | + } | ||
| 2190 | + else | ||
| 2191 | + /* Append the entries in MORE to those in HOL, taking care to only add | ||
| 2192 | + non-shadowed SHORT_OPTIONS values. */ | ||
| 2193 | + { | ||
| 2194 | + unsigned left; | ||
| 2195 | + char *so, *more_so; | ||
| 2196 | + struct hol_entry *e; | ||
| 2197 | + unsigned num_entries = hol->num_entries + more->num_entries; | ||
| 2198 | + struct hol_entry *entries = | ||
| 2199 | + malloc (num_entries * sizeof (struct hol_entry)); | ||
| 2200 | + unsigned hol_so_len = strlen (hol->short_options); | ||
| 2201 | + char *short_options = | ||
| 2202 | + malloc (hol_so_len + strlen (more->short_options) + 1); | ||
| 2203 | + | ||
| 2204 | + assert (entries && short_options); | ||
| 2205 | +#if SIZE_MAX <= UINT_MAX | ||
| 2206 | + assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry)); | ||
| 2207 | +#endif | ||
| 2208 | + | ||
| 2209 | + mempcpy (mempcpy (entries, hol->entries, | ||
| 2210 | + hol->num_entries * sizeof (struct hol_entry)), | ||
| 2211 | + more->entries, | ||
| 2212 | + more->num_entries * sizeof (struct hol_entry)); | ||
| 2213 | + | ||
| 2214 | + mempcpy (short_options, hol->short_options, hol_so_len); | ||
| 2215 | + | ||
| 2216 | + /* Fix up the short options pointers from HOL. */ | ||
| 2217 | + for (e = entries, left = hol->num_entries; left > 0; e++, left--) | ||
| 2218 | + e->short_options += (short_options - hol->short_options); | ||
| 2219 | + | ||
| 2220 | + /* Now add the short options from MORE, fixing up its entries | ||
| 2221 | + too. */ | ||
| 2222 | + so = short_options + hol_so_len; | ||
| 2223 | + more_so = more->short_options; | ||
| 2224 | + for (left = more->num_entries; left > 0; e++, left--) | ||
| 2225 | + { | ||
| 2226 | + int opts_left; | ||
| 2227 | + const struct argp_option *opt; | ||
| 2228 | + | ||
| 2229 | + e->short_options = so; | ||
| 2230 | + | ||
| 2231 | + for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--) | ||
| 2232 | + { | ||
| 2233 | + int ch = *more_so; | ||
| 2234 | + if (oshort (opt) && ch == opt->key) | ||
| 2235 | + /* The next short option in MORE_SO, CH, is from OPT. */ | ||
| 2236 | + { | ||
| 2237 | + if (! find_char (ch, short_options, | ||
| 2238 | + short_options + hol_so_len)) | ||
| 2239 | + /* The short option CH isn't shadowed by HOL's options, | ||
| 2240 | + so add it to the sum. */ | ||
| 2241 | + *so++ = ch; | ||
| 2242 | + more_so++; | ||
| 2243 | + } | ||
| 2244 | + } | ||
| 2245 | + } | ||
| 2246 | + | ||
| 2247 | + *so = '\0'; | ||
| 2248 | + | ||
| 2249 | + free (hol->entries); | ||
| 2250 | + free (hol->short_options); | ||
| 2251 | + | ||
| 2252 | + hol->entries = entries; | ||
| 2253 | + hol->num_entries = num_entries; | ||
| 2254 | + hol->short_options = short_options; | ||
| 2255 | + } | ||
| 2256 | + } | ||
| 2257 | + | ||
| 2258 | + hol_free (more); | ||
| 2259 | +} | ||
| 2260 | + | ||
| 2261 | +/* Inserts enough spaces to make sure STREAM is at column COL. */ | ||
| 2262 | +static void | ||
| 2263 | +indent_to (argp_fmtstream_t stream, unsigned col) | ||
| 2264 | +{ | ||
| 2265 | + int needed = col - __argp_fmtstream_point (stream); | ||
| 2266 | + while (needed-- > 0) | ||
| 2267 | + __argp_fmtstream_putc (stream, ' '); | ||
| 2268 | +} | ||
| 2269 | + | ||
| 2270 | +/* Output to STREAM either a space, or a newline if there isn't room for at | ||
| 2271 | + least ENSURE characters before the right margin. */ | ||
| 2272 | +static void | ||
| 2273 | +space (argp_fmtstream_t stream, size_t ensure) | ||
| 2274 | +{ | ||
| 2275 | + if (__argp_fmtstream_point (stream) + ensure | ||
| 2276 | + >= __argp_fmtstream_rmargin (stream)) | ||
| 2277 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2278 | + else | ||
| 2279 | + __argp_fmtstream_putc (stream, ' '); | ||
| 2280 | +} | ||
| 2281 | + | ||
| 2282 | +/* If the option REAL has an argument, we print it in using the printf | ||
| 2283 | + format REQ_FMT or OPT_FMT depending on whether it's a required or | ||
| 2284 | + optional argument. */ | ||
| 2285 | +static void | ||
| 2286 | +arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt, | ||
| 2287 | + const char *domain, argp_fmtstream_t stream) | ||
| 2288 | +{ | ||
| 2289 | + if (real->arg) | ||
| 2290 | + { | ||
| 2291 | + if (real->flags & OPTION_ARG_OPTIONAL) | ||
| 2292 | + __argp_fmtstream_printf (stream, opt_fmt, | ||
| 2293 | + dgettext (domain, real->arg)); | ||
| 2294 | + else | ||
| 2295 | + __argp_fmtstream_printf (stream, req_fmt, | ||
| 2296 | + dgettext (domain, real->arg)); | ||
| 2297 | + } | ||
| 2298 | +} | ||
| 2299 | + | ||
| 2300 | +/* Helper functions for hol_entry_help. */ | ||
| 2301 | + | ||
| 2302 | +/* State used during the execution of hol_help. */ | ||
| 2303 | +struct hol_help_state | ||
| 2304 | +{ | ||
| 2305 | + /* PREV_ENTRY should contain the previous entry printed, or 0. */ | ||
| 2306 | + struct hol_entry *prev_entry; | ||
| 2307 | + | ||
| 2308 | + /* If an entry is in a different group from the previous one, and SEP_GROUPS | ||
| 2309 | + is true, then a blank line will be printed before any output. */ | ||
| 2310 | + int sep_groups; | ||
| 2311 | + | ||
| 2312 | + /* True if a duplicate option argument was suppressed (only ever set if | ||
| 2313 | + UPARAMS.dup_args is false). */ | ||
| 2314 | + int suppressed_dup_arg; | ||
| 2315 | +}; | ||
| 2316 | + | ||
| 2317 | +/* Some state used while printing a help entry (used to communicate with | ||
| 2318 | + helper functions). See the doc for hol_entry_help for more info, as most | ||
| 2319 | + of the fields are copied from its arguments. */ | ||
| 2320 | +struct pentry_state | ||
| 2321 | +{ | ||
| 2322 | + const struct hol_entry *entry; | ||
| 2323 | + argp_fmtstream_t stream; | ||
| 2324 | + struct hol_help_state *hhstate; | ||
| 2325 | + | ||
| 2326 | + /* True if nothing's been printed so far. */ | ||
| 2327 | + int first; | ||
| 2328 | + | ||
| 2329 | + /* If non-zero, the state that was used to print this help. */ | ||
| 2330 | + const struct argp_state *state; | ||
| 2331 | +}; | ||
| 2332 | + | ||
| 2333 | +/* If a user doc filter should be applied to DOC, do so. */ | ||
| 2334 | +static const char * | ||
| 2335 | +filter_doc (const char *doc, int key, const struct argp *argp, | ||
| 2336 | + const struct argp_state *state) | ||
| 2337 | +{ | ||
| 2338 | + if (argp && argp->help_filter) | ||
| 2339 | + /* We must apply a user filter to this output. */ | ||
| 2340 | + { | ||
| 2341 | + void *input = __argp_input (argp, state); | ||
| 2342 | + return (*argp->help_filter) (key, doc, input); | ||
| 2343 | + } | ||
| 2344 | + else | ||
| 2345 | + /* No filter. */ | ||
| 2346 | + return doc; | ||
| 2347 | +} | ||
| 2348 | + | ||
| 2349 | +/* Prints STR as a header line, with the margin lines set appropiately, and | ||
| 2350 | + notes the fact that groups should be separated with a blank line. ARGP is | ||
| 2351 | + the argp that should dictate any user doc filtering to take place. Note | ||
| 2352 | + that the previous wrap margin isn't restored, but the left margin is reset | ||
| 2353 | + to 0. */ | ||
| 2354 | +static void | ||
| 2355 | +print_header (const char *str, const struct argp *argp, | ||
| 2356 | + struct pentry_state *pest) | ||
| 2357 | +{ | ||
| 2358 | + const char *tstr = dgettext (argp->argp_domain, str); | ||
| 2359 | + const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state); | ||
| 2360 | + | ||
| 2361 | + if (fstr) | ||
| 2362 | + { | ||
| 2363 | + if (*fstr) | ||
| 2364 | + { | ||
| 2365 | + if (pest->hhstate->prev_entry) | ||
| 2366 | + /* Precede with a blank line. */ | ||
| 2367 | + __argp_fmtstream_putc (pest->stream, '\n'); | ||
| 2368 | + indent_to (pest->stream, uparams.header_col); | ||
| 2369 | + __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col); | ||
| 2370 | + __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col); | ||
| 2371 | + __argp_fmtstream_puts (pest->stream, fstr); | ||
| 2372 | + __argp_fmtstream_set_lmargin (pest->stream, 0); | ||
| 2373 | + __argp_fmtstream_putc (pest->stream, '\n'); | ||
| 2374 | + } | ||
| 2375 | + | ||
| 2376 | + pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */ | ||
| 2377 | + } | ||
| 2378 | + | ||
| 2379 | + if (fstr != tstr) | ||
| 2380 | + free ((char *) fstr); | ||
| 2381 | +} | ||
| 2382 | + | ||
| 2383 | +/* Inserts a comma if this isn't the first item on the line, and then makes | ||
| 2384 | + sure we're at least to column COL. If this *is* the first item on a line, | ||
| 2385 | + prints any pending whitespace/headers that should precede this line. Also | ||
| 2386 | + clears FIRST. */ | ||
| 2387 | +static void | ||
| 2388 | +comma (unsigned col, struct pentry_state *pest) | ||
| 2389 | +{ | ||
| 2390 | + if (pest->first) | ||
| 2391 | + { | ||
| 2392 | + const struct hol_entry *pe = pest->hhstate->prev_entry; | ||
| 2393 | + const struct hol_cluster *cl = pest->entry->cluster; | ||
| 2394 | + | ||
| 2395 | + if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) | ||
| 2396 | + __argp_fmtstream_putc (pest->stream, '\n'); | ||
| 2397 | + | ||
| 2398 | + if (cl && cl->header && *cl->header | ||
| 2399 | + && (!pe | ||
| 2400 | + || (pe->cluster != cl | ||
| 2401 | + && !hol_cluster_is_child (pe->cluster, cl)))) | ||
| 2402 | + /* If we're changing clusters, then this must be the start of the | ||
| 2403 | + ENTRY's cluster unless that is an ancestor of the previous one | ||
| 2404 | + (in which case we had just popped into a sub-cluster for a bit). | ||
| 2405 | + If so, then print the cluster's header line. */ | ||
| 2406 | + { | ||
| 2407 | + int old_wm = __argp_fmtstream_wmargin (pest->stream); | ||
| 2408 | + print_header (cl->header, cl->argp, pest); | ||
| 2409 | + __argp_fmtstream_set_wmargin (pest->stream, old_wm); | ||
| 2410 | + } | ||
| 2411 | + | ||
| 2412 | + pest->first = 0; | ||
| 2413 | + } | ||
| 2414 | + else | ||
| 2415 | + __argp_fmtstream_puts (pest->stream, ", "); | ||
| 2416 | + | ||
| 2417 | + indent_to (pest->stream, col); | ||
| 2418 | +} | ||
| 2419 | + | ||
| 2420 | +/* Print help for ENTRY to STREAM. */ | ||
| 2421 | +static void | ||
| 2422 | +hol_entry_help (struct hol_entry *entry, const struct argp_state *state, | ||
| 2423 | + argp_fmtstream_t stream, struct hol_help_state *hhstate) | ||
| 2424 | +{ | ||
| 2425 | + unsigned num; | ||
| 2426 | + const struct argp_option *real = entry->opt, *opt; | ||
| 2427 | + char *so = entry->short_options; | ||
| 2428 | + int have_long_opt = 0; /* We have any long options. */ | ||
| 2429 | + /* Saved margins. */ | ||
| 2430 | + int old_lm = __argp_fmtstream_set_lmargin (stream, 0); | ||
| 2431 | + int old_wm = __argp_fmtstream_wmargin (stream); | ||
| 2432 | + /* PEST is a state block holding some of our variables that we'd like to | ||
| 2433 | + share with helper functions. */ | ||
| 2434 | + struct pentry_state pest = { entry, stream, hhstate, 1, state }; | ||
| 2435 | + | ||
| 2436 | + if (! odoc (real)) | ||
| 2437 | + for (opt = real, num = entry->num; num > 0; opt++, num--) | ||
| 2438 | + if (opt->name && ovisible (opt)) | ||
| 2439 | + { | ||
| 2440 | + have_long_opt = 1; | ||
| 2441 | + break; | ||
| 2442 | + } | ||
| 2443 | + | ||
| 2444 | + /* First emit short options. */ | ||
| 2445 | + __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */ | ||
| 2446 | + for (opt = real, num = entry->num; num > 0; opt++, num--) | ||
| 2447 | + if (oshort (opt) && opt->key == *so) | ||
| 2448 | + /* OPT has a valid (non shadowed) short option. */ | ||
| 2449 | + { | ||
| 2450 | + if (ovisible (opt)) | ||
| 2451 | + { | ||
| 2452 | + comma (uparams.short_opt_col, &pest); | ||
| 2453 | + __argp_fmtstream_putc (stream, '-'); | ||
| 2454 | + __argp_fmtstream_putc (stream, *so); | ||
| 2455 | + if (!have_long_opt || uparams.dup_args) | ||
| 2456 | + arg (real, " %s", "[%s]", | ||
| 2457 | + state == NULL ? NULL : state->root_argp->argp_domain, | ||
| 2458 | + stream); | ||
| 2459 | + else if (real->arg) | ||
| 2460 | + hhstate->suppressed_dup_arg = 1; | ||
| 2461 | + } | ||
| 2462 | + so++; | ||
| 2463 | + } | ||
| 2464 | + | ||
| 2465 | + /* Now, long options. */ | ||
| 2466 | + if (odoc (real)) | ||
| 2467 | + /* A `documentation' option. */ | ||
| 2468 | + { | ||
| 2469 | + __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col); | ||
| 2470 | + for (opt = real, num = entry->num; num > 0; opt++, num--) | ||
| 2471 | + if (opt->name && ovisible (opt)) | ||
| 2472 | + { | ||
| 2473 | + comma (uparams.doc_opt_col, &pest); | ||
| 2474 | + /* Calling gettext here isn't quite right, since sorting will | ||
| 2475 | + have been done on the original; but documentation options | ||
| 2476 | + should be pretty rare anyway... */ | ||
| 2477 | + __argp_fmtstream_puts (stream, | ||
| 2478 | + dgettext (state == NULL ? NULL | ||
| 2479 | + : state->root_argp->argp_domain, | ||
| 2480 | + opt->name)); | ||
| 2481 | + } | ||
| 2482 | + } | ||
| 2483 | + else | ||
| 2484 | + /* A real long option. */ | ||
| 2485 | + { | ||
| 2486 | + __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col); | ||
| 2487 | + for (opt = real, num = entry->num; num > 0; opt++, num--) | ||
| 2488 | + if (opt->name && ovisible (opt)) | ||
| 2489 | + { | ||
| 2490 | + comma (uparams.long_opt_col, &pest); | ||
| 2491 | + __argp_fmtstream_printf (stream, "--%s", opt->name); | ||
| 2492 | + arg (real, "=%s", "[=%s]", | ||
| 2493 | + state == NULL ? NULL : state->root_argp->argp_domain, stream); | ||
| 2494 | + } | ||
| 2495 | + } | ||
| 2496 | + | ||
| 2497 | + /* Next, documentation strings. */ | ||
| 2498 | + __argp_fmtstream_set_lmargin (stream, 0); | ||
| 2499 | + | ||
| 2500 | + if (pest.first) | ||
| 2501 | + { | ||
| 2502 | + /* Didn't print any switches, what's up? */ | ||
| 2503 | + if (!oshort (real) && !real->name) | ||
| 2504 | + /* This is a group header, print it nicely. */ | ||
| 2505 | + print_header (real->doc, entry->argp, &pest); | ||
| 2506 | + else | ||
| 2507 | + /* Just a totally shadowed option or null header; print nothing. */ | ||
| 2508 | + goto cleanup; /* Just return, after cleaning up. */ | ||
| 2509 | + } | ||
| 2510 | + else | ||
| 2511 | + { | ||
| 2512 | + const char *tstr = real->doc ? dgettext (state == NULL ? NULL | ||
| 2513 | + : state->root_argp->argp_domain, | ||
| 2514 | + real->doc) : 0; | ||
| 2515 | + const char *fstr = filter_doc (tstr, real->key, entry->argp, state); | ||
| 2516 | + if (fstr && *fstr) | ||
| 2517 | + { | ||
| 2518 | + unsigned int col = __argp_fmtstream_point (stream); | ||
| 2519 | + | ||
| 2520 | + __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col); | ||
| 2521 | + __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col); | ||
| 2522 | + | ||
| 2523 | + if (col > (unsigned int) (uparams.opt_doc_col + 3)) | ||
| 2524 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2525 | + else if (col >= (unsigned int) uparams.opt_doc_col) | ||
| 2526 | + __argp_fmtstream_puts (stream, " "); | ||
| 2527 | + else | ||
| 2528 | + indent_to (stream, uparams.opt_doc_col); | ||
| 2529 | + | ||
| 2530 | + __argp_fmtstream_puts (stream, fstr); | ||
| 2531 | + } | ||
| 2532 | + if (fstr && fstr != tstr) | ||
| 2533 | + free ((char *) fstr); | ||
| 2534 | + | ||
| 2535 | + /* Reset the left margin. */ | ||
| 2536 | + __argp_fmtstream_set_lmargin (stream, 0); | ||
| 2537 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2538 | + } | ||
| 2539 | + | ||
| 2540 | + hhstate->prev_entry = entry; | ||
| 2541 | + | ||
| 2542 | +cleanup: | ||
| 2543 | + __argp_fmtstream_set_lmargin (stream, old_lm); | ||
| 2544 | + __argp_fmtstream_set_wmargin (stream, old_wm); | ||
| 2545 | +} | ||
| 2546 | + | ||
| 2547 | +/* Output a long help message about the options in HOL to STREAM. */ | ||
| 2548 | +static void | ||
| 2549 | +hol_help (struct hol *hol, const struct argp_state *state, | ||
| 2550 | + argp_fmtstream_t stream) | ||
| 2551 | +{ | ||
| 2552 | + unsigned num; | ||
| 2553 | + struct hol_entry *entry; | ||
| 2554 | + struct hol_help_state hhstate = { 0, 0, 0 }; | ||
| 2555 | + | ||
| 2556 | + for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--) | ||
| 2557 | + hol_entry_help (entry, state, stream, &hhstate); | ||
| 2558 | + | ||
| 2559 | + if (hhstate.suppressed_dup_arg && uparams.dup_args_note) | ||
| 2560 | + { | ||
| 2561 | + const char *tstr = dgettext (state == NULL ? NULL | ||
| 2562 | + : state->root_argp->argp_domain, "\ | ||
| 2563 | +Mandatory or optional arguments to long options are also mandatory or \ | ||
| 2564 | +optional for any corresponding short options."); | ||
| 2565 | + const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, | ||
| 2566 | + state ? state->root_argp : 0, state); | ||
| 2567 | + if (fstr && *fstr) | ||
| 2568 | + { | ||
| 2569 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2570 | + __argp_fmtstream_puts (stream, fstr); | ||
| 2571 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2572 | + } | ||
| 2573 | + if (fstr && fstr != tstr) | ||
| 2574 | + free ((char *) fstr); | ||
| 2575 | + } | ||
| 2576 | +} | ||
| 2577 | + | ||
| 2578 | +/* Helper functions for hol_usage. */ | ||
| 2579 | + | ||
| 2580 | +/* If OPT is a short option without an arg, append its key to the string | ||
| 2581 | + pointer pointer to by COOKIE, and advance the pointer. */ | ||
| 2582 | +static int | ||
| 2583 | +add_argless_short_opt (const struct argp_option *opt, | ||
| 2584 | + const struct argp_option *real, | ||
| 2585 | + const char *domain, void *cookie) | ||
| 2586 | +{ | ||
| 2587 | + char **snao_end = cookie; | ||
| 2588 | + if (!(opt->arg || real->arg) | ||
| 2589 | + && !((opt->flags | real->flags) & OPTION_NO_USAGE)) | ||
| 2590 | + *(*snao_end)++ = opt->key; | ||
| 2591 | + return 0; | ||
| 2592 | +} | ||
| 2593 | + | ||
| 2594 | +/* If OPT is a short option with an arg, output a usage entry for it to the | ||
| 2595 | + stream pointed at by COOKIE. */ | ||
| 2596 | +static int | ||
| 2597 | +usage_argful_short_opt (const struct argp_option *opt, | ||
| 2598 | + const struct argp_option *real, | ||
| 2599 | + const char *domain, void *cookie) | ||
| 2600 | +{ | ||
| 2601 | + argp_fmtstream_t stream = cookie; | ||
| 2602 | + const char *arg = opt->arg; | ||
| 2603 | + int flags = opt->flags | real->flags; | ||
| 2604 | + | ||
| 2605 | + if (! arg) | ||
| 2606 | + arg = real->arg; | ||
| 2607 | + | ||
| 2608 | + if (arg && !(flags & OPTION_NO_USAGE)) | ||
| 2609 | + { | ||
| 2610 | + arg = dgettext (domain, arg); | ||
| 2611 | + | ||
| 2612 | + if (flags & OPTION_ARG_OPTIONAL) | ||
| 2613 | + __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); | ||
| 2614 | + else | ||
| 2615 | + { | ||
| 2616 | + /* Manually do line wrapping so that it (probably) won't | ||
| 2617 | + get wrapped at the embedded space. */ | ||
| 2618 | + space (stream, 6 + strlen (arg)); | ||
| 2619 | + __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); | ||
| 2620 | + } | ||
| 2621 | + } | ||
| 2622 | + | ||
| 2623 | + return 0; | ||
| 2624 | +} | ||
| 2625 | + | ||
| 2626 | +/* Output a usage entry for the long option opt to the stream pointed at by | ||
| 2627 | + COOKIE. */ | ||
| 2628 | +static int | ||
| 2629 | +usage_long_opt (const struct argp_option *opt, | ||
| 2630 | + const struct argp_option *real, | ||
| 2631 | + const char *domain, void *cookie) | ||
| 2632 | +{ | ||
| 2633 | + argp_fmtstream_t stream = cookie; | ||
| 2634 | + const char *arg = opt->arg; | ||
| 2635 | + int flags = opt->flags | real->flags; | ||
| 2636 | + | ||
| 2637 | + if (! arg) | ||
| 2638 | + arg = real->arg; | ||
| 2639 | + | ||
| 2640 | + if (! (flags & OPTION_NO_USAGE)) | ||
| 2641 | + { | ||
| 2642 | + if (arg) | ||
| 2643 | + { | ||
| 2644 | + arg = dgettext (domain, arg); | ||
| 2645 | + if (flags & OPTION_ARG_OPTIONAL) | ||
| 2646 | + __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); | ||
| 2647 | + else | ||
| 2648 | + __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); | ||
| 2649 | + } | ||
| 2650 | + else | ||
| 2651 | + __argp_fmtstream_printf (stream, " [--%s]", opt->name); | ||
| 2652 | + } | ||
| 2653 | + | ||
| 2654 | + return 0; | ||
| 2655 | +} | ||
| 2656 | + | ||
| 2657 | +/* Print a short usage description for the arguments in HOL to STREAM. */ | ||
| 2658 | +static void | ||
| 2659 | +hol_usage (struct hol *hol, argp_fmtstream_t stream) | ||
| 2660 | +{ | ||
| 2661 | + if (hol->num_entries > 0) | ||
| 2662 | + { | ||
| 2663 | + unsigned nentries; | ||
| 2664 | + struct hol_entry *entry; | ||
| 2665 | + char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1); | ||
| 2666 | + char *snao_end = short_no_arg_opts; | ||
| 2667 | + | ||
| 2668 | + /* First we put a list of short options without arguments. */ | ||
| 2669 | + for (entry = hol->entries, nentries = hol->num_entries | ||
| 2670 | + ; nentries > 0 | ||
| 2671 | + ; entry++, nentries--) | ||
| 2672 | + hol_entry_short_iterate (entry, add_argless_short_opt, | ||
| 2673 | + entry->argp->argp_domain, &snao_end); | ||
| 2674 | + if (snao_end > short_no_arg_opts) | ||
| 2675 | + { | ||
| 2676 | + *snao_end++ = 0; | ||
| 2677 | + __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); | ||
| 2678 | + } | ||
| 2679 | + | ||
| 2680 | + /* Now a list of short options *with* arguments. */ | ||
| 2681 | + for (entry = hol->entries, nentries = hol->num_entries | ||
| 2682 | + ; nentries > 0 | ||
| 2683 | + ; entry++, nentries--) | ||
| 2684 | + hol_entry_short_iterate (entry, usage_argful_short_opt, | ||
| 2685 | + entry->argp->argp_domain, stream); | ||
| 2686 | + | ||
| 2687 | + /* Finally, a list of long options (whew!). */ | ||
| 2688 | + for (entry = hol->entries, nentries = hol->num_entries | ||
| 2689 | + ; nentries > 0 | ||
| 2690 | + ; entry++, nentries--) | ||
| 2691 | + hol_entry_long_iterate (entry, usage_long_opt, | ||
| 2692 | + entry->argp->argp_domain, stream); | ||
| 2693 | + } | ||
| 2694 | +} | ||
| 2695 | + | ||
| 2696 | +/* Make a HOL containing all levels of options in ARGP. CLUSTER is the | ||
| 2697 | + cluster in which ARGP's entries should be clustered, or 0. */ | ||
| 2698 | +static struct hol * | ||
| 2699 | +argp_hol (const struct argp *argp, struct hol_cluster *cluster) | ||
| 2700 | +{ | ||
| 2701 | + const struct argp_child *child = argp->children; | ||
| 2702 | + struct hol *hol = make_hol (argp, cluster); | ||
| 2703 | + if (child) | ||
| 2704 | + while (child->argp) | ||
| 2705 | + { | ||
| 2706 | + struct hol_cluster *child_cluster = | ||
| 2707 | + ((child->group || child->header) | ||
| 2708 | + /* Put CHILD->argp within its own cluster. */ | ||
| 2709 | + ? hol_add_cluster (hol, child->group, child->header, | ||
| 2710 | + child - argp->children, cluster, argp) | ||
| 2711 | + /* Just merge it into the parent's cluster. */ | ||
| 2712 | + : cluster); | ||
| 2713 | + hol_append (hol, argp_hol (child->argp, child_cluster)) ; | ||
| 2714 | + child++; | ||
| 2715 | + } | ||
| 2716 | + return hol; | ||
| 2717 | +} | ||
| 2718 | + | ||
| 2719 | +/* Calculate how many different levels with alternative args strings exist in | ||
| 2720 | + ARGP. */ | ||
| 2721 | +static size_t | ||
| 2722 | +argp_args_levels (const struct argp *argp) | ||
| 2723 | +{ | ||
| 2724 | + size_t levels = 0; | ||
| 2725 | + const struct argp_child *child = argp->children; | ||
| 2726 | + | ||
| 2727 | + if (argp->args_doc && strchr (argp->args_doc, '\n')) | ||
| 2728 | + levels++; | ||
| 2729 | + | ||
| 2730 | + if (child) | ||
| 2731 | + while (child->argp) | ||
| 2732 | + levels += argp_args_levels ((child++)->argp); | ||
| 2733 | + | ||
| 2734 | + return levels; | ||
| 2735 | +} | ||
| 2736 | + | ||
| 2737 | +/* Print all the non-option args documented in ARGP to STREAM. Any output is | ||
| 2738 | + preceded by a space. LEVELS is a pointer to a byte vector the length | ||
| 2739 | + returned by argp_args_levels; it should be initialized to zero, and | ||
| 2740 | + updated by this routine for the next call if ADVANCE is true. True is | ||
| 2741 | + returned as long as there are more patterns to output. */ | ||
| 2742 | +static int | ||
| 2743 | +argp_args_usage (const struct argp *argp, const struct argp_state *state, | ||
| 2744 | + char **levels, int advance, argp_fmtstream_t stream) | ||
| 2745 | +{ | ||
| 2746 | + char *our_level = *levels; | ||
| 2747 | + int multiple = 0; | ||
| 2748 | + const struct argp_child *child = argp->children; | ||
| 2749 | + const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0; | ||
| 2750 | + const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state); | ||
| 2751 | + | ||
| 2752 | + if (fdoc) | ||
| 2753 | + { | ||
| 2754 | + const char *cp = fdoc; | ||
| 2755 | + nl = strchrnul (cp, '\n'); | ||
| 2756 | + if (*nl != '\0') | ||
| 2757 | + /* This is a `multi-level' args doc; advance to the correct position | ||
| 2758 | + as determined by our state in LEVELS, and update LEVELS. */ | ||
| 2759 | + { | ||
| 2760 | + int i; | ||
| 2761 | + multiple = 1; | ||
| 2762 | + for (i = 0; i < *our_level; i++) | ||
| 2763 | + cp = nl + 1, nl = strchrnul (cp, '\n'); | ||
| 2764 | + (*levels)++; | ||
| 2765 | + } | ||
| 2766 | + | ||
| 2767 | + /* Manually do line wrapping so that it (probably) won't get wrapped at | ||
| 2768 | + any embedded spaces. */ | ||
| 2769 | + space (stream, 1 + nl - cp); | ||
| 2770 | + | ||
| 2771 | + __argp_fmtstream_write (stream, cp, nl - cp); | ||
| 2772 | + } | ||
| 2773 | + if (fdoc && fdoc != tdoc) | ||
| 2774 | + free ((char *)fdoc); /* Free user's modified doc string. */ | ||
| 2775 | + | ||
| 2776 | + if (child) | ||
| 2777 | + while (child->argp) | ||
| 2778 | + advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream); | ||
| 2779 | + | ||
| 2780 | + if (advance && multiple) | ||
| 2781 | + { | ||
| 2782 | + /* Need to increment our level. */ | ||
| 2783 | + if (*nl) | ||
| 2784 | + /* There's more we can do here. */ | ||
| 2785 | + { | ||
| 2786 | + (*our_level)++; | ||
| 2787 | + advance = 0; /* Our parent shouldn't advance also. */ | ||
| 2788 | + } | ||
| 2789 | + else if (*our_level > 0) | ||
| 2790 | + /* We had multiple levels, but used them up; reset to zero. */ | ||
| 2791 | + *our_level = 0; | ||
| 2792 | + } | ||
| 2793 | + | ||
| 2794 | + return !advance; | ||
| 2795 | +} | ||
| 2796 | + | ||
| 2797 | +/* Print the documentation for ARGP to STREAM; if POST is false, then | ||
| 2798 | + everything preceeding a `\v' character in the documentation strings (or | ||
| 2799 | + the whole string, for those with none) is printed, otherwise, everything | ||
| 2800 | + following the `\v' character (nothing for strings without). Each separate | ||
| 2801 | + bit of documentation is separated a blank line, and if PRE_BLANK is true, | ||
| 2802 | + then the first is as well. If FIRST_ONLY is true, only the first | ||
| 2803 | + occurrence is output. Returns true if anything was output. */ | ||
| 2804 | +static int | ||
| 2805 | +argp_doc (const struct argp *argp, const struct argp_state *state, | ||
| 2806 | + int post, int pre_blank, int first_only, | ||
| 2807 | + argp_fmtstream_t stream) | ||
| 2808 | +{ | ||
| 2809 | + const char *text; | ||
| 2810 | + const char *inp_text; | ||
| 2811 | + void *input = 0; | ||
| 2812 | + int anything = 0; | ||
| 2813 | + size_t inp_text_limit = 0; | ||
| 2814 | + const char *doc = dgettext (argp->argp_domain, argp->doc); | ||
| 2815 | + const struct argp_child *child = argp->children; | ||
| 2816 | + | ||
| 2817 | + if (doc) | ||
| 2818 | + { | ||
| 2819 | + char *vt = strchr (doc, '\v'); | ||
| 2820 | + inp_text = post ? (vt ? vt + 1 : 0) : doc; | ||
| 2821 | + inp_text_limit = (!post && vt) ? (vt - doc) : 0; | ||
| 2822 | + } | ||
| 2823 | + else | ||
| 2824 | + inp_text = 0; | ||
| 2825 | + | ||
| 2826 | + if (argp->help_filter) | ||
| 2827 | + /* We have to filter the doc strings. */ | ||
| 2828 | + { | ||
| 2829 | + if (inp_text_limit) | ||
| 2830 | + /* Copy INP_TEXT so that it's nul-terminated. */ | ||
| 2831 | + inp_text = strndup (inp_text, inp_text_limit); | ||
| 2832 | + input = __argp_input (argp, state); | ||
| 2833 | + text = | ||
| 2834 | + (*argp->help_filter) (post | ||
| 2835 | + ? ARGP_KEY_HELP_POST_DOC | ||
| 2836 | + : ARGP_KEY_HELP_PRE_DOC, | ||
| 2837 | + inp_text, input); | ||
| 2838 | + } | ||
| 2839 | + else | ||
| 2840 | + text = (const char *) inp_text; | ||
| 2841 | + | ||
| 2842 | + if (text) | ||
| 2843 | + { | ||
| 2844 | + if (pre_blank) | ||
| 2845 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2846 | + | ||
| 2847 | + if (text == inp_text && inp_text_limit) | ||
| 2848 | + __argp_fmtstream_write (stream, inp_text, inp_text_limit); | ||
| 2849 | + else | ||
| 2850 | + __argp_fmtstream_puts (stream, text); | ||
| 2851 | + | ||
| 2852 | + if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) | ||
| 2853 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2854 | + | ||
| 2855 | + anything = 1; | ||
| 2856 | + } | ||
| 2857 | + | ||
| 2858 | + if (text && text != inp_text) | ||
| 2859 | + free ((char *) text); /* Free TEXT returned from the help filter. */ | ||
| 2860 | + if (inp_text && inp_text_limit && argp->help_filter) | ||
| 2861 | + free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ | ||
| 2862 | + | ||
| 2863 | + if (post && argp->help_filter) | ||
| 2864 | + /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ | ||
| 2865 | + { | ||
| 2866 | + text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); | ||
| 2867 | + if (text) | ||
| 2868 | + { | ||
| 2869 | + if (anything || pre_blank) | ||
| 2870 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2871 | + __argp_fmtstream_puts (stream, text); | ||
| 2872 | + free ((char *) text); | ||
| 2873 | + if (__argp_fmtstream_point (stream) | ||
| 2874 | + > __argp_fmtstream_lmargin (stream)) | ||
| 2875 | + __argp_fmtstream_putc (stream, '\n'); | ||
| 2876 | + anything = 1; | ||
| 2877 | + } | ||
| 2878 | + } | ||
| 2879 | + | ||
| 2880 | + if (child) | ||
| 2881 | + while (child->argp && !(first_only && anything)) | ||
| 2882 | + anything |= | ||
| 2883 | + argp_doc ((child++)->argp, state, | ||
| 2884 | + post, anything || pre_blank, first_only, | ||
| 2885 | + stream); | ||
| 2886 | + | ||
| 2887 | + return anything; | ||
| 2888 | +} | ||
| 2889 | + | ||
| 2890 | +/* Output a usage message for ARGP to STREAM. If called from | ||
| 2891 | + argp_state_help, STATE is the relevent parsing state. FLAGS are from the | ||
| 2892 | + set ARGP_HELP_*. NAME is what to use wherever a `program name' is | ||
| 2893 | + needed. */ | ||
| 2894 | +static void | ||
| 2895 | +_help (const struct argp *argp, const struct argp_state *state, FILE *stream, | ||
| 2896 | + unsigned flags, char *name) | ||
| 2897 | +{ | ||
| 2898 | + int anything = 0; /* Whether we've output anything. */ | ||
| 2899 | + struct hol *hol = 0; | ||
| 2900 | + argp_fmtstream_t fs; | ||
| 2901 | + | ||
| 2902 | + if (! stream) | ||
| 2903 | + return; | ||
| 2904 | + | ||
| 2905 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 2906 | + flockfile (stream); | ||
| 2907 | +#endif | ||
| 2908 | + | ||
| 2909 | + fill_in_uparams (state); | ||
| 2910 | + | ||
| 2911 | + fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0); | ||
| 2912 | + if (! fs) | ||
| 2913 | + { | ||
| 2914 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 2915 | + funlockfile (stream); | ||
| 2916 | +#endif | ||
| 2917 | + return; | ||
| 2918 | + } | ||
| 2919 | + | ||
| 2920 | + if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG)) | ||
| 2921 | + { | ||
| 2922 | + hol = argp_hol (argp, 0); | ||
| 2923 | + | ||
| 2924 | + /* If present, these options always come last. */ | ||
| 2925 | + hol_set_group (hol, "help", -1); | ||
| 2926 | + hol_set_group (hol, "version", -1); | ||
| 2927 | + | ||
| 2928 | + hol_sort (hol); | ||
| 2929 | + } | ||
| 2930 | + | ||
| 2931 | + if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE)) | ||
| 2932 | + /* Print a short `Usage:' message. */ | ||
| 2933 | + { | ||
| 2934 | + int first_pattern = 1, more_patterns; | ||
| 2935 | + size_t num_pattern_levels = argp_args_levels (argp); | ||
| 2936 | + char *pattern_levels = alloca (num_pattern_levels); | ||
| 2937 | + | ||
| 2938 | + memset (pattern_levels, 0, num_pattern_levels); | ||
| 2939 | + | ||
| 2940 | + do | ||
| 2941 | + { | ||
| 2942 | + int old_lm; | ||
| 2943 | + int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent); | ||
| 2944 | + char *levels = pattern_levels; | ||
| 2945 | + | ||
| 2946 | + if (first_pattern) | ||
| 2947 | + __argp_fmtstream_printf (fs, "%s %s", | ||
| 2948 | + dgettext (argp->argp_domain, "Usage:"), | ||
| 2949 | + name); | ||
| 2950 | + else | ||
| 2951 | + __argp_fmtstream_printf (fs, "%s %s", | ||
| 2952 | + dgettext (argp->argp_domain, " or: "), | ||
| 2953 | + name); | ||
| 2954 | + | ||
| 2955 | + /* We set the lmargin as well as the wmargin, because hol_usage | ||
| 2956 | + manually wraps options with newline to avoid annoying breaks. */ | ||
| 2957 | + old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent); | ||
| 2958 | + | ||
| 2959 | + if (flags & ARGP_HELP_SHORT_USAGE) | ||
| 2960 | + /* Just show where the options go. */ | ||
| 2961 | + { | ||
| 2962 | + if (hol->num_entries > 0) | ||
| 2963 | + __argp_fmtstream_puts (fs, dgettext (argp->argp_domain, | ||
| 2964 | + " [OPTION...]")); | ||
| 2965 | + } | ||
| 2966 | + else | ||
| 2967 | + /* Actually print the options. */ | ||
| 2968 | + { | ||
| 2969 | + hol_usage (hol, fs); | ||
| 2970 | + flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ | ||
| 2971 | + } | ||
| 2972 | + | ||
| 2973 | + more_patterns = argp_args_usage (argp, state, &levels, 1, fs); | ||
| 2974 | + | ||
| 2975 | + __argp_fmtstream_set_wmargin (fs, old_wm); | ||
| 2976 | + __argp_fmtstream_set_lmargin (fs, old_lm); | ||
| 2977 | + | ||
| 2978 | + __argp_fmtstream_putc (fs, '\n'); | ||
| 2979 | + anything = 1; | ||
| 2980 | + | ||
| 2981 | + first_pattern = 0; | ||
| 2982 | + } | ||
| 2983 | + while (more_patterns); | ||
| 2984 | + } | ||
| 2985 | + | ||
| 2986 | + if (flags & ARGP_HELP_PRE_DOC) | ||
| 2987 | + anything |= argp_doc (argp, state, 0, 0, 1, fs); | ||
| 2988 | + | ||
| 2989 | + if (flags & ARGP_HELP_SEE) | ||
| 2990 | + { | ||
| 2991 | + __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\ | ||
| 2992 | +Try `%s --help' or `%s --usage' for more information.\n"), | ||
| 2993 | + name, name); | ||
| 2994 | + anything = 1; | ||
| 2995 | + } | ||
| 2996 | + | ||
| 2997 | + if (flags & ARGP_HELP_LONG) | ||
| 2998 | + /* Print a long, detailed help message. */ | ||
| 2999 | + { | ||
| 3000 | + /* Print info about all the options. */ | ||
| 3001 | + if (hol->num_entries > 0) | ||
| 3002 | + { | ||
| 3003 | + if (anything) | ||
| 3004 | + __argp_fmtstream_putc (fs, '\n'); | ||
| 3005 | + hol_help (hol, state, fs); | ||
| 3006 | + anything = 1; | ||
| 3007 | + } | ||
| 3008 | + } | ||
| 3009 | + | ||
| 3010 | + if (flags & ARGP_HELP_POST_DOC) | ||
| 3011 | + /* Print any documentation strings at the end. */ | ||
| 3012 | + anything |= argp_doc (argp, state, 1, anything, 0, fs); | ||
| 3013 | + | ||
| 3014 | + if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address) | ||
| 3015 | + { | ||
| 3016 | + if (anything) | ||
| 3017 | + __argp_fmtstream_putc (fs, '\n'); | ||
| 3018 | + __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, | ||
| 3019 | + "Report bugs to %s.\n"), | ||
| 3020 | + argp_program_bug_address); | ||
| 3021 | + anything = 1; | ||
| 3022 | + } | ||
| 3023 | + | ||
| 3024 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 3025 | + funlockfile (stream); | ||
| 3026 | +#endif | ||
| 3027 | + | ||
| 3028 | + if (hol) | ||
| 3029 | + hol_free (hol); | ||
| 3030 | + | ||
| 3031 | + __argp_fmtstream_free (fs); | ||
| 3032 | +} | ||
| 3033 | + | ||
| 3034 | +/* Output a usage message for ARGP to STREAM. FLAGS are from the set | ||
| 3035 | + ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ | ||
| 3036 | +void argp_help (const struct argp *argp, FILE *stream, | ||
| 3037 | + unsigned flags, char *name) | ||
| 3038 | +{ | ||
| 3039 | + _help (argp, 0, stream, flags, name); | ||
| 3040 | +} | ||
| 3041 | + | ||
| 3042 | +char * | ||
| 3043 | +__argp_short_program_name (void) | ||
| 3044 | +{ | ||
| 3045 | +# ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ | ||
| 3046 | +/* | ||
| 3047 | + * uClibc provides both program_invocation_name and | ||
| 3048 | + * program_invocation_short_name | ||
| 3049 | + */ | ||
| 3050 | + return (char *) program_invocation_short_name; | ||
| 3051 | +# else | ||
| 3052 | + /* FIXME: What now? Miles suggests that it is better to use NULL, | ||
| 3053 | + but currently the value is passed on directly to fputs_unlocked, | ||
| 3054 | + so that requires more changes. */ | ||
| 3055 | +# if __GNUC__ | ||
| 3056 | +# warning No reasonable value to return | ||
| 3057 | +# endif /* __GNUC__ */ | ||
| 3058 | + return ""; | ||
| 3059 | +# endif | ||
| 3060 | +} | ||
| 3061 | + | ||
| 3062 | +/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are | ||
| 3063 | + from the set ARGP_HELP_*. */ | ||
| 3064 | +void | ||
| 3065 | +argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags) | ||
| 3066 | +{ | ||
| 3067 | + if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream) | ||
| 3068 | + { | ||
| 3069 | + if (state && (state->flags & ARGP_LONG_ONLY)) | ||
| 3070 | + flags |= ARGP_HELP_LONG_ONLY; | ||
| 3071 | + | ||
| 3072 | + _help (state ? state->root_argp : 0, state, stream, flags, | ||
| 3073 | + state ? state->name : __argp_short_program_name ()); | ||
| 3074 | + | ||
| 3075 | + if (!state || ! (state->flags & ARGP_NO_EXIT)) | ||
| 3076 | + { | ||
| 3077 | + if (flags & ARGP_HELP_EXIT_ERR) | ||
| 3078 | + exit (argp_err_exit_status); | ||
| 3079 | + if (flags & ARGP_HELP_EXIT_OK) | ||
| 3080 | + exit (0); | ||
| 3081 | + } | ||
| 3082 | + } | ||
| 3083 | +} | ||
| 3084 | + | ||
| 3085 | +/* If appropriate, print the printf string FMT and following args, preceded | ||
| 3086 | + by the program name and `:', to stderr, and followed by a `Try ... --help' | ||
| 3087 | + message, then exit (1). */ | ||
| 3088 | +void | ||
| 3089 | +argp_error (const struct argp_state *state, const char *fmt, ...) | ||
| 3090 | +{ | ||
| 3091 | + if (!state || !(state->flags & ARGP_NO_ERRS)) | ||
| 3092 | + { | ||
| 3093 | + FILE *stream = state ? state->err_stream : stderr; | ||
| 3094 | + | ||
| 3095 | + if (stream) | ||
| 3096 | + { | ||
| 3097 | + va_list ap; | ||
| 3098 | + | ||
| 3099 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 3100 | + flockfile (stream); | ||
| 3101 | +#endif | ||
| 3102 | + | ||
| 3103 | + va_start (ap, fmt); | ||
| 3104 | + | ||
| 3105 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 3106 | + char *buf; | ||
| 3107 | + | ||
| 3108 | + if (_IO_vasprintf (&buf, fmt, ap) < 0) | ||
| 3109 | + buf = NULL; | ||
| 3110 | + | ||
| 3111 | + __fxprintf (stream, "%s: %s\n", | ||
| 3112 | + state ? state->name : __argp_short_program_name (), buf); | ||
| 3113 | + | ||
| 3114 | + free (buf); | ||
| 3115 | +#else | ||
| 3116 | + fputs_unlocked (state ? state->name : __argp_short_program_name (), | ||
| 3117 | + stream); | ||
| 3118 | + putc_unlocked (':', stream); | ||
| 3119 | + putc_unlocked (' ', stream); | ||
| 3120 | + | ||
| 3121 | + vfprintf (stream, fmt, ap); | ||
| 3122 | + | ||
| 3123 | + putc_unlocked ('\n', stream); | ||
| 3124 | +#endif | ||
| 3125 | + | ||
| 3126 | + argp_state_help (state, stream, ARGP_HELP_STD_ERR); | ||
| 3127 | + | ||
| 3128 | + va_end (ap); | ||
| 3129 | + | ||
| 3130 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 3131 | + funlockfile (stream); | ||
| 3132 | +#endif | ||
| 3133 | + } | ||
| 3134 | + } | ||
| 3135 | +} | ||
| 3136 | + | ||
| 3137 | +/* Similar to the standard gnu error-reporting function error(), but will | ||
| 3138 | + respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print | ||
| 3139 | + to STATE->err_stream. This is useful for argument parsing code that is | ||
| 3140 | + shared between program startup (when exiting is desired) and runtime | ||
| 3141 | + option parsing (when typically an error code is returned instead). The | ||
| 3142 | + difference between this function and argp_error is that the latter is for | ||
| 3143 | + *parsing errors*, and the former is for other problems that occur during | ||
| 3144 | + parsing but don't reflect a (syntactic) problem with the input. */ | ||
| 3145 | +void | ||
| 3146 | +argp_failure (const struct argp_state *state, int status, int errnum, | ||
| 3147 | + const char *fmt, ...) | ||
| 3148 | +{ | ||
| 3149 | + if (!state || !(state->flags & ARGP_NO_ERRS)) | ||
| 3150 | + { | ||
| 3151 | + FILE *stream = state ? state->err_stream : stderr; | ||
| 3152 | + | ||
| 3153 | + if (stream) | ||
| 3154 | + { | ||
| 3155 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 3156 | + flockfile (stream); | ||
| 3157 | +#endif | ||
| 3158 | + | ||
| 3159 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 3160 | + __fxprintf (stream, "%s", | ||
| 3161 | + state ? state->name : __argp_short_program_name ()); | ||
| 3162 | +#else | ||
| 3163 | + fputs_unlocked (state ? state->name : __argp_short_program_name (), | ||
| 3164 | + stream); | ||
| 3165 | +#endif | ||
| 3166 | + | ||
| 3167 | + if (fmt) | ||
| 3168 | + { | ||
| 3169 | + va_list ap; | ||
| 3170 | + | ||
| 3171 | + va_start (ap, fmt); | ||
| 3172 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 3173 | + char *buf; | ||
| 3174 | + | ||
| 3175 | + if (_IO_vasprintf (&buf, fmt, ap) < 0) | ||
| 3176 | + buf = NULL; | ||
| 3177 | + | ||
| 3178 | + __fxprintf (stream, ": %s", buf); | ||
| 3179 | + | ||
| 3180 | + free (buf); | ||
| 3181 | +#else | ||
| 3182 | + putc_unlocked (':', stream); | ||
| 3183 | + putc_unlocked (' ', stream); | ||
| 3184 | + | ||
| 3185 | + vfprintf (stream, fmt, ap); | ||
| 3186 | +#endif | ||
| 3187 | + | ||
| 3188 | + va_end (ap); | ||
| 3189 | + } | ||
| 3190 | + | ||
| 3191 | + if (errnum) | ||
| 3192 | + { | ||
| 3193 | +#if (defined _LIBC && defined USE_IN_LIBIO) || defined HAVE_STRERROR_R | ||
| 3194 | + char buf[200]; | ||
| 3195 | +#endif | ||
| 3196 | +#if defined _LIBC && defined USE_IN_LIBIO | ||
| 3197 | + __fxprintf (stream, ": %s", | ||
| 3198 | + strerror_r (errnum, buf, sizeof (buf))); | ||
| 3199 | +#else | ||
| 3200 | + putc_unlocked (':', stream); | ||
| 3201 | + putc_unlocked (' ', stream); | ||
| 3202 | +# ifdef HAVE_STRERROR_R | ||
| 3203 | + fputs (strerror_r (errnum, buf, sizeof (buf)), stream); | ||
| 3204 | +# else | ||
| 3205 | + fputs (strerror (errnum), stream); | ||
| 3206 | +# endif | ||
| 3207 | +#endif | ||
| 3208 | + } | ||
| 3209 | + | ||
| 3210 | +#ifdef USE_IN_LIBIO | ||
| 3211 | + if (_IO_fwide (stream, 0) > 0) | ||
| 3212 | + putwc_unlocked (L'\n', stream); | ||
| 3213 | + else | ||
| 3214 | +#endif | ||
| 3215 | + putc_unlocked ('\n', stream); | ||
| 3216 | + | ||
| 3217 | +#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE) | ||
| 3218 | + funlockfile (stream); | ||
| 3219 | +#endif | ||
| 3220 | + | ||
| 3221 | + if (status && (!state || !(state->flags & ARGP_NO_EXIT))) | ||
| 3222 | + exit (status); | ||
| 3223 | + } | ||
| 3224 | + } | ||
| 3225 | +} | ||
| 3226 | Index: git/libuargp/argp-parse.c | ||
| 3227 | =================================================================== | ||
| 3228 | --- /dev/null | ||
| 3229 | +++ git/libuargp/argp-parse.c | ||
| 3230 | @@ -0,0 +1,949 @@ | ||
| 3231 | +/* Hierarchial argument parsing, layered over getopt | ||
| 3232 | + Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
| 3233 | + This file is part of the GNU C Library. | ||
| 3234 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 3235 | + | ||
| 3236 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 3237 | + modify it under the terms of the GNU Lesser General Public | ||
| 3238 | + License as published by the Free Software Foundation; either | ||
| 3239 | + version 2.1 of the License, or (at your option) any later version. | ||
| 3240 | + | ||
| 3241 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 3242 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 3243 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 3244 | + Lesser General Public License for more details. | ||
| 3245 | + | ||
| 3246 | + You should have received a copy of the GNU Lesser General Public | ||
| 3247 | + License along with the GNU C Library; if not, write to the Free | ||
| 3248 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 3249 | + 02111-1307 USA. | ||
| 3250 | + | ||
| 3251 | + Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com> | ||
| 3252 | +*/ | ||
| 3253 | + | ||
| 3254 | +#ifdef HAVE_CONFIG_H | ||
| 3255 | +#include <config.h> | ||
| 3256 | +#endif | ||
| 3257 | + | ||
| 3258 | +/* AIX requires this to be the first thing in the file. */ | ||
| 3259 | +#ifndef __GNUC__ | ||
| 3260 | +# if HAVE_ALLOCA_H || defined _LIBC | ||
| 3261 | +# include <alloca.h> | ||
| 3262 | +# else | ||
| 3263 | +# ifdef _AIX | ||
| 3264 | +#pragma alloca | ||
| 3265 | +# else | ||
| 3266 | +# ifndef alloca /* predefined by HP cc +Olibcalls */ | ||
| 3267 | +char *alloca (); | ||
| 3268 | +# endif | ||
| 3269 | +# endif | ||
| 3270 | +# endif | ||
| 3271 | +#endif | ||
| 3272 | + | ||
| 3273 | +#include <stdlib.h> | ||
| 3274 | +#include <string.h> | ||
| 3275 | +#include <unistd.h> | ||
| 3276 | +#include <limits.h> | ||
| 3277 | +#include <getopt.h> | ||
| 3278 | +#include <bits/getopt_int.h> | ||
| 3279 | + | ||
| 3280 | +#include <features.h> | ||
| 3281 | +#ifndef _ | ||
| 3282 | +/* This is for other GNU distributions with internationalized messages. | ||
| 3283 | + When compiling libc, the _ macro is predefined. */ | ||
| 3284 | +# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__ | ||
| 3285 | +# include <libintl.h> | ||
| 3286 | +# ifdef _LIBC | ||
| 3287 | +# undef dgettext | ||
| 3288 | +# define dgettext(domain, msgid) \ | ||
| 3289 | + INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES) | ||
| 3290 | +# endif | ||
| 3291 | +# else | ||
| 3292 | +# define dgettext(domain, msgid) (msgid) | ||
| 3293 | +# define gettext(msgid) (msgid) | ||
| 3294 | +# endif | ||
| 3295 | +#endif | ||
| 3296 | +#ifndef N_ | ||
| 3297 | +# define N_(msgid) (msgid) | ||
| 3298 | +#endif | ||
| 3299 | + | ||
| 3300 | +#include <argp.h> | ||
| 3301 | + | ||
| 3302 | +/* Getopt return values. */ | ||
| 3303 | +#define KEY_END (-1) /* The end of the options. */ | ||
| 3304 | +#define KEY_ARG 1 /* A non-option argument. */ | ||
| 3305 | +#define KEY_ERR '?' /* An error parsing the options. */ | ||
| 3306 | + | ||
| 3307 | +/* The meta-argument used to prevent any further arguments being interpreted | ||
| 3308 | + as options. */ | ||
| 3309 | +#define QUOTE "--" | ||
| 3310 | + | ||
| 3311 | +/* The number of bits we steal in a long-option value for our own use. */ | ||
| 3312 | +#define GROUP_BITS CHAR_BIT | ||
| 3313 | + | ||
| 3314 | +/* The number of bits available for the user value. */ | ||
| 3315 | +#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS) | ||
| 3316 | +#define USER_MASK ((1 << USER_BITS) - 1) | ||
| 3317 | + | ||
| 3318 | +/* EZ alias for ARGP_ERR_UNKNOWN. */ | ||
| 3319 | +#define EBADKEY ARGP_ERR_UNKNOWN | ||
| 3320 | + | ||
| 3321 | +/* Default options. */ | ||
| 3322 | + | ||
| 3323 | +/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep | ||
| 3324 | + for one second intervals, decrementing _ARGP_HANG until it's zero. Thus | ||
| 3325 | + you can force the program to continue by attaching a debugger and setting | ||
| 3326 | + it to 0 yourself. */ | ||
| 3327 | +static volatile int _argp_hang; | ||
| 3328 | + | ||
| 3329 | +#define OPT_PROGNAME -2 | ||
| 3330 | +#define OPT_USAGE -3 | ||
| 3331 | +#define OPT_HANG -4 | ||
| 3332 | + | ||
| 3333 | +static const struct argp_option argp_default_options[] = | ||
| 3334 | +{ | ||
| 3335 | + {"help", '?', 0, 0, N_("Give this help list"), -1}, | ||
| 3336 | + {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")}, | ||
| 3337 | + {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")}, | ||
| 3338 | + {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN, | ||
| 3339 | + N_("Hang for SECS seconds (default 3600)")}, | ||
| 3340 | + {0, 0} | ||
| 3341 | +}; | ||
| 3342 | + | ||
| 3343 | +static error_t | ||
| 3344 | +argp_default_parser (int key, char *arg, struct argp_state *state) | ||
| 3345 | +{ | ||
| 3346 | + switch (key) | ||
| 3347 | + { | ||
| 3348 | + case '?': | ||
| 3349 | + argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP); | ||
| 3350 | + break; | ||
| 3351 | + case OPT_USAGE: | ||
| 3352 | + argp_state_help (state, state->out_stream, | ||
| 3353 | + ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); | ||
| 3354 | + break; | ||
| 3355 | + | ||
| 3356 | + case OPT_PROGNAME: /* Set the program name. */ | ||
| 3357 | +#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME | ||
| 3358 | + program_invocation_name = arg; | ||
| 3359 | +#endif | ||
| 3360 | + /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka | ||
| 3361 | + __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined | ||
| 3362 | + to be that, so we have to be a bit careful here.] */ | ||
| 3363 | + | ||
| 3364 | + /* Update what we use for messages. */ | ||
| 3365 | + state->name = strrchr (arg, '/'); | ||
| 3366 | + if (state->name) | ||
| 3367 | + state->name++; | ||
| 3368 | + else | ||
| 3369 | + state->name = arg; | ||
| 3370 | + | ||
| 3371 | +#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME | ||
| 3372 | + program_invocation_short_name = state->name; | ||
| 3373 | +#endif | ||
| 3374 | + | ||
| 3375 | + if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS)) | ||
| 3376 | + == ARGP_PARSE_ARGV0) | ||
| 3377 | + /* Update what getopt uses too. */ | ||
| 3378 | + state->argv[0] = arg; | ||
| 3379 | + | ||
| 3380 | + break; | ||
| 3381 | + | ||
| 3382 | + case OPT_HANG: | ||
| 3383 | + _argp_hang = atoi (arg ? arg : "3600"); | ||
| 3384 | + while (_argp_hang-- > 0) | ||
| 3385 | + sleep (1); | ||
| 3386 | + break; | ||
| 3387 | + | ||
| 3388 | + default: | ||
| 3389 | + return EBADKEY; | ||
| 3390 | + } | ||
| 3391 | + return 0; | ||
| 3392 | +} | ||
| 3393 | + | ||
| 3394 | +static const struct argp argp_default_argp = | ||
| 3395 | + {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"}; | ||
| 3396 | + | ||
| 3397 | + | ||
| 3398 | +static const struct argp_option argp_version_options[] = | ||
| 3399 | +{ | ||
| 3400 | + {"version", 'V', 0, 0, N_("Print program version"), -1}, | ||
| 3401 | + {0, 0} | ||
| 3402 | +}; | ||
| 3403 | + | ||
| 3404 | +static error_t | ||
| 3405 | +argp_version_parser (int key, char *arg, struct argp_state *state) | ||
| 3406 | +{ | ||
| 3407 | + switch (key) | ||
| 3408 | + { | ||
| 3409 | + case 'V': | ||
| 3410 | + if (argp_program_version_hook) | ||
| 3411 | + (*argp_program_version_hook) (state->out_stream, state); | ||
| 3412 | + else if (argp_program_version) | ||
| 3413 | + fprintf (state->out_stream, "%s\n", argp_program_version); | ||
| 3414 | + else | ||
| 3415 | + argp_error (state, dgettext (state->root_argp->argp_domain, | ||
| 3416 | + "(PROGRAM ERROR) No version known!?")); | ||
| 3417 | + if (! (state->flags & ARGP_NO_EXIT)) | ||
| 3418 | + exit (0); | ||
| 3419 | + break; | ||
| 3420 | + default: | ||
| 3421 | + return EBADKEY; | ||
| 3422 | + } | ||
| 3423 | + return 0; | ||
| 3424 | +} | ||
| 3425 | + | ||
| 3426 | +static const struct argp argp_version_argp = | ||
| 3427 | + {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"}; | ||
| 3428 | + | ||
| 3429 | +/* Returns the offset into the getopt long options array LONG_OPTIONS of a | ||
| 3430 | + long option with called NAME, or -1 if none is found. Passing NULL as | ||
| 3431 | + NAME will return the number of options. */ | ||
| 3432 | +static int | ||
| 3433 | +find_long_option (struct option *long_options, const char *name) | ||
| 3434 | +{ | ||
| 3435 | + struct option *l = long_options; | ||
| 3436 | + while (l->name != NULL) | ||
| 3437 | + if (name != NULL && strcmp (l->name, name) == 0) | ||
| 3438 | + return l - long_options; | ||
| 3439 | + else | ||
| 3440 | + l++; | ||
| 3441 | + if (name == NULL) | ||
| 3442 | + return l - long_options; | ||
| 3443 | + else | ||
| 3444 | + return -1; | ||
| 3445 | +} | ||
| 3446 | + | ||
| 3447 | + | ||
| 3448 | +/* The state of a `group' during parsing. Each group corresponds to a | ||
| 3449 | + particular argp structure from the tree of such descending from the top | ||
| 3450 | + level argp passed to argp_parse. */ | ||
| 3451 | +struct group | ||
| 3452 | +{ | ||
| 3453 | + /* This group's parsing function. */ | ||
| 3454 | + argp_parser_t parser; | ||
| 3455 | + | ||
| 3456 | + /* Which argp this group is from. */ | ||
| 3457 | + const struct argp *argp; | ||
| 3458 | + | ||
| 3459 | + /* Points to the point in SHORT_OPTS corresponding to the end of the short | ||
| 3460 | + options for this group. We use it to determine from which group a | ||
| 3461 | + particular short options is from. */ | ||
| 3462 | + char *short_end; | ||
| 3463 | + | ||
| 3464 | + /* The number of non-option args sucessfully handled by this parser. */ | ||
| 3465 | + unsigned args_processed; | ||
| 3466 | + | ||
| 3467 | + /* This group's parser's parent's group. */ | ||
| 3468 | + struct group *parent; | ||
| 3469 | + unsigned parent_index; /* And the our position in the parent. */ | ||
| 3470 | + | ||
| 3471 | + /* These fields are swapped into and out of the state structure when | ||
| 3472 | + calling this group's parser. */ | ||
| 3473 | + void *input, **child_inputs; | ||
| 3474 | + void *hook; | ||
| 3475 | +}; | ||
| 3476 | + | ||
| 3477 | +/* Call GROUP's parser with KEY and ARG, swapping any group-specific info | ||
| 3478 | + from STATE before calling, and back into state afterwards. If GROUP has | ||
| 3479 | + no parser, EBADKEY is returned. */ | ||
| 3480 | +static error_t | ||
| 3481 | +group_parse (struct group *group, struct argp_state *state, int key, char *arg) | ||
| 3482 | +{ | ||
| 3483 | + if (group->parser) | ||
| 3484 | + { | ||
| 3485 | + error_t err; | ||
| 3486 | + state->hook = group->hook; | ||
| 3487 | + state->input = group->input; | ||
| 3488 | + state->child_inputs = group->child_inputs; | ||
| 3489 | + state->arg_num = group->args_processed; | ||
| 3490 | + err = (*group->parser)(key, arg, state); | ||
| 3491 | + group->hook = state->hook; | ||
| 3492 | + return err; | ||
| 3493 | + } | ||
| 3494 | + else | ||
| 3495 | + return EBADKEY; | ||
| 3496 | +} | ||
| 3497 | + | ||
| 3498 | +struct parser | ||
| 3499 | +{ | ||
| 3500 | + const struct argp *argp; | ||
| 3501 | + | ||
| 3502 | + /* SHORT_OPTS is the getopt short options string for the union of all the | ||
| 3503 | + groups of options. */ | ||
| 3504 | + char *short_opts; | ||
| 3505 | + /* LONG_OPTS is the array of getop long option structures for the union of | ||
| 3506 | + all the groups of options. */ | ||
| 3507 | + struct option *long_opts; | ||
| 3508 | + /* OPT_DATA is the getopt data used for the re-entrant getopt. */ | ||
| 3509 | + struct _getopt_data opt_data; | ||
| 3510 | + | ||
| 3511 | + /* States of the various parsing groups. */ | ||
| 3512 | + struct group *groups; | ||
| 3513 | + /* The end of the GROUPS array. */ | ||
| 3514 | + struct group *egroup; | ||
| 3515 | + /* An vector containing storage for the CHILD_INPUTS field in all groups. */ | ||
| 3516 | + void **child_inputs; | ||
| 3517 | + | ||
| 3518 | + /* True if we think using getopt is still useful; if false, then | ||
| 3519 | + remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is | ||
| 3520 | + cleared whenever getopt returns KEY_END, but may be set again if the user | ||
| 3521 | + moves the next argument pointer backwards. */ | ||
| 3522 | + int try_getopt; | ||
| 3523 | + | ||
| 3524 | + /* State block supplied to parsing routines. */ | ||
| 3525 | + struct argp_state state; | ||
| 3526 | + | ||
| 3527 | + /* Memory used by this parser. */ | ||
| 3528 | + void *storage; | ||
| 3529 | +}; | ||
| 3530 | + | ||
| 3531 | +/* The next usable entries in the various parser tables being filled in by | ||
| 3532 | + convert_options. */ | ||
| 3533 | +struct parser_convert_state | ||
| 3534 | +{ | ||
| 3535 | + struct parser *parser; | ||
| 3536 | + char *short_end; | ||
| 3537 | + struct option *long_end; | ||
| 3538 | + void **child_inputs_end; | ||
| 3539 | +}; | ||
| 3540 | + | ||
| 3541 | +/* Converts all options in ARGP (which is put in GROUP) and ancestors | ||
| 3542 | + into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and | ||
| 3543 | + CVT->LONG_END are the points at which new options are added. Returns the | ||
| 3544 | + next unused group entry. CVT holds state used during the conversion. */ | ||
| 3545 | +static struct group * | ||
| 3546 | +convert_options (const struct argp *argp, | ||
| 3547 | + struct group *parent, unsigned parent_index, | ||
| 3548 | + struct group *group, struct parser_convert_state *cvt) | ||
| 3549 | +{ | ||
| 3550 | + /* REAL is the most recent non-alias value of OPT. */ | ||
| 3551 | + const struct argp_option *real = argp->options; | ||
| 3552 | + const struct argp_child *children = argp->children; | ||
| 3553 | + | ||
| 3554 | + if (real || argp->parser) | ||
| 3555 | + { | ||
| 3556 | + const struct argp_option *opt; | ||
| 3557 | + | ||
| 3558 | + if (real) | ||
| 3559 | + for (opt = real; !__option_is_end (opt); opt++) | ||
| 3560 | + { | ||
| 3561 | + if (! (opt->flags & OPTION_ALIAS)) | ||
| 3562 | + /* OPT isn't an alias, so we can use values from it. */ | ||
| 3563 | + real = opt; | ||
| 3564 | + | ||
| 3565 | + if (! (real->flags & OPTION_DOC)) | ||
| 3566 | + /* A real option (not just documentation). */ | ||
| 3567 | + { | ||
| 3568 | + if (__option_is_short (opt)) | ||
| 3569 | + /* OPT can be used as a short option. */ | ||
| 3570 | + { | ||
| 3571 | + *cvt->short_end++ = opt->key; | ||
| 3572 | + if (real->arg) | ||
| 3573 | + { | ||
| 3574 | + *cvt->short_end++ = ':'; | ||
| 3575 | + if (real->flags & OPTION_ARG_OPTIONAL) | ||
| 3576 | + *cvt->short_end++ = ':'; | ||
| 3577 | + } | ||
| 3578 | + *cvt->short_end = '\0'; /* keep 0 terminated */ | ||
| 3579 | + } | ||
| 3580 | + | ||
| 3581 | + if (opt->name | ||
| 3582 | + && find_long_option (cvt->parser->long_opts, opt->name) < 0) | ||
| 3583 | + /* OPT can be used as a long option. */ | ||
| 3584 | + { | ||
| 3585 | + cvt->long_end->name = opt->name; | ||
| 3586 | + cvt->long_end->has_arg = | ||
| 3587 | + (real->arg | ||
| 3588 | + ? (real->flags & OPTION_ARG_OPTIONAL | ||
| 3589 | + ? optional_argument | ||
| 3590 | + : required_argument) | ||
| 3591 | + : no_argument); | ||
| 3592 | + cvt->long_end->flag = 0; | ||
| 3593 | + /* we add a disambiguating code to all the user's | ||
| 3594 | + values (which is removed before we actually call | ||
| 3595 | + the function to parse the value); this means that | ||
| 3596 | + the user loses use of the high 8 bits in all his | ||
| 3597 | + values (the sign of the lower bits is preserved | ||
| 3598 | + however)... */ | ||
| 3599 | + cvt->long_end->val = | ||
| 3600 | + ((opt->key | real->key) & USER_MASK) | ||
| 3601 | + + (((group - cvt->parser->groups) + 1) << USER_BITS); | ||
| 3602 | + | ||
| 3603 | + /* Keep the LONG_OPTS list terminated. */ | ||
| 3604 | + (++cvt->long_end)->name = NULL; | ||
| 3605 | + } | ||
| 3606 | + } | ||
| 3607 | + } | ||
| 3608 | + | ||
| 3609 | + group->parser = argp->parser; | ||
| 3610 | + group->argp = argp; | ||
| 3611 | + group->short_end = cvt->short_end; | ||
| 3612 | + group->args_processed = 0; | ||
| 3613 | + group->parent = parent; | ||
| 3614 | + group->parent_index = parent_index; | ||
| 3615 | + group->input = 0; | ||
| 3616 | + group->hook = 0; | ||
| 3617 | + group->child_inputs = 0; | ||
| 3618 | + | ||
| 3619 | + if (children) | ||
| 3620 | + /* Assign GROUP's CHILD_INPUTS field some space from | ||
| 3621 | + CVT->child_inputs_end.*/ | ||
| 3622 | + { | ||
| 3623 | + unsigned num_children = 0; | ||
| 3624 | + while (children[num_children].argp) | ||
| 3625 | + num_children++; | ||
| 3626 | + group->child_inputs = cvt->child_inputs_end; | ||
| 3627 | + cvt->child_inputs_end += num_children; | ||
| 3628 | + } | ||
| 3629 | + | ||
| 3630 | + parent = group++; | ||
| 3631 | + } | ||
| 3632 | + else | ||
| 3633 | + parent = 0; | ||
| 3634 | + | ||
| 3635 | + if (children) | ||
| 3636 | + { | ||
| 3637 | + unsigned index = 0; | ||
| 3638 | + while (children->argp) | ||
| 3639 | + group = | ||
| 3640 | + convert_options (children++->argp, parent, index++, group, cvt); | ||
| 3641 | + } | ||
| 3642 | + | ||
| 3643 | + return group; | ||
| 3644 | +} | ||
| 3645 | + | ||
| 3646 | +/* Find the merged set of getopt options, with keys appropiately prefixed. */ | ||
| 3647 | +static void | ||
| 3648 | +parser_convert (struct parser *parser, const struct argp *argp, int flags) | ||
| 3649 | +{ | ||
| 3650 | + struct parser_convert_state cvt; | ||
| 3651 | + | ||
| 3652 | + cvt.parser = parser; | ||
| 3653 | + cvt.short_end = parser->short_opts; | ||
| 3654 | + cvt.long_end = parser->long_opts; | ||
| 3655 | + cvt.child_inputs_end = parser->child_inputs; | ||
| 3656 | + | ||
| 3657 | + if (flags & ARGP_IN_ORDER) | ||
| 3658 | + *cvt.short_end++ = '-'; | ||
| 3659 | + else if (flags & ARGP_NO_ARGS) | ||
| 3660 | + *cvt.short_end++ = '+'; | ||
| 3661 | + *cvt.short_end = '\0'; | ||
| 3662 | + | ||
| 3663 | + cvt.long_end->name = NULL; | ||
| 3664 | + | ||
| 3665 | + parser->argp = argp; | ||
| 3666 | + | ||
| 3667 | + if (argp) | ||
| 3668 | + parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt); | ||
| 3669 | + else | ||
| 3670 | + parser->egroup = parser->groups; /* No parsers at all! */ | ||
| 3671 | +} | ||
| 3672 | + | ||
| 3673 | +/* Lengths of various parser fields which we will allocated. */ | ||
| 3674 | +struct parser_sizes | ||
| 3675 | +{ | ||
| 3676 | + size_t short_len; /* Getopt short options string. */ | ||
| 3677 | + size_t long_len; /* Getopt long options vector. */ | ||
| 3678 | + size_t num_groups; /* Group structures we allocate. */ | ||
| 3679 | + size_t num_child_inputs; /* Child input slots. */ | ||
| 3680 | +}; | ||
| 3681 | + | ||
| 3682 | +/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of | ||
| 3683 | + argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by | ||
| 3684 | + the maximum lengths of the resulting merged getopt short options string and | ||
| 3685 | + long-options array, respectively. */ | ||
| 3686 | +static void | ||
| 3687 | +calc_sizes (const struct argp *argp, struct parser_sizes *szs) | ||
| 3688 | +{ | ||
| 3689 | + const struct argp_child *child = argp->children; | ||
| 3690 | + const struct argp_option *opt = argp->options; | ||
| 3691 | + | ||
| 3692 | + if (opt || argp->parser) | ||
| 3693 | + { | ||
| 3694 | + szs->num_groups++; | ||
| 3695 | + if (opt) | ||
| 3696 | + { | ||
| 3697 | + int num_opts = 0; | ||
| 3698 | + while (!__option_is_end (opt++)) | ||
| 3699 | + num_opts++; | ||
| 3700 | + szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ | ||
| 3701 | + szs->long_len += num_opts; | ||
| 3702 | + } | ||
| 3703 | + } | ||
| 3704 | + | ||
| 3705 | + if (child) | ||
| 3706 | + while (child->argp) | ||
| 3707 | + { | ||
| 3708 | + calc_sizes ((child++)->argp, szs); | ||
| 3709 | + szs->num_child_inputs++; | ||
| 3710 | + } | ||
| 3711 | +} | ||
| 3712 | + | ||
| 3713 | + | ||
| 3714 | +extern char * __argp_short_program_name (void); | ||
| 3715 | +/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */ | ||
| 3716 | +static error_t | ||
| 3717 | +parser_init (struct parser *parser, const struct argp *argp, | ||
| 3718 | + int argc, char **argv, int flags, void *input) | ||
| 3719 | +{ | ||
| 3720 | + error_t err = 0; | ||
| 3721 | + struct group *group; | ||
| 3722 | + struct parser_sizes szs; | ||
| 3723 | + struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER; | ||
| 3724 | + | ||
| 3725 | + szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1; | ||
| 3726 | + szs.long_len = 0; | ||
| 3727 | + szs.num_groups = 0; | ||
| 3728 | + szs.num_child_inputs = 0; | ||
| 3729 | + | ||
| 3730 | + if (argp) | ||
| 3731 | + calc_sizes (argp, &szs); | ||
| 3732 | + | ||
| 3733 | + /* Lengths of the various bits of storage used by PARSER. */ | ||
| 3734 | +#define GLEN (szs.num_groups + 1) * sizeof (struct group) | ||
| 3735 | +#define CLEN (szs.num_child_inputs * sizeof (void *)) | ||
| 3736 | +#define LLEN ((szs.long_len + 1) * sizeof (struct option)) | ||
| 3737 | +#define SLEN (szs.short_len + 1) | ||
| 3738 | + | ||
| 3739 | + parser->storage = malloc (GLEN + CLEN + LLEN + SLEN); | ||
| 3740 | + if (! parser->storage) | ||
| 3741 | + return ENOMEM; | ||
| 3742 | + | ||
| 3743 | + parser->groups = parser->storage; | ||
| 3744 | + parser->child_inputs = parser->storage + GLEN; | ||
| 3745 | + parser->long_opts = parser->storage + GLEN + CLEN; | ||
| 3746 | + parser->short_opts = parser->storage + GLEN + CLEN + LLEN; | ||
| 3747 | + parser->opt_data = opt_data; | ||
| 3748 | + | ||
| 3749 | + memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *)); | ||
| 3750 | + parser_convert (parser, argp, flags); | ||
| 3751 | + | ||
| 3752 | + memset (&parser->state, 0, sizeof (struct argp_state)); | ||
| 3753 | + parser->state.root_argp = parser->argp; | ||
| 3754 | + parser->state.argc = argc; | ||
| 3755 | + parser->state.argv = argv; | ||
| 3756 | + parser->state.flags = flags; | ||
| 3757 | + parser->state.err_stream = stderr; | ||
| 3758 | + parser->state.out_stream = stdout; | ||
| 3759 | + parser->state.next = 0; /* Tell getopt to initialize. */ | ||
| 3760 | + parser->state.pstate = parser; | ||
| 3761 | + | ||
| 3762 | + parser->try_getopt = 1; | ||
| 3763 | + | ||
| 3764 | + /* Call each parser for the first time, giving it a chance to propagate | ||
| 3765 | + values to child parsers. */ | ||
| 3766 | + if (parser->groups < parser->egroup) | ||
| 3767 | + parser->groups->input = input; | ||
| 3768 | + for (group = parser->groups; | ||
| 3769 | + group < parser->egroup && (!err || err == EBADKEY); | ||
| 3770 | + group++) | ||
| 3771 | + { | ||
| 3772 | + if (group->parent) | ||
| 3773 | + /* If a child parser, get the initial input value from the parent. */ | ||
| 3774 | + group->input = group->parent->child_inputs[group->parent_index]; | ||
| 3775 | + | ||
| 3776 | + if (!group->parser | ||
| 3777 | + && group->argp->children && group->argp->children->argp) | ||
| 3778 | + /* For the special case where no parsing function is supplied for an | ||
| 3779 | + argp, propagate its input to its first child, if any (this just | ||
| 3780 | + makes very simple wrapper argps more convenient). */ | ||
| 3781 | + group->child_inputs[0] = group->input; | ||
| 3782 | + | ||
| 3783 | + err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0); | ||
| 3784 | + } | ||
| 3785 | + if (err == EBADKEY) | ||
| 3786 | + err = 0; /* Some parser didn't understand. */ | ||
| 3787 | + | ||
| 3788 | + if (err) | ||
| 3789 | + return err; | ||
| 3790 | + | ||
| 3791 | + if (parser->state.flags & ARGP_NO_ERRS) | ||
| 3792 | + { | ||
| 3793 | + parser->opt_data.opterr = 0; | ||
| 3794 | + if (parser->state.flags & ARGP_PARSE_ARGV0) | ||
| 3795 | + /* getopt always skips ARGV[0], so we have to fake it out. As long | ||
| 3796 | + as OPTERR is 0, then it shouldn't actually try to access it. */ | ||
| 3797 | + parser->state.argv--, parser->state.argc++; | ||
| 3798 | + } | ||
| 3799 | + else | ||
| 3800 | + parser->opt_data.opterr = 1; /* Print error messages. */ | ||
| 3801 | + | ||
| 3802 | + if (parser->state.argv == argv && argv[0]) | ||
| 3803 | + /* There's an argv[0]; use it for messages. */ | ||
| 3804 | + { | ||
| 3805 | + char *short_name = strrchr (argv[0], '/'); | ||
| 3806 | + parser->state.name = short_name ? short_name + 1 : argv[0]; | ||
| 3807 | + } | ||
| 3808 | + else | ||
| 3809 | + parser->state.name = __argp_short_program_name (); | ||
| 3810 | + | ||
| 3811 | + return 0; | ||
| 3812 | +} | ||
| 3813 | + | ||
| 3814 | +/* Free any storage consumed by PARSER (but not PARSER itself). */ | ||
| 3815 | +static error_t | ||
| 3816 | +parser_finalize (struct parser *parser, | ||
| 3817 | + error_t err, int arg_ebadkey, int *end_index) | ||
| 3818 | +{ | ||
| 3819 | + struct group *group; | ||
| 3820 | + | ||
| 3821 | + if (err == EBADKEY && arg_ebadkey) | ||
| 3822 | + /* Suppress errors generated by unparsed arguments. */ | ||
| 3823 | + err = 0; | ||
| 3824 | + | ||
| 3825 | + if (! err) | ||
| 3826 | + { | ||
| 3827 | + if (parser->state.next == parser->state.argc) | ||
| 3828 | + /* We successfully parsed all arguments! Call all the parsers again, | ||
| 3829 | + just a few more times... */ | ||
| 3830 | + { | ||
| 3831 | + for (group = parser->groups; | ||
| 3832 | + group < parser->egroup && (!err || err==EBADKEY); | ||
| 3833 | + group++) | ||
| 3834 | + if (group->args_processed == 0) | ||
| 3835 | + err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); | ||
| 3836 | + for (group = parser->egroup - 1; | ||
| 3837 | + group >= parser->groups && (!err || err==EBADKEY); | ||
| 3838 | + group--) | ||
| 3839 | + err = group_parse (group, &parser->state, ARGP_KEY_END, 0); | ||
| 3840 | + | ||
| 3841 | + if (err == EBADKEY) | ||
| 3842 | + err = 0; /* Some parser didn't understand. */ | ||
| 3843 | + | ||
| 3844 | + /* Tell the user that all arguments are parsed. */ | ||
| 3845 | + if (end_index) | ||
| 3846 | + *end_index = parser->state.next; | ||
| 3847 | + } | ||
| 3848 | + else if (end_index) | ||
| 3849 | + /* Return any remaining arguments to the user. */ | ||
| 3850 | + *end_index = parser->state.next; | ||
| 3851 | + else | ||
| 3852 | + /* No way to return the remaining arguments, they must be bogus. */ | ||
| 3853 | + { | ||
| 3854 | + if (!(parser->state.flags & ARGP_NO_ERRS) | ||
| 3855 | + && parser->state.err_stream) | ||
| 3856 | + fprintf (parser->state.err_stream, | ||
| 3857 | + dgettext (parser->argp->argp_domain, | ||
| 3858 | + "%s: Too many arguments\n"), | ||
| 3859 | + parser->state.name); | ||
| 3860 | + err = EBADKEY; | ||
| 3861 | + } | ||
| 3862 | + } | ||
| 3863 | + | ||
| 3864 | + /* Okay, we're all done, with either an error or success; call the parsers | ||
| 3865 | + to indicate which one. */ | ||
| 3866 | + | ||
| 3867 | + if (err) | ||
| 3868 | + { | ||
| 3869 | + /* Maybe print an error message. */ | ||
| 3870 | + if (err == EBADKEY) | ||
| 3871 | + /* An appropriate message describing what the error was should have | ||
| 3872 | + been printed earlier. */ | ||
| 3873 | + argp_state_help (&parser->state, parser->state.err_stream, | ||
| 3874 | + ARGP_HELP_STD_ERR); | ||
| 3875 | + | ||
| 3876 | + /* Since we didn't exit, give each parser an error indication. */ | ||
| 3877 | + for (group = parser->groups; group < parser->egroup; group++) | ||
| 3878 | + group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); | ||
| 3879 | + } | ||
| 3880 | + else | ||
| 3881 | + /* Notify parsers of success, and propagate back values from parsers. */ | ||
| 3882 | + { | ||
| 3883 | + /* We pass over the groups in reverse order so that child groups are | ||
| 3884 | + given a chance to do there processing before passing back a value to | ||
| 3885 | + the parent. */ | ||
| 3886 | + for (group = parser->egroup - 1 | ||
| 3887 | + ; group >= parser->groups && (!err || err == EBADKEY) | ||
| 3888 | + ; group--) | ||
| 3889 | + err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); | ||
| 3890 | + if (err == EBADKEY) | ||
| 3891 | + err = 0; /* Some parser didn't understand. */ | ||
| 3892 | + } | ||
| 3893 | + | ||
| 3894 | + /* Call parsers once more, to do any final cleanup. Errors are ignored. */ | ||
| 3895 | + for (group = parser->egroup - 1; group >= parser->groups; group--) | ||
| 3896 | + group_parse (group, &parser->state, ARGP_KEY_FINI, 0); | ||
| 3897 | + | ||
| 3898 | + if (err == EBADKEY) | ||
| 3899 | + err = EINVAL; | ||
| 3900 | + | ||
| 3901 | + free (parser->storage); | ||
| 3902 | + | ||
| 3903 | + return err; | ||
| 3904 | +} | ||
| 3905 | + | ||
| 3906 | +/* Call the user parsers to parse the non-option argument VAL, at the current | ||
| 3907 | + position, returning any error. The state NEXT pointer is assumed to have | ||
| 3908 | + been adjusted (by getopt) to point after this argument; this function will | ||
| 3909 | + adjust it correctly to reflect however many args actually end up being | ||
| 3910 | + consumed. */ | ||
| 3911 | +static error_t | ||
| 3912 | +parser_parse_arg (struct parser *parser, char *val) | ||
| 3913 | +{ | ||
| 3914 | + /* Save the starting value of NEXT, first adjusting it so that the arg | ||
| 3915 | + we're parsing is again the front of the arg vector. */ | ||
| 3916 | + int index = --parser->state.next; | ||
| 3917 | + error_t err = EBADKEY; | ||
| 3918 | + struct group *group; | ||
| 3919 | + int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */ | ||
| 3920 | + | ||
| 3921 | + /* Try to parse the argument in each parser. */ | ||
| 3922 | + for (group = parser->groups | ||
| 3923 | + ; group < parser->egroup && err == EBADKEY | ||
| 3924 | + ; group++) | ||
| 3925 | + { | ||
| 3926 | + parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */ | ||
| 3927 | + key = ARGP_KEY_ARG; | ||
| 3928 | + err = group_parse (group, &parser->state, key, val); | ||
| 3929 | + | ||
| 3930 | + if (err == EBADKEY) | ||
| 3931 | + /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */ | ||
| 3932 | + { | ||
| 3933 | + parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */ | ||
| 3934 | + key = ARGP_KEY_ARGS; | ||
| 3935 | + err = group_parse (group, &parser->state, key, 0); | ||
| 3936 | + } | ||
| 3937 | + } | ||
| 3938 | + | ||
| 3939 | + if (! err) | ||
| 3940 | + { | ||
| 3941 | + if (key == ARGP_KEY_ARGS) | ||
| 3942 | + /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't | ||
| 3943 | + changed by the user, *all* arguments should be considered | ||
| 3944 | + consumed. */ | ||
| 3945 | + parser->state.next = parser->state.argc; | ||
| 3946 | + | ||
| 3947 | + if (parser->state.next > index) | ||
| 3948 | + /* Remember that we successfully processed a non-option | ||
| 3949 | + argument -- but only if the user hasn't gotten tricky and set | ||
| 3950 | + the clock back. */ | ||
| 3951 | + (--group)->args_processed += (parser->state.next - index); | ||
| 3952 | + else | ||
| 3953 | + /* The user wants to reparse some args, give getopt another try. */ | ||
| 3954 | + parser->try_getopt = 1; | ||
| 3955 | + } | ||
| 3956 | + | ||
| 3957 | + return err; | ||
| 3958 | +} | ||
| 3959 | + | ||
| 3960 | +/* Call the user parsers to parse the option OPT, with argument VAL, at the | ||
| 3961 | + current position, returning any error. */ | ||
| 3962 | +static error_t | ||
| 3963 | +parser_parse_opt (struct parser *parser, int opt, char *val) | ||
| 3964 | +{ | ||
| 3965 | + /* The group key encoded in the high bits; 0 for short opts or | ||
| 3966 | + group_number + 1 for long opts. */ | ||
| 3967 | + int group_key = opt >> USER_BITS; | ||
| 3968 | + error_t err = EBADKEY; | ||
| 3969 | + | ||
| 3970 | + if (group_key == 0) | ||
| 3971 | + /* A short option. By comparing OPT's position in SHORT_OPTS to the | ||
| 3972 | + various starting positions in each group's SHORT_END field, we can | ||
| 3973 | + determine which group OPT came from. */ | ||
| 3974 | + { | ||
| 3975 | + struct group *group; | ||
| 3976 | + char *short_index = strchr (parser->short_opts, opt); | ||
| 3977 | + | ||
| 3978 | + if (short_index) | ||
| 3979 | + for (group = parser->groups; group < parser->egroup; group++) | ||
| 3980 | + if (group->short_end > short_index) | ||
| 3981 | + { | ||
| 3982 | + err = group_parse (group, &parser->state, opt, | ||
| 3983 | + parser->opt_data.optarg); | ||
| 3984 | + break; | ||
| 3985 | + } | ||
| 3986 | + } | ||
| 3987 | + else | ||
| 3988 | + /* A long option. We use shifts instead of masking for extracting | ||
| 3989 | + the user value in order to preserve the sign. */ | ||
| 3990 | + err = | ||
| 3991 | + group_parse (&parser->groups[group_key - 1], &parser->state, | ||
| 3992 | + (opt << GROUP_BITS) >> GROUP_BITS, | ||
| 3993 | + parser->opt_data.optarg); | ||
| 3994 | + | ||
| 3995 | + if (err == EBADKEY) | ||
| 3996 | + /* At least currently, an option not recognized is an error in the | ||
| 3997 | + parser, because we pre-compute which parser is supposed to deal | ||
| 3998 | + with each option. */ | ||
| 3999 | + { | ||
| 4000 | + static const char bad_key_err[] = | ||
| 4001 | + N_("(PROGRAM ERROR) Option should have been recognized!?"); | ||
| 4002 | + if (group_key == 0) | ||
| 4003 | + argp_error (&parser->state, "-%c: %s", opt, | ||
| 4004 | + dgettext (parser->argp->argp_domain, bad_key_err)); | ||
| 4005 | + else | ||
| 4006 | + { | ||
| 4007 | + struct option *long_opt = parser->long_opts; | ||
| 4008 | + while (long_opt->val != opt && long_opt->name) | ||
| 4009 | + long_opt++; | ||
| 4010 | + argp_error (&parser->state, "--%s: %s", | ||
| 4011 | + long_opt->name ? long_opt->name : "???", | ||
| 4012 | + dgettext (parser->argp->argp_domain, bad_key_err)); | ||
| 4013 | + } | ||
| 4014 | + } | ||
| 4015 | + | ||
| 4016 | + return err; | ||
| 4017 | +} | ||
| 4018 | + | ||
| 4019 | +/* Parse the next argument in PARSER (as indicated by PARSER->state.next). | ||
| 4020 | + Any error from the parsers is returned, and *ARGP_EBADKEY indicates | ||
| 4021 | + whether a value of EBADKEY is due to an unrecognized argument (which is | ||
| 4022 | + generally not fatal). */ | ||
| 4023 | +static error_t | ||
| 4024 | +parser_parse_next (struct parser *parser, int *arg_ebadkey) | ||
| 4025 | +{ | ||
| 4026 | + int opt; | ||
| 4027 | + error_t err = 0; | ||
| 4028 | + | ||
| 4029 | + if (parser->state.quoted && parser->state.next < parser->state.quoted) | ||
| 4030 | + /* The next argument pointer has been moved to before the quoted | ||
| 4031 | + region, so pretend we never saw the quoting `--', and give getopt | ||
| 4032 | + another chance. If the user hasn't removed it, getopt will just | ||
| 4033 | + process it again. */ | ||
| 4034 | + parser->state.quoted = 0; | ||
| 4035 | + | ||
| 4036 | + if (parser->try_getopt && !parser->state.quoted) | ||
| 4037 | + /* Give getopt a chance to parse this. */ | ||
| 4038 | + { | ||
| 4039 | + /* Put it back in OPTIND for getopt. */ | ||
| 4040 | + parser->opt_data.optind = parser->state.next; | ||
| 4041 | + /* Distinguish KEY_ERR from a real option. */ | ||
| 4042 | + parser->opt_data.optopt = KEY_END; | ||
| 4043 | + if (parser->state.flags & ARGP_LONG_ONLY) | ||
| 4044 | + opt = _getopt_long_only_r (parser->state.argc, parser->state.argv, | ||
| 4045 | + parser->short_opts, parser->long_opts, 0, | ||
| 4046 | + &parser->opt_data); | ||
| 4047 | + else | ||
| 4048 | + opt = _getopt_long_r (parser->state.argc, parser->state.argv, | ||
| 4049 | + parser->short_opts, parser->long_opts, 0, | ||
| 4050 | + &parser->opt_data); | ||
| 4051 | + /* And see what getopt did. */ | ||
| 4052 | + parser->state.next = parser->opt_data.optind; | ||
| 4053 | + | ||
| 4054 | + if (opt == KEY_END) | ||
| 4055 | + /* Getopt says there are no more options, so stop using | ||
| 4056 | + getopt; we'll continue if necessary on our own. */ | ||
| 4057 | + { | ||
| 4058 | + parser->try_getopt = 0; | ||
| 4059 | + if (parser->state.next > 1 | ||
| 4060 | + && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) | ||
| 4061 | + == 0) | ||
| 4062 | + /* Not only is this the end of the options, but it's a | ||
| 4063 | + `quoted' region, which may have args that *look* like | ||
| 4064 | + options, so we definitely shouldn't try to use getopt past | ||
| 4065 | + here, whatever happens. */ | ||
| 4066 | + parser->state.quoted = parser->state.next; | ||
| 4067 | + } | ||
| 4068 | + else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END) | ||
| 4069 | + /* KEY_ERR can have the same value as a valid user short | ||
| 4070 | + option, but in the case of a real error, getopt sets OPTOPT | ||
| 4071 | + to the offending character, which can never be KEY_END. */ | ||
| 4072 | + { | ||
| 4073 | + *arg_ebadkey = 0; | ||
| 4074 | + return EBADKEY; | ||
| 4075 | + } | ||
| 4076 | + } | ||
| 4077 | + else | ||
| 4078 | + opt = KEY_END; | ||
| 4079 | + | ||
| 4080 | + if (opt == KEY_END) | ||
| 4081 | + { | ||
| 4082 | + /* We're past what getopt considers the options. */ | ||
| 4083 | + if (parser->state.next >= parser->state.argc | ||
| 4084 | + || (parser->state.flags & ARGP_NO_ARGS)) | ||
| 4085 | + /* Indicate that we're done. */ | ||
| 4086 | + { | ||
| 4087 | + *arg_ebadkey = 1; | ||
| 4088 | + return EBADKEY; | ||
| 4089 | + } | ||
| 4090 | + else | ||
| 4091 | + /* A non-option arg; simulate what getopt might have done. */ | ||
| 4092 | + { | ||
| 4093 | + opt = KEY_ARG; | ||
| 4094 | + parser->opt_data.optarg = parser->state.argv[parser->state.next++]; | ||
| 4095 | + } | ||
| 4096 | + } | ||
| 4097 | + | ||
| 4098 | + if (opt == KEY_ARG) | ||
| 4099 | + /* A non-option argument; try each parser in turn. */ | ||
| 4100 | + err = parser_parse_arg (parser, parser->opt_data.optarg); | ||
| 4101 | + else | ||
| 4102 | + err = parser_parse_opt (parser, opt, parser->opt_data.optarg); | ||
| 4103 | + | ||
| 4104 | + if (err == EBADKEY) | ||
| 4105 | + *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG); | ||
| 4106 | + | ||
| 4107 | + return err; | ||
| 4108 | +} | ||
| 4109 | + | ||
| 4110 | +/* Parse the options strings in ARGC & ARGV according to the argp in ARGP. | ||
| 4111 | + FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the | ||
| 4112 | + index in ARGV of the first unparsed option is returned in it. If an | ||
| 4113 | + unknown option is present, EINVAL is returned; if some parser routine | ||
| 4114 | + returned a non-zero value, it is returned; otherwise 0 is returned. */ | ||
| 4115 | +error_t | ||
| 4116 | +argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, | ||
| 4117 | + int *end_index, void *input) | ||
| 4118 | +{ | ||
| 4119 | + error_t err; | ||
| 4120 | + struct parser parser; | ||
| 4121 | + | ||
| 4122 | + /* If true, then err == EBADKEY is a result of a non-option argument failing | ||
| 4123 | + to be parsed (which in some cases isn't actually an error). */ | ||
| 4124 | + int arg_ebadkey = 0; | ||
| 4125 | + | ||
| 4126 | + if (! (flags & ARGP_NO_HELP)) | ||
| 4127 | + /* Add our own options. */ | ||
| 4128 | + { | ||
| 4129 | + struct argp_child *child = alloca (4 * sizeof (struct argp_child)); | ||
| 4130 | + struct argp *top_argp = alloca (sizeof (struct argp)); | ||
| 4131 | + | ||
| 4132 | + /* TOP_ARGP has no options, it just serves to group the user & default | ||
| 4133 | + argps. */ | ||
| 4134 | + memset (top_argp, 0, sizeof (*top_argp)); | ||
| 4135 | + top_argp->children = child; | ||
| 4136 | + | ||
| 4137 | + memset (child, 0, 4 * sizeof (struct argp_child)); | ||
| 4138 | + | ||
| 4139 | + if (argp) | ||
| 4140 | + (child++)->argp = argp; | ||
| 4141 | + (child++)->argp = &argp_default_argp; | ||
| 4142 | + if (argp_program_version || argp_program_version_hook) | ||
| 4143 | + (child++)->argp = &argp_version_argp; | ||
| 4144 | + child->argp = 0; | ||
| 4145 | + | ||
| 4146 | + argp = top_argp; | ||
| 4147 | + } | ||
| 4148 | + | ||
| 4149 | + /* Construct a parser for these arguments. */ | ||
| 4150 | + err = parser_init (&parser, argp, argc, argv, flags, input); | ||
| 4151 | + | ||
| 4152 | + if (! err) | ||
| 4153 | + /* Parse! */ | ||
| 4154 | + { | ||
| 4155 | + while (! err) | ||
| 4156 | + err = parser_parse_next (&parser, &arg_ebadkey); | ||
| 4157 | + err = parser_finalize (&parser, err, arg_ebadkey, end_index); | ||
| 4158 | + } | ||
| 4159 | + | ||
| 4160 | + return err; | ||
| 4161 | +} | ||
| 4162 | + | ||
| 4163 | +/* Return the input field for ARGP in the parser corresponding to STATE; used | ||
| 4164 | + by the help routines. */ | ||
| 4165 | +void * | ||
| 4166 | +__argp_input (const struct argp *argp, const struct argp_state *state) | ||
| 4167 | +{ | ||
| 4168 | + if (state) | ||
| 4169 | + { | ||
| 4170 | + struct group *group; | ||
| 4171 | + struct parser *parser = state->pstate; | ||
| 4172 | + | ||
| 4173 | + for (group = parser->groups; group < parser->egroup; group++) | ||
| 4174 | + if (group->argp == argp) | ||
| 4175 | + return group->input; | ||
| 4176 | + } | ||
| 4177 | + | ||
| 4178 | + return 0; | ||
| 4179 | +} | ||
| 4180 | Index: git/libuargp/argp-pv.c | ||
| 4181 | =================================================================== | ||
| 4182 | --- /dev/null | ||
| 4183 | +++ git/libuargp/argp-pv.c | ||
| 4184 | @@ -0,0 +1,25 @@ | ||
| 4185 | +/* Default definition for ARGP_PROGRAM_VERSION. | ||
| 4186 | + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. | ||
| 4187 | + This file is part of the GNU C Library. | ||
| 4188 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 4189 | + | ||
| 4190 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 4191 | + modify it under the terms of the GNU Lesser General Public | ||
| 4192 | + License as published by the Free Software Foundation; either | ||
| 4193 | + version 2.1 of the License, or (at your option) any later version. | ||
| 4194 | + | ||
| 4195 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 4196 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 4197 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 4198 | + Lesser General Public License for more details. | ||
| 4199 | + | ||
| 4200 | + You should have received a copy of the GNU Lesser General Public | ||
| 4201 | + License along with the GNU C Library; if not, write to the Free | ||
| 4202 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 4203 | + 02111-1307 USA. */ | ||
| 4204 | + | ||
| 4205 | +/* If set by the user program to a non-zero value, then a default option | ||
| 4206 | + --version is added (unless the ARGP_NO_HELP flag is used), which will | ||
| 4207 | + print this this string followed by a newline and exit (unless the | ||
| 4208 | + ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ | ||
| 4209 | +const char *argp_program_version; | ||
| 4210 | Index: git/libuargp/argp-pvh.c | ||
| 4211 | =================================================================== | ||
| 4212 | --- /dev/null | ||
| 4213 | +++ git/libuargp/argp-pvh.c | ||
| 4214 | @@ -0,0 +1,32 @@ | ||
| 4215 | +/* Default definition for ARGP_PROGRAM_VERSION_HOOK. | ||
| 4216 | + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. | ||
| 4217 | + This file is part of the GNU C Library. | ||
| 4218 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 4219 | + | ||
| 4220 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 4221 | + modify it under the terms of the GNU Lesser General Public | ||
| 4222 | + License as published by the Free Software Foundation; either | ||
| 4223 | + version 2.1 of the License, or (at your option) any later version. | ||
| 4224 | + | ||
| 4225 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 4226 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 4227 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 4228 | + Lesser General Public License for more details. | ||
| 4229 | + | ||
| 4230 | + You should have received a copy of the GNU Lesser General Public | ||
| 4231 | + License along with the GNU C Library; if not, write to the Free | ||
| 4232 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 4233 | + 02111-1307 USA. */ | ||
| 4234 | + | ||
| 4235 | +#ifdef HAVE_CONFIG_H | ||
| 4236 | +#include <config.h> | ||
| 4237 | +#endif | ||
| 4238 | + | ||
| 4239 | +#include <argp.h> | ||
| 4240 | + | ||
| 4241 | +/* If set by the user program to a non-zero value, then a default option | ||
| 4242 | + --version is added (unless the ARGP_NO_HELP flag is used), which calls | ||
| 4243 | + this function with a stream to print the version to and a pointer to the | ||
| 4244 | + current parsing state, and then exits (unless the ARGP_NO_EXIT flag is | ||
| 4245 | + used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ | ||
| 4246 | +void (*argp_program_version_hook) (FILE *stream, struct argp_state *state); | ||
| 4247 | Index: git/libuargp/argp-xinl.c | ||
| 4248 | =================================================================== | ||
| 4249 | --- /dev/null | ||
| 4250 | +++ git/libuargp/argp-xinl.c | ||
| 4251 | @@ -0,0 +1,35 @@ | ||
| 4252 | +/* Real definitions for extern inline functions in argp.h | ||
| 4253 | + Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. | ||
| 4254 | + This file is part of the GNU C Library. | ||
| 4255 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 4256 | + | ||
| 4257 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 4258 | + modify it under the terms of the GNU Lesser General Public | ||
| 4259 | + License as published by the Free Software Foundation; either | ||
| 4260 | + version 2.1 of the License, or (at your option) any later version. | ||
| 4261 | + | ||
| 4262 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 4263 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 4264 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 4265 | + Lesser General Public License for more details. | ||
| 4266 | + | ||
| 4267 | + You should have received a copy of the GNU Lesser General Public | ||
| 4268 | + License along with the GNU C Library; if not, write to the Free | ||
| 4269 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 4270 | + 02111-1307 USA. */ | ||
| 4271 | + | ||
| 4272 | +#ifdef HAVE_CONFIG_H | ||
| 4273 | +# include <config.h> | ||
| 4274 | +#endif | ||
| 4275 | + | ||
| 4276 | +#if defined _LIBC || defined HAVE_FEATURES_H | ||
| 4277 | +# include <features.h> | ||
| 4278 | +#endif | ||
| 4279 | + | ||
| 4280 | +#ifndef __USE_EXTERN_INLINES | ||
| 4281 | +# define __USE_EXTERN_INLINES 1 | ||
| 4282 | +#endif | ||
| 4283 | +#define ARGP_EI | ||
| 4284 | +#undef __OPTIMIZE__ | ||
| 4285 | +#define __OPTIMIZE__ 1 | ||
| 4286 | +#include <argp.h> | ||
| 4287 | Index: git/test/argp/Makefile | ||
| 4288 | =================================================================== | ||
| 4289 | --- /dev/null | ||
| 4290 | +++ git/test/argp/Makefile | ||
| 4291 | @@ -0,0 +1,7 @@ | ||
| 4292 | +# uClibc argp tests | ||
| 4293 | +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
| 4294 | + | ||
| 4295 | +top_builddir=../../ | ||
| 4296 | +include ../Rules.mak | ||
| 4297 | +-include Makefile.in | ||
| 4298 | +include ../Test.mak | ||
| 4299 | Index: git/test/argp/Makefile.in | ||
| 4300 | =================================================================== | ||
| 4301 | --- /dev/null | ||
| 4302 | +++ git/test/argp/Makefile.in | ||
| 4303 | @@ -0,0 +1,12 @@ | ||
| 4304 | +# uClibc argp tests | ||
| 4305 | +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
| 4306 | + | ||
| 4307 | +TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \ | ||
| 4308 | + bug-argp1 tst-argp1 tst-argp2 | ||
| 4309 | + | ||
| 4310 | +EXTRA_LDFLAGS = -luargp | ||
| 4311 | + | ||
| 4312 | +OPTS_argp-ex3 = ARG1 ARG2 | ||
| 4313 | +OPTS_argp-ex4 = ARG1 string1 string2 string3 | ||
| 4314 | +OPTS_bug-argp1 = -- --help | ||
| 4315 | + | ||
| 4316 | Index: git/test/argp/argp-ex1.c | ||
| 4317 | =================================================================== | ||
| 4318 | --- /dev/null | ||
| 4319 | +++ git/test/argp/argp-ex1.c | ||
| 4320 | @@ -0,0 +1,15 @@ | ||
| 4321 | +/* Argp example #1 -- a minimal program using argp */ | ||
| 4322 | + | ||
| 4323 | +/* This is (probably) the smallest possible program that | ||
| 4324 | + uses argp. It won't do much except give an error | ||
| 4325 | + messages and exit when there are any arguments, and print | ||
| 4326 | + a (rather pointless) messages for --help. */ | ||
| 4327 | + | ||
| 4328 | +#include <stdlib.h> | ||
| 4329 | +#include <argp.h> | ||
| 4330 | + | ||
| 4331 | +int main (int argc, char **argv) | ||
| 4332 | +{ | ||
| 4333 | + argp_parse (0, argc, argv, 0, 0, 0); | ||
| 4334 | + exit (0); | ||
| 4335 | +} | ||
| 4336 | Index: git/test/argp/argp-ex2.c | ||
| 4337 | =================================================================== | ||
| 4338 | --- /dev/null | ||
| 4339 | +++ git/test/argp/argp-ex2.c | ||
| 4340 | @@ -0,0 +1,45 @@ | ||
| 4341 | +/* Argp example #2 -- a pretty minimal program using argp */ | ||
| 4342 | + | ||
| 4343 | +/* This program doesn't use any options or arguments, but uses | ||
| 4344 | + argp to be compliant with the GNU standard command line | ||
| 4345 | + format. | ||
| 4346 | + | ||
| 4347 | + In addition to making sure no arguments are given, and | ||
| 4348 | + implementing a --help option, this example will have a | ||
| 4349 | + --version option, and will put the given documentation string | ||
| 4350 | + and bug address in the --help output, as per GNU standards. | ||
| 4351 | + | ||
| 4352 | + The variable ARGP contains the argument parser specification; | ||
| 4353 | + adding fields to this structure is the way most parameters are | ||
| 4354 | + passed to argp_parse (the first three fields are usually used, | ||
| 4355 | + but not in this small program). There are also two global | ||
| 4356 | + variables that argp knows about defined here, | ||
| 4357 | + ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are | ||
| 4358 | + global variables because they will almost always be constant | ||
| 4359 | + for a given program, even if it uses different argument | ||
| 4360 | + parsers for various tasks). */ | ||
| 4361 | + | ||
| 4362 | +#include <stdlib.h> | ||
| 4363 | +#include <argp.h> | ||
| 4364 | + | ||
| 4365 | +const char *argp_program_version = | ||
| 4366 | + "argp-ex2 1.0"; | ||
| 4367 | +const char *argp_program_bug_address = | ||
| 4368 | + "<bug-gnu-utils@@gnu.org>"; | ||
| 4369 | + | ||
| 4370 | +/* Program documentation. */ | ||
| 4371 | +static char doc[] = | ||
| 4372 | + "Argp example #2 -- a pretty minimal program using argp"; | ||
| 4373 | + | ||
| 4374 | +/* Our argument parser. The @code{options}, @code{parser}, and | ||
| 4375 | + @code{args_doc} fields are zero because we have neither options or | ||
| 4376 | + arguments; @code{doc} and @code{argp_program_bug_address} will be | ||
| 4377 | + used in the output for @samp{--help}, and the @samp{--version} | ||
| 4378 | + option will print out @code{argp_program_version}. */ | ||
| 4379 | +static struct argp argp = { 0, 0, 0, doc }; | ||
| 4380 | + | ||
| 4381 | +int main (int argc, char **argv) | ||
| 4382 | +{ | ||
| 4383 | + argp_parse (&argp, argc, argv, 0, 0, 0); | ||
| 4384 | + exit (0); | ||
| 4385 | +} | ||
| 4386 | Index: git/test/argp/argp-ex3.c | ||
| 4387 | =================================================================== | ||
| 4388 | --- /dev/null | ||
| 4389 | +++ git/test/argp/argp-ex3.c | ||
| 4390 | @@ -0,0 +1,153 @@ | ||
| 4391 | +/* Argp example #3 -- a program with options and arguments using argp */ | ||
| 4392 | + | ||
| 4393 | +/* This program uses the same features as example 2, and uses options and | ||
| 4394 | + arguments. | ||
| 4395 | + | ||
| 4396 | + We now use the first four fields in ARGP, so here's a description of them: | ||
| 4397 | + OPTIONS -- A pointer to a vector of struct argp_option (see below) | ||
| 4398 | + PARSER -- A function to parse a single option, called by argp | ||
| 4399 | + ARGS_DOC -- A string describing how the non-option arguments should look | ||
| 4400 | + DOC -- A descriptive string about this program; if it contains a | ||
| 4401 | + vertical tab character (\v), the part after it will be | ||
| 4402 | + printed *following* the options | ||
| 4403 | + | ||
| 4404 | + The function PARSER takes the following arguments: | ||
| 4405 | + KEY -- An integer specifying which option this is (taken | ||
| 4406 | + from the KEY field in each struct argp_option), or | ||
| 4407 | + a special key specifying something else; the only | ||
| 4408 | + special keys we use here are ARGP_KEY_ARG, meaning | ||
| 4409 | + a non-option argument, and ARGP_KEY_END, meaning | ||
| 4410 | + that all arguments have been parsed | ||
| 4411 | + ARG -- For an option KEY, the string value of its | ||
| 4412 | + argument, or NULL if it has none | ||
| 4413 | + STATE-- A pointer to a struct argp_state, containing | ||
| 4414 | + various useful information about the parsing state; used here | ||
| 4415 | + are the INPUT field, which reflects the INPUT argument to | ||
| 4416 | + argp_parse, and the ARG_NUM field, which is the number of the | ||
| 4417 | + current non-option argument being parsed | ||
| 4418 | + It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the | ||
| 4419 | + given KEY wasn't recognized, or an errno value indicating some other | ||
| 4420 | + error. | ||
| 4421 | + | ||
| 4422 | + Note that in this example, main uses a structure to communicate with the | ||
| 4423 | + parse_opt function, a pointer to which it passes in the INPUT argument to | ||
| 4424 | + argp_parse. Of course, it's also possible to use global variables | ||
| 4425 | + instead, but this is somewhat more flexible. | ||
| 4426 | + | ||
| 4427 | + The OPTIONS field contains a pointer to a vector of struct argp_option's; | ||
| 4428 | + that structure has the following fields (if you assign your option | ||
| 4429 | + structures using array initialization like this example, unspecified | ||
| 4430 | + fields will be defaulted to 0, and need not be specified): | ||
| 4431 | + NAME -- The name of this option's long option (may be zero) | ||
| 4432 | + KEY -- The KEY to pass to the PARSER function when parsing this option, | ||
| 4433 | + *and* the name of this option's short option, if it is a | ||
| 4434 | + printable ascii character | ||
| 4435 | + ARG -- The name of this option's argument, if any | ||
| 4436 | + FLAGS -- Flags describing this option; some of them are: | ||
| 4437 | + OPTION_ARG_OPTIONAL -- The argument to this option is optional | ||
| 4438 | + OPTION_ALIAS -- This option is an alias for the | ||
| 4439 | + previous option | ||
| 4440 | + OPTION_HIDDEN -- Don't show this option in --help output | ||
| 4441 | + DOC -- A documentation string for this option, shown in --help output | ||
| 4442 | + | ||
| 4443 | + An options vector should be terminated by an option with all fields zero. */ | ||
| 4444 | + | ||
| 4445 | +#include <stdlib.h> | ||
| 4446 | +#include <argp.h> | ||
| 4447 | + | ||
| 4448 | +const char *argp_program_version = | ||
| 4449 | + "argp-ex3 1.0"; | ||
| 4450 | +const char *argp_program_bug_address = | ||
| 4451 | + "<bug-gnu-utils@@gnu.org>"; | ||
| 4452 | + | ||
| 4453 | +/* Program documentation. */ | ||
| 4454 | +static char doc[] = | ||
| 4455 | + "Argp example #3 -- a program with options and arguments using argp"; | ||
| 4456 | + | ||
| 4457 | +/* A description of the arguments we accept. */ | ||
| 4458 | +static char args_doc[] = "ARG1 ARG2"; | ||
| 4459 | + | ||
| 4460 | +/* The options we understand. */ | ||
| 4461 | +static struct argp_option options[] = { | ||
| 4462 | + {"verbose", 'v', 0, 0, "Produce verbose output" }, | ||
| 4463 | + {"quiet", 'q', 0, 0, "Don't produce any output" }, | ||
| 4464 | + {"silent", 's', 0, OPTION_ALIAS }, | ||
| 4465 | + {"output", 'o', "FILE", 0, | ||
| 4466 | + "Output to FILE instead of standard output" }, | ||
| 4467 | + { 0 } | ||
| 4468 | +}; | ||
| 4469 | + | ||
| 4470 | +/* Used by @code{main} to communicate with @code{parse_opt}. */ | ||
| 4471 | +struct arguments | ||
| 4472 | +{ | ||
| 4473 | + char *args[2]; /* @var{arg1} & @var{arg2} */ | ||
| 4474 | + int silent, verbose; | ||
| 4475 | + char *output_file; | ||
| 4476 | +}; | ||
| 4477 | + | ||
| 4478 | +/* Parse a single option. */ | ||
| 4479 | +static error_t | ||
| 4480 | +parse_opt (int key, char *arg, struct argp_state *state) | ||
| 4481 | +{ | ||
| 4482 | + /* Get the @var{input} argument from @code{argp_parse}, which we | ||
| 4483 | + know is a pointer to our arguments structure. */ | ||
| 4484 | + struct arguments *arguments = state->input; | ||
| 4485 | + | ||
| 4486 | + switch (key) | ||
| 4487 | + { | ||
| 4488 | + case 'q': case 's': | ||
| 4489 | + arguments->silent = 1; | ||
| 4490 | + break; | ||
| 4491 | + case 'v': | ||
| 4492 | + arguments->verbose = 1; | ||
| 4493 | + break; | ||
| 4494 | + case 'o': | ||
| 4495 | + arguments->output_file = arg; | ||
| 4496 | + break; | ||
| 4497 | + | ||
| 4498 | + case ARGP_KEY_ARG: | ||
| 4499 | + if (state->arg_num >= 2) | ||
| 4500 | + /* Too many arguments. */ | ||
| 4501 | + argp_usage (state); | ||
| 4502 | + | ||
| 4503 | + arguments->args[state->arg_num] = arg; | ||
| 4504 | + | ||
| 4505 | + break; | ||
| 4506 | + | ||
| 4507 | + case ARGP_KEY_END: | ||
| 4508 | + if (state->arg_num < 2) | ||
| 4509 | + /* Not enough arguments. */ | ||
| 4510 | + argp_usage (state); | ||
| 4511 | + break; | ||
| 4512 | + | ||
| 4513 | + default: | ||
| 4514 | + return ARGP_ERR_UNKNOWN; | ||
| 4515 | + } | ||
| 4516 | + return 0; | ||
| 4517 | +} | ||
| 4518 | + | ||
| 4519 | +/* Our argp parser. */ | ||
| 4520 | +static struct argp argp = { options, parse_opt, args_doc, doc }; | ||
| 4521 | + | ||
| 4522 | +int main (int argc, char **argv) | ||
| 4523 | +{ | ||
| 4524 | + struct arguments arguments; | ||
| 4525 | + | ||
| 4526 | + /* Default values. */ | ||
| 4527 | + arguments.silent = 0; | ||
| 4528 | + arguments.verbose = 0; | ||
| 4529 | + arguments.output_file = "-"; | ||
| 4530 | + | ||
| 4531 | + /* Parse our arguments; every option seen by @code{parse_opt} will | ||
| 4532 | + be reflected in @code{arguments}. */ | ||
| 4533 | + argp_parse (&argp, argc, argv, 0, 0, &arguments); | ||
| 4534 | + | ||
| 4535 | + printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n" | ||
| 4536 | + "VERBOSE = %s\nSILENT = %s\n", | ||
| 4537 | + arguments.args[0], arguments.args[1], | ||
| 4538 | + arguments.output_file, | ||
| 4539 | + arguments.verbose ? "yes" : "no", | ||
| 4540 | + arguments.silent ? "yes" : "no"); | ||
| 4541 | + | ||
| 4542 | + exit (0); | ||
| 4543 | +} | ||
| 4544 | Index: git/test/argp/argp-ex4.c | ||
| 4545 | =================================================================== | ||
| 4546 | --- /dev/null | ||
| 4547 | +++ git/test/argp/argp-ex4.c | ||
| 4548 | @@ -0,0 +1,167 @@ | ||
| 4549 | +/* Argp example #4 -- a program with somewhat more complicated options */ | ||
| 4550 | + | ||
| 4551 | +/* This program uses the same features as example 3, but has more | ||
| 4552 | + options, and somewhat more structure in the -help output. It | ||
| 4553 | + also shows how you can `steal' the remainder of the input | ||
| 4554 | + arguments past a certain point, for programs that accept a | ||
| 4555 | + list of items. It also shows the special argp KEY value | ||
| 4556 | + ARGP_KEY_NO_ARGS, which is only given if no non-option | ||
| 4557 | + arguments were supplied to the program. | ||
| 4558 | + | ||
| 4559 | + For structuring the help output, two features are used, | ||
| 4560 | + *headers* which are entries in the options vector with the | ||
| 4561 | + first four fields being zero, and a two part documentation | ||
| 4562 | + string (in the variable DOC), which allows documentation both | ||
| 4563 | + before and after the options; the two parts of DOC are | ||
| 4564 | + separated by a vertical-tab character ('\v', or '\013'). By | ||
| 4565 | + convention, the documentation before the options is just a | ||
| 4566 | + short string saying what the program does, and that afterwards | ||
| 4567 | + is longer, describing the behavior in more detail. All | ||
| 4568 | + documentation strings are automatically filled for output, | ||
| 4569 | + although newlines may be included to force a line break at a | ||
| 4570 | + particular point. All documentation strings are also passed to | ||
| 4571 | + the `gettext' function, for possible translation into the | ||
| 4572 | + current locale. */ | ||
| 4573 | + | ||
| 4574 | +#include <stdlib.h> | ||
| 4575 | +#include <error.h> | ||
| 4576 | +#include <argp.h> | ||
| 4577 | + | ||
| 4578 | +const char *argp_program_version = | ||
| 4579 | + "argp-ex4 1.0"; | ||
| 4580 | +const char *argp_program_bug_address = | ||
| 4581 | + "<bug-gnu-utils@@prep.ai.mit.edu>"; | ||
| 4582 | + | ||
| 4583 | +/* Program documentation. */ | ||
| 4584 | +static char doc[] = | ||
| 4585 | + "Argp example #4 -- a program with somewhat more complicated\ | ||
| 4586 | +options\ | ||
| 4587 | +\vThis part of the documentation comes *after* the options;\ | ||
| 4588 | + note that the text is automatically filled, but it's possible\ | ||
| 4589 | + to force a line-break, e.g.\n<-- here."; | ||
| 4590 | + | ||
| 4591 | +/* A description of the arguments we accept. */ | ||
| 4592 | +static char args_doc[] = "ARG1 [STRING...]"; | ||
| 4593 | + | ||
| 4594 | +/* Keys for options without short-options. */ | ||
| 4595 | +#define OPT_ABORT 1 /* --abort */ | ||
| 4596 | + | ||
| 4597 | +/* The options we understand. */ | ||
| 4598 | +static struct argp_option options[] = { | ||
| 4599 | + {"verbose", 'v', 0, 0, "Produce verbose output" }, | ||
| 4600 | + {"quiet", 'q', 0, 0, "Don't produce any output" }, | ||
| 4601 | + {"silent", 's', 0, OPTION_ALIAS }, | ||
| 4602 | + {"output", 'o', "FILE", 0, | ||
| 4603 | + "Output to FILE instead of standard output" }, | ||
| 4604 | + | ||
| 4605 | + {0,0,0,0, "The following options should be grouped together:" }, | ||
| 4606 | + {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL, | ||
| 4607 | + "Repeat the output COUNT (default 10) times"}, | ||
| 4608 | + {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"}, | ||
| 4609 | + | ||
| 4610 | + { 0 } | ||
| 4611 | +}; | ||
| 4612 | + | ||
| 4613 | +/* Used by @code{main} to communicate with @code{parse_opt}. */ | ||
| 4614 | +struct arguments | ||
| 4615 | +{ | ||
| 4616 | + char *arg1; /* @var{arg1} */ | ||
| 4617 | + char **strings; /* [@var{string}@dots{}] */ | ||
| 4618 | + int silent, verbose, abort; /* @samp{-s}, @samp{-v}, @samp{--abort} */ | ||
| 4619 | + char *output_file; /* @var{file} arg to @samp{--output} */ | ||
| 4620 | + int repeat_count; /* @var{count} arg to @samp{--repeat} */ | ||
| 4621 | +}; | ||
| 4622 | + | ||
| 4623 | +/* Parse a single option. */ | ||
| 4624 | +static error_t | ||
| 4625 | +parse_opt (int key, char *arg, struct argp_state *state) | ||
| 4626 | +{ | ||
| 4627 | + /* Get the @code{input} argument from @code{argp_parse}, which we | ||
| 4628 | + know is a pointer to our arguments structure. */ | ||
| 4629 | + struct arguments *arguments = state->input; | ||
| 4630 | + | ||
| 4631 | + switch (key) | ||
| 4632 | + { | ||
| 4633 | + case 'q': case 's': | ||
| 4634 | + arguments->silent = 1; | ||
| 4635 | + break; | ||
| 4636 | + case 'v': | ||
| 4637 | + arguments->verbose = 1; | ||
| 4638 | + break; | ||
| 4639 | + case 'o': | ||
| 4640 | + arguments->output_file = arg; | ||
| 4641 | + break; | ||
| 4642 | + case 'r': | ||
| 4643 | + arguments->repeat_count = arg ? atoi (arg) : 10; | ||
| 4644 | + break; | ||
| 4645 | + case OPT_ABORT: | ||
| 4646 | + arguments->abort = 1; | ||
| 4647 | + break; | ||
| 4648 | + | ||
| 4649 | + case ARGP_KEY_NO_ARGS: | ||
| 4650 | + argp_usage (state); | ||
| 4651 | + | ||
| 4652 | + case ARGP_KEY_ARG: | ||
| 4653 | + /* Here we know that @code{state->arg_num == 0}, since we | ||
| 4654 | + force argument parsing to end before any more arguments can | ||
| 4655 | + get here. */ | ||
| 4656 | + arguments->arg1 = arg; | ||
| 4657 | + | ||
| 4658 | + /* Now we consume all the rest of the arguments. | ||
| 4659 | + @code{state->next} is the index in @code{state->argv} of the | ||
| 4660 | + next argument to be parsed, which is the first @var{string} | ||
| 4661 | + we're interested in, so we can just use | ||
| 4662 | + @code{&state->argv[state->next]} as the value for | ||
| 4663 | + arguments->strings. | ||
| 4664 | + | ||
| 4665 | + @emph{In addition}, by setting @code{state->next} to the end | ||
| 4666 | + of the arguments, we can force argp to stop parsing here and | ||
| 4667 | + return. */ | ||
| 4668 | + arguments->strings = &state->argv[state->next]; | ||
| 4669 | + state->next = state->argc; | ||
| 4670 | + | ||
| 4671 | + break; | ||
| 4672 | + | ||
| 4673 | + default: | ||
| 4674 | + return ARGP_ERR_UNKNOWN; | ||
| 4675 | + } | ||
| 4676 | + return 0; | ||
| 4677 | +} | ||
| 4678 | + | ||
| 4679 | +/* Our argp parser. */ | ||
| 4680 | +static struct argp argp = { options, parse_opt, args_doc, doc }; | ||
| 4681 | + | ||
| 4682 | +int main (int argc, char **argv) | ||
| 4683 | +{ | ||
| 4684 | + int i, j; | ||
| 4685 | + struct arguments arguments; | ||
| 4686 | + | ||
| 4687 | + /* Default values. */ | ||
| 4688 | + arguments.silent = 0; | ||
| 4689 | + arguments.verbose = 0; | ||
| 4690 | + arguments.output_file = "-"; | ||
| 4691 | + arguments.repeat_count = 1; | ||
| 4692 | + arguments.abort = 0; | ||
| 4693 | + | ||
| 4694 | + /* Parse our arguments; every option seen by @code{parse_opt} will be | ||
| 4695 | + reflected in @code{arguments}. */ | ||
| 4696 | + argp_parse (&argp, argc, argv, 0, 0, &arguments); | ||
| 4697 | + | ||
| 4698 | + if (arguments.abort) | ||
| 4699 | + error (10, 0, "ABORTED"); | ||
| 4700 | + | ||
| 4701 | + for (i = 0; i < arguments.repeat_count; i++) | ||
| 4702 | + { | ||
| 4703 | + printf ("ARG1 = %s\n", arguments.arg1); | ||
| 4704 | + printf ("STRINGS = "); | ||
| 4705 | + for (j = 0; arguments.strings[j]; j++) | ||
| 4706 | + printf (j == 0 ? "%s" : ", %s", arguments.strings[j]); | ||
| 4707 | + printf ("\n"); | ||
| 4708 | + printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n", | ||
| 4709 | + arguments.output_file, | ||
| 4710 | + arguments.verbose ? "yes" : "no", | ||
| 4711 | + arguments.silent ? "yes" : "no"); | ||
| 4712 | + } | ||
| 4713 | + | ||
| 4714 | + exit (0); | ||
| 4715 | +} | ||
| 4716 | Index: git/test/argp/argp-test.c | ||
| 4717 | =================================================================== | ||
| 4718 | --- /dev/null | ||
| 4719 | +++ git/test/argp/argp-test.c | ||
| 4720 | @@ -0,0 +1,209 @@ | ||
| 4721 | +/* Test program for argp argument parser | ||
| 4722 | + Copyright (C) 1997 Free Software Foundation, Inc. | ||
| 4723 | + This file is part of the GNU C Library. | ||
| 4724 | + Written by Miles Bader <miles at gnu.ai.mit.edu>. | ||
| 4725 | + | ||
| 4726 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 4727 | + modify it under the terms of the GNU Lesser General Public | ||
| 4728 | + License as published by the Free Software Foundation; either | ||
| 4729 | + version 2.1 of the License, or (at your option) any later version. | ||
| 4730 | + | ||
| 4731 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 4732 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 4733 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 4734 | + Lesser General Public License for more details. | ||
| 4735 | + | ||
| 4736 | + You should have received a copy of the GNU Lesser General Public | ||
| 4737 | + License along with the GNU C Library; if not, write to the Free | ||
| 4738 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 4739 | + 02111-1307 USA. */ | ||
| 4740 | + | ||
| 4741 | +#ifdef HAVE_CONFIG_H | ||
| 4742 | +#include <config.h> | ||
| 4743 | +#endif | ||
| 4744 | + | ||
| 4745 | +#include <stdlib.h> | ||
| 4746 | +#include <time.h> | ||
| 4747 | +#include <string.h> | ||
| 4748 | +#include <argp.h> | ||
| 4749 | + | ||
| 4750 | +const char *argp_program_version = "argp-test 1.0"; | ||
| 4751 | + | ||
| 4752 | +struct argp_option sub_options[] = | ||
| 4753 | +{ | ||
| 4754 | + {"subopt1", 's', 0, 0, "Nested option 1"}, | ||
| 4755 | + {"subopt2", 'S', 0, 0, "Nested option 2"}, | ||
| 4756 | + | ||
| 4757 | + { 0, 0, 0, 0, "Some more nested options:", 10}, | ||
| 4758 | + {"subopt3", 'p', 0, 0, "Nested option 3"}, | ||
| 4759 | + | ||
| 4760 | + {"subopt4", 'q', 0, 0, "Nested option 4", 1}, | ||
| 4761 | + | ||
| 4762 | + {0} | ||
| 4763 | +}; | ||
| 4764 | + | ||
| 4765 | +static const char sub_args_doc[] = "STRING...\n-"; | ||
| 4766 | +static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser."; | ||
| 4767 | + | ||
| 4768 | +static error_t | ||
| 4769 | +sub_parse_opt (int key, char *arg, struct argp_state *state) | ||
| 4770 | +{ | ||
| 4771 | + switch (key) | ||
| 4772 | + { | ||
| 4773 | + case ARGP_KEY_NO_ARGS: | ||
| 4774 | + printf ("NO SUB ARGS\n"); | ||
| 4775 | + break; | ||
| 4776 | + case ARGP_KEY_ARG: | ||
| 4777 | + printf ("SUB ARG: %s\n", arg); | ||
| 4778 | + break; | ||
| 4779 | + | ||
| 4780 | + case 's' : case 'S': case 'p': case 'q': | ||
| 4781 | + printf ("SUB KEY %c\n", key); | ||
| 4782 | + break; | ||
| 4783 | + | ||
| 4784 | + default: | ||
| 4785 | + return ARGP_ERR_UNKNOWN; | ||
| 4786 | + } | ||
| 4787 | + return 0; | ||
| 4788 | +} | ||
| 4789 | + | ||
| 4790 | +static char * | ||
| 4791 | +sub_help_filter (int key, const char *text, void *input) | ||
| 4792 | +{ | ||
| 4793 | + if (key == ARGP_KEY_HELP_EXTRA) | ||
| 4794 | + return strdup ("This is some extra text from the sub parser (note that it \ | ||
| 4795 | +is preceded by a blank line)."); | ||
| 4796 | + else | ||
| 4797 | + return (char *)text; | ||
| 4798 | +} | ||
| 4799 | + | ||
| 4800 | +static struct argp sub_argp = { | ||
| 4801 | + sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter | ||
| 4802 | +}; | ||
| 4803 | + | ||
| 4804 | +/* Structure used to communicate with the parsing functions. */ | ||
| 4805 | +struct params | ||
| 4806 | +{ | ||
| 4807 | + unsigned foonly; /* Value parsed for foonly. */ | ||
| 4808 | + unsigned foonly_default; /* Default value for it. */ | ||
| 4809 | +}; | ||
| 4810 | + | ||
| 4811 | +#define OPT_PGRP 1 | ||
| 4812 | +#define OPT_SESS 2 | ||
| 4813 | + | ||
| 4814 | +struct argp_option options[] = | ||
| 4815 | +{ | ||
| 4816 | + {"pid", 'p', "PID", 0, "List the process PID"}, | ||
| 4817 | + {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"}, | ||
| 4818 | + {"no-parent", 'P', 0, 0, "Include processes without parents"}, | ||
| 4819 | + {0, 'x', 0, OPTION_ALIAS}, | ||
| 4820 | + {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" | ||
| 4821 | + " if there's some reason ps can't" | ||
| 4822 | + " print a field for any process, it's" | ||
| 4823 | + " removed from the output entirely)" }, | ||
| 4824 | + {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, | ||
| 4825 | + {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, | ||
| 4826 | + {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL, | ||
| 4827 | + "Add the processes from the session" | ||
| 4828 | + " SID (which defaults to the sid of" | ||
| 4829 | + " the current process)" }, | ||
| 4830 | + | ||
| 4831 | + {0,0,0,0, "Here are some more options:"}, | ||
| 4832 | + {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"}, | ||
| 4833 | + {"zaza", 'z', 0, 0, "Snit a zar"}, | ||
| 4834 | + | ||
| 4835 | + {0} | ||
| 4836 | +}; | ||
| 4837 | + | ||
| 4838 | +static const char args_doc[] = "STRING"; | ||
| 4839 | +static const char doc[] = "Test program for argp." | ||
| 4840 | + "\vThis doc string comes after the options." | ||
| 4841 | + "\nHey! Some manual formatting!" | ||
| 4842 | + "\nThe current time is: %s"; | ||
| 4843 | + | ||
| 4844 | +static void | ||
| 4845 | +popt (int key, char *arg) | ||
| 4846 | +{ | ||
| 4847 | + char buf[10]; | ||
| 4848 | + if (isprint (key)) | ||
| 4849 | + sprintf (buf, "%c", key); | ||
| 4850 | + else | ||
| 4851 | + sprintf (buf, "%d", key); | ||
| 4852 | + if (arg) | ||
| 4853 | + printf ("KEY %s: %s\n", buf, arg); | ||
| 4854 | + else | ||
| 4855 | + printf ("KEY %s\n", buf); | ||
| 4856 | +} | ||
| 4857 | + | ||
| 4858 | +static error_t | ||
| 4859 | +parse_opt (int key, char *arg, struct argp_state *state) | ||
| 4860 | +{ | ||
| 4861 | + struct params *params = state->input; | ||
| 4862 | + | ||
| 4863 | + switch (key) | ||
| 4864 | + { | ||
| 4865 | + case ARGP_KEY_NO_ARGS: | ||
| 4866 | + printf ("NO ARGS\n"); | ||
| 4867 | + break; | ||
| 4868 | + | ||
| 4869 | + case ARGP_KEY_ARG: | ||
| 4870 | + if (state->arg_num > 0) | ||
| 4871 | + return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */ | ||
| 4872 | + printf ("ARG: %s\n", arg); | ||
| 4873 | + break; | ||
| 4874 | + | ||
| 4875 | + case 'f': | ||
| 4876 | + if (arg) | ||
| 4877 | + params->foonly = atoi (arg); | ||
| 4878 | + else | ||
| 4879 | + params->foonly = params->foonly_default; | ||
| 4880 | + popt (key, arg); | ||
| 4881 | + break; | ||
| 4882 | + | ||
| 4883 | + case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q': | ||
| 4884 | + case 'r': case OPT_SESS: case 'z': | ||
| 4885 | + popt (key, arg); | ||
| 4886 | + break; | ||
| 4887 | + | ||
| 4888 | + default: | ||
| 4889 | + return ARGP_ERR_UNKNOWN; | ||
| 4890 | + } | ||
| 4891 | + return 0; | ||
| 4892 | +} | ||
| 4893 | + | ||
| 4894 | +static char * | ||
| 4895 | +help_filter (int key, const char *text, void *input) | ||
| 4896 | +{ | ||
| 4897 | + char *new_text; | ||
| 4898 | + struct params *params = input; | ||
| 4899 | + | ||
| 4900 | + if (key == ARGP_KEY_HELP_POST_DOC && text) | ||
| 4901 | + { | ||
| 4902 | + time_t now = time (0); | ||
| 4903 | + asprintf (&new_text, text, ctime (&now)); | ||
| 4904 | + } | ||
| 4905 | + else if (key == 'f') | ||
| 4906 | + /* Show the default for the --foonly option. */ | ||
| 4907 | + asprintf (&new_text, "%s (ZOT defaults to %x)", | ||
| 4908 | + text, params->foonly_default); | ||
| 4909 | + else | ||
| 4910 | + new_text = (char *)text; | ||
| 4911 | + | ||
| 4912 | + return new_text; | ||
| 4913 | +} | ||
| 4914 | + | ||
| 4915 | +static struct argp_child argp_children[] = { { &sub_argp }, { 0 } }; | ||
| 4916 | +static struct argp argp = { | ||
| 4917 | + options, parse_opt, args_doc, doc, argp_children, help_filter | ||
| 4918 | +}; | ||
| 4919 | + | ||
| 4920 | +int | ||
| 4921 | +main (int argc, char **argv) | ||
| 4922 | +{ | ||
| 4923 | + struct params params; | ||
| 4924 | + params.foonly = 0; | ||
| 4925 | + params.foonly_default = random (); | ||
| 4926 | + argp_parse (&argp, argc, argv, 0, 0, ¶ms); | ||
| 4927 | + printf ("After parsing: foonly = %x\n", params.foonly); | ||
| 4928 | + return 0; | ||
| 4929 | +} | ||
| 4930 | Index: git/test/argp/bug-argp1.c | ||
| 4931 | =================================================================== | ||
| 4932 | --- /dev/null | ||
| 4933 | +++ git/test/argp/bug-argp1.c | ||
| 4934 | @@ -0,0 +1,26 @@ | ||
| 4935 | +#include <argp.h> | ||
| 4936 | + | ||
| 4937 | + | ||
| 4938 | +static const struct argp_option test_options[] = | ||
| 4939 | +{ | ||
| 4940 | + { NULL, 'a', NULL, OPTION_DOC, NULL }, | ||
| 4941 | + { NULL, 'b', NULL, OPTION_DOC, NULL }, | ||
| 4942 | + { NULL, 0, NULL, 0, NULL } | ||
| 4943 | +}; | ||
| 4944 | + | ||
| 4945 | +static struct argp test_argp = | ||
| 4946 | +{ | ||
| 4947 | + test_options | ||
| 4948 | +}; | ||
| 4949 | + | ||
| 4950 | + | ||
| 4951 | +static int | ||
| 4952 | +do_test (int argc, char *argv[]) | ||
| 4953 | +{ | ||
| 4954 | + int i; | ||
| 4955 | + argp_parse (&test_argp, argc, argv, 0, &i, NULL); | ||
| 4956 | + return 0; | ||
| 4957 | +} | ||
| 4958 | + | ||
| 4959 | +#define TEST_FUNCTION do_test (argc, argv) | ||
| 4960 | +#include "../test-skeleton.c" | ||
| 4961 | Index: git/test/argp/tst-argp1.c | ||
| 4962 | =================================================================== | ||
| 4963 | --- /dev/null | ||
| 4964 | +++ git/test/argp/tst-argp1.c | ||
| 4965 | @@ -0,0 +1,118 @@ | ||
| 4966 | +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. | ||
| 4967 | + This file is part of the GNU C Library. | ||
| 4968 | + Contributed by Ulrich Drepper <drepper at redhat.com>, 2002. | ||
| 4969 | + | ||
| 4970 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 4971 | + modify it under the terms of the GNU Lesser General Public | ||
| 4972 | + License as published by the Free Software Foundation; either | ||
| 4973 | + version 2.1 of the License, or (at your option) any later version. | ||
| 4974 | + | ||
| 4975 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 4976 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 4977 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 4978 | + Lesser General Public License for more details. | ||
| 4979 | + | ||
| 4980 | + You should have received a copy of the GNU Lesser General Public | ||
| 4981 | + License along with the GNU C Library; if not, write to the Free | ||
| 4982 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 4983 | + 02111-1307 USA. */ | ||
| 4984 | + | ||
| 4985 | +#include <argp.h> | ||
| 4986 | + | ||
| 4987 | + | ||
| 4988 | + | ||
| 4989 | + | ||
| 4990 | +#define OPT_TO_THREAD 300 | ||
| 4991 | +#define OPT_TO_PROCESS 301 | ||
| 4992 | +#define OPT_SYNC_SIGNAL 302 | ||
| 4993 | +#define OPT_SYNC_JOIN 303 | ||
| 4994 | +#define OPT_TOPLEVEL 304 | ||
| 4995 | + | ||
| 4996 | + | ||
| 4997 | +static const struct argp_option test_options[] = | ||
| 4998 | + { | ||
| 4999 | + { NULL, 0, NULL, 0, "\ | ||
| 5000 | +This is a test for threads so we allow ther user to selection the number of \ | ||
| 5001 | +threads which are used at any one time. Independently the total number of \ | ||
| 5002 | +rounds can be selected. This is the total number of threads which will have \ | ||
| 5003 | +run when the process terminates:" }, | ||
| 5004 | + { "threads", 't', "NUMBER", 0, "Number of threads used at once" }, | ||
| 5005 | + { "starts", 's', "NUMBER", 0, "Total number of working threads" }, | ||
| 5006 | + { "toplevel", OPT_TOPLEVEL, "NUMBER", 0, | ||
| 5007 | + "Number of toplevel threads which start the other threads; this \ | ||
| 5008 | +implies --sync-join" }, | ||
| 5009 | + | ||
| 5010 | + { NULL, 0, NULL, 0, "\ | ||
| 5011 | +Each thread can do one of two things: sleep or do work. The latter is 100% \ | ||
| 5012 | +CPU bound. The work load is the probability a thread does work. All values \ | ||
| 5013 | +from zero to 100 (inclusive) are valid. How often each thread repeats this \ | ||
| 5014 | +can be determined by the number of rounds. The work cost determines how long \ | ||
| 5015 | +each work session (not sleeping) takes. If it is zero a thread would \ | ||
| 5016 | +effectively nothing. By setting the number of rounds to zero the thread \ | ||
| 5017 | +does no work at all and pure thread creation times can be measured." }, | ||
| 5018 | + { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" }, | ||
| 5019 | + { "workcost", 'c', "NUMBER", 0, | ||
| 5020 | + "Factor in the cost of each round of working" }, | ||
| 5021 | + { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" }, | ||
| 5022 | + | ||
| 5023 | + { NULL, 0, NULL, 0, "\ | ||
| 5024 | +There are a number of different methods how thread creation can be \ | ||
| 5025 | +synchronized. Synchronization is necessary since the number of concurrently \ | ||
| 5026 | +running threads is limited." }, | ||
| 5027 | + { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0, | ||
| 5028 | + "Synchronize using a signal (default)" }, | ||
| 5029 | + { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" }, | ||
| 5030 | + | ||
| 5031 | + { NULL, 0, NULL, 0, "\ | ||
| 5032 | +One parameter for each threads execution is the size of the stack. If this \ | ||
| 5033 | +parameter is not used the system's default stack size is used. If many \ | ||
| 5034 | +threads are used the stack size should be chosen quite small." }, | ||
| 5035 | + { "stacksize", 'S', "BYTES", 0, "Size of threads stack" }, | ||
| 5036 | + { "guardsize", 'g', "BYTES", 0, | ||
| 5037 | + "Size of stack guard area; must fit into the stack" }, | ||
| 5038 | + | ||
| 5039 | + { NULL, 0, NULL, 0, "Signal options:" }, | ||
| 5040 | + { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" }, | ||
| 5041 | + { "to-process", OPT_TO_PROCESS, NULL, 0, | ||
| 5042 | + "Send signal to process (default)" }, | ||
| 5043 | + | ||
| 5044 | + { NULL, 0, NULL, 0, "Administrative options:" }, | ||
| 5045 | + { "progress", 'p', NULL, 0, "Show signs of progress" }, | ||
| 5046 | + { "timing", 'T', NULL, 0, | ||
| 5047 | + "Measure time from startup to the last thread finishing" }, | ||
| 5048 | + { NULL, 0, NULL, 0, NULL } | ||
| 5049 | + }; | ||
| 5050 | + | ||
| 5051 | +/* Prototype for option handler. */ | ||
| 5052 | +static error_t parse_opt (int key, char *arg, struct argp_state *state); | ||
| 5053 | + | ||
| 5054 | +/* Data structure to communicate with argp functions. */ | ||
| 5055 | +static struct argp argp = | ||
| 5056 | +{ | ||
| 5057 | + test_options, parse_opt | ||
| 5058 | +}; | ||
| 5059 | + | ||
| 5060 | + | ||
| 5061 | +static int | ||
| 5062 | +do_test (void) | ||
| 5063 | +{ | ||
| 5064 | + int argc = 2; | ||
| 5065 | + char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL }; | ||
| 5066 | + int remaining; | ||
| 5067 | + | ||
| 5068 | + /* Parse and process arguments. */ | ||
| 5069 | + argp_parse (&argp, argc, argv, 0, &remaining, NULL); | ||
| 5070 | + | ||
| 5071 | + return 0; | ||
| 5072 | +} | ||
| 5073 | + | ||
| 5074 | + | ||
| 5075 | +/* Handle program arguments. */ | ||
| 5076 | +static error_t | ||
| 5077 | +parse_opt (int key, char *arg, struct argp_state *state) | ||
| 5078 | +{ | ||
| 5079 | + return ARGP_ERR_UNKNOWN; | ||
| 5080 | +} | ||
| 5081 | + | ||
| 5082 | +#define TEST_FUNCTION do_test () | ||
| 5083 | +#include "../test-skeleton.c" | ||
| 5084 | Index: git/test/argp/tst-argp2.c | ||
| 5085 | =================================================================== | ||
| 5086 | --- /dev/null | ||
| 5087 | +++ git/test/argp/tst-argp2.c | ||
| 5088 | @@ -0,0 +1,101 @@ | ||
| 5089 | +/* Copyright (C) 2007 Free Software Foundation, Inc. | ||
| 5090 | + This file is part of the GNU C Library. | ||
| 5091 | + Contributed by Jakub Jelinek <jakub at redhat.com>, 2007. | ||
| 5092 | + | ||
| 5093 | + The GNU C Library is free software; you can redistribute it and/or | ||
| 5094 | + modify it under the terms of the GNU Lesser General Public | ||
| 5095 | + License as published by the Free Software Foundation; either | ||
| 5096 | + version 2.1 of the License, or (at your option) any later version. | ||
| 5097 | + | ||
| 5098 | + The GNU C Library is distributed in the hope that it will be useful, | ||
| 5099 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 5100 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 5101 | + Lesser General Public License for more details. | ||
| 5102 | + | ||
| 5103 | + You should have received a copy of the GNU Lesser General Public | ||
| 5104 | + License along with the GNU C Library; if not, write to the Free | ||
| 5105 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
| 5106 | + 02111-1307 USA. */ | ||
| 5107 | + | ||
| 5108 | +#include <argp.h> | ||
| 5109 | + | ||
| 5110 | +static const struct argp_option opt1[] = | ||
| 5111 | + { | ||
| 5112 | + { "opt1", '1', "NUMBER", 0, "Option 1" }, | ||
| 5113 | + { NULL, 0, NULL, 0, NULL } | ||
| 5114 | + }; | ||
| 5115 | + | ||
| 5116 | +static const struct argp_option opt2[] = | ||
| 5117 | + { | ||
| 5118 | + { "opt2", '2', "NUMBER", 0, "Option 2" }, | ||
| 5119 | + { NULL, 0, NULL, 0, NULL } | ||
| 5120 | + }; | ||
| 5121 | + | ||
| 5122 | +static const struct argp_option opt3[] = | ||
| 5123 | + { | ||
| 5124 | + { "opt3", '3', "NUMBER", 0, "Option 3" }, | ||
| 5125 | + { NULL, 0, NULL, 0, NULL } | ||
| 5126 | + }; | ||
| 5127 | + | ||
| 5128 | +static const struct argp_option opt4[] = | ||
| 5129 | + { | ||
| 5130 | + { "opt4", '4', "NUMBER", 0, "Option 4" }, | ||
| 5131 | + { NULL, 0, NULL, 0, NULL } | ||
| 5132 | + }; | ||
| 5133 | + | ||
| 5134 | +static const struct argp_option opt5[] = | ||
| 5135 | + { | ||
| 5136 | + { "opt5", '5', "NUMBER", 0, "Option 5" }, | ||
| 5137 | + { NULL, 0, NULL, 0, NULL } | ||
| 5138 | + }; | ||
| 5139 | + | ||
| 5140 | +static struct argp argp5 = | ||
| 5141 | + { | ||
| 5142 | + opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL | ||
| 5143 | + }; | ||
| 5144 | + | ||
| 5145 | +static struct argp argp4 = | ||
| 5146 | + { | ||
| 5147 | + opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL | ||
| 5148 | + }; | ||
| 5149 | + | ||
| 5150 | +static struct argp argp3 = | ||
| 5151 | + { | ||
| 5152 | + opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL | ||
| 5153 | + }; | ||
| 5154 | + | ||
| 5155 | +static struct argp_child children2[] = | ||
| 5156 | + { | ||
| 5157 | + { &argp4, 0, "child3", 3 }, | ||
| 5158 | + { &argp5, 0, "child4", 4 }, | ||
| 5159 | + { NULL, 0, NULL, 0 } | ||
| 5160 | + }; | ||
| 5161 | + | ||
| 5162 | +static struct argp argp2 = | ||
| 5163 | + { | ||
| 5164 | + opt2, NULL, "args doc2", "doc2", children2, NULL, NULL | ||
| 5165 | + }; | ||
| 5166 | + | ||
| 5167 | +static struct argp_child children1[] = | ||
| 5168 | + { | ||
| 5169 | + { &argp2, 0, "child1", 1 }, | ||
| 5170 | + { &argp3, 0, "child2", 2 }, | ||
| 5171 | + { NULL, 0, NULL, 0 } | ||
| 5172 | + }; | ||
| 5173 | + | ||
| 5174 | +static struct argp argp1 = | ||
| 5175 | + { | ||
| 5176 | + opt1, NULL, "args doc1", "doc1", children1, NULL, NULL | ||
| 5177 | + }; | ||
| 5178 | + | ||
| 5179 | + | ||
| 5180 | +static int | ||
| 5181 | +do_test (void) | ||
| 5182 | +{ | ||
| 5183 | + argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2"); | ||
| 5184 | + return 0; | ||
| 5185 | +} | ||
| 5186 | + | ||
| 5187 | + | ||
| 5188 | +#define TEST_FUNCTION do_test () | ||
| 5189 | +#include "../test-skeleton.c" | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/arm/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/arm/uClibc.machine index 898b73a33b..293f384363 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/arm/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/arm/uClibc.machine | |||
| @@ -34,12 +34,12 @@ FORCE_OPTIONS_FOR_ARCH=y | |||
| 34 | # CONFIG_ARM_OABI is not set | 34 | # CONFIG_ARM_OABI is not set |
| 35 | CONFIG_ARM_EABI=y | 35 | CONFIG_ARM_EABI=y |
| 36 | USE_BX=y | 36 | USE_BX=y |
| 37 | # CONFIG_GENERIC_ARM is not set | 37 | CONFIG_GENERIC_ARM=y |
| 38 | # CONFIG_ARM610 is not set | 38 | # CONFIG_ARM610 is not set |
| 39 | # CONFIG_ARM710 is not set | 39 | # CONFIG_ARM710 is not set |
| 40 | # CONFIG_ARM7TDMI is not set | 40 | # CONFIG_ARM7TDMI is not set |
| 41 | # CONFIG_ARM720T is not set | 41 | # CONFIG_ARM720T is not set |
| 42 | CONFIG_ARM920T=y | 42 | # CONFIG_ARM920T is not set |
| 43 | # CONFIG_ARM922T is not set | 43 | # CONFIG_ARM922T is not set |
| 44 | # CONFIG_ARM926T is not set | 44 | # CONFIG_ARM926T is not set |
| 45 | # CONFIG_ARM10T is not set | 45 | # CONFIG_ARM10T is not set |
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.iwmmxt b/meta/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine index e27931cf6b..7a6ad8b5d0 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.machine.iwmmxt +++ b/meta/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Sat May 12 23:18:41 2007 | ||
| 4 | # | 3 | # |
| 5 | # TARGET_alpha is not set | 4 | # TARGET_alpha is not set |
| 6 | TARGET_arm=y | 5 | TARGET_arm=y |
| @@ -12,7 +11,6 @@ TARGET_arm=y | |||
| 12 | # TARGET_hppa is not set | 11 | # TARGET_hppa is not set |
| 13 | # TARGET_i386 is not set | 12 | # TARGET_i386 is not set |
| 14 | # TARGET_i960 is not set | 13 | # TARGET_i960 is not set |
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | 14 | # TARGET_m68k is not set |
| 17 | # TARGET_microblaze is not set | 15 | # TARGET_microblaze is not set |
| 18 | # TARGET_mips is not set | 16 | # TARGET_mips is not set |
| @@ -23,48 +21,33 @@ TARGET_arm=y | |||
| 23 | # TARGET_sh64 is not set | 21 | # TARGET_sh64 is not set |
| 24 | # TARGET_sparc is not set | 22 | # TARGET_sparc is not set |
| 25 | # TARGET_v850 is not set | 23 | # TARGET_v850 is not set |
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | 24 | # TARGET_x86_64 is not set |
| 28 | 25 | ||
| 29 | # | 26 | # |
| 30 | # Target Architecture Features and Options | 27 | # Target Architecture Features and Options |
| 31 | # | 28 | # |
| 32 | TARGET_ARCH="arm" | 29 | TARGET_ARCH="arm" |
| 30 | ARCH_SUPPORTS_BIG_ENDIAN=y | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | 32 | FORCE_OPTIONS_FOR_ARCH=y |
| 34 | # CONFIG_ARM_OABI is not set | 33 | CONFIG_GENERIC_ARM=y |
| 35 | CONFIG_ARM_EABI=y | ||
| 36 | USE_BX=y | ||
| 37 | # CONFIG_GENERIC_ARM is not set | ||
| 38 | # CONFIG_ARM610 is not set | 34 | # CONFIG_ARM610 is not set |
| 39 | # CONFIG_ARM710 is not set | 35 | # CONFIG_ARM710 is not set |
| 40 | # CONFIG_ARM7TDMI is not set | ||
| 41 | # CONFIG_ARM720T is not set | 36 | # CONFIG_ARM720T is not set |
| 42 | # CONFIG_ARM920T is not set | 37 | # CONFIG_ARM920T is not set |
| 43 | # CONFIG_ARM922T is not set | 38 | # CONFIG_ARM922T is not set |
| 44 | # CONFIG_ARM926T is not set | 39 | # CONFIG_ARM926T is not set |
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | 40 | # CONFIG_ARM1136JF_S is not set |
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | 41 | # CONFIG_ARM_SA110 is not set |
| 50 | # CONFIG_ARM_SA1100 is not set | 42 | # CONFIG_ARM_SA1100 is not set |
| 51 | # CONFIG_ARM_XSCALE is not set | 43 | # CONFIG_ARM_XSCALE is not set |
| 52 | CONFIG_ARM_IWMMXT=y | 44 | # ARCH_LITTLE_ENDIAN is not set |
| 53 | TARGET_SUBARCH="" | 45 | ARCH_BIG_ENDIAN=y |
| 54 | 46 | # ARCH_HAS_NO_MMU is not set | |
| 55 | # | ||
| 56 | # Using ELF file format | ||
| 57 | # | ||
| 58 | ARCH_ANY_ENDIAN=y | ||
| 59 | ARCH_LITTLE_ENDIAN=y | ||
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 62 | ARCH_HAS_MMU=y | 47 | ARCH_HAS_MMU=y |
| 63 | ARCH_USE_MMU=y | ||
| 64 | UCLIBC_HAS_FLOATS=y | 48 | UCLIBC_HAS_FLOATS=y |
| 65 | # UCLIBC_HAS_FPU is not set | 49 | UCLIBC_HAS_FPU=y |
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | ||
| 67 | DO_C99_MATH=y | 50 | DO_C99_MATH=y |
| 68 | KERNEL_HEADERS="/usr/include" | 51 | # UCLIBC_HAS_FENV is not set |
| 52 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 69 | HAVE_DOT_CONFIG=y | 53 | HAVE_DOT_CONFIG=y |
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/iwmmxt/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine index e27931cf6b..eb76f34c4e 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/iwmmxt/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Sat May 12 23:18:41 2007 | 3 | # Version: 0.9.32-git |
| 4 | # Mon Jul 19 01:34:29 2010 | ||
| 4 | # | 5 | # |
| 5 | # TARGET_alpha is not set | 6 | # TARGET_alpha is not set |
| 6 | TARGET_arm=y | 7 | TARGET_arm=y |
| 8 | # TARGET_avr32 is not set | ||
| 7 | # TARGET_bfin is not set | 9 | # TARGET_bfin is not set |
| 8 | # TARGET_cris is not set | 10 | # TARGET_cris is not set |
| 9 | # TARGET_e1 is not set | 11 | # TARGET_e1 is not set |
| @@ -25,6 +27,7 @@ TARGET_arm=y | |||
| 25 | # TARGET_v850 is not set | 27 | # TARGET_v850 is not set |
| 26 | # TARGET_vax is not set | 28 | # TARGET_vax is not set |
| 27 | # TARGET_x86_64 is not set | 29 | # TARGET_x86_64 is not set |
| 30 | # TARGET_xtensa is not set | ||
| 28 | 31 | ||
| 29 | # | 32 | # |
| 30 | # Target Architecture Features and Options | 33 | # Target Architecture Features and Options |
| @@ -34,7 +37,7 @@ FORCE_OPTIONS_FOR_ARCH=y | |||
| 34 | # CONFIG_ARM_OABI is not set | 37 | # CONFIG_ARM_OABI is not set |
| 35 | CONFIG_ARM_EABI=y | 38 | CONFIG_ARM_EABI=y |
| 36 | USE_BX=y | 39 | USE_BX=y |
| 37 | # CONFIG_GENERIC_ARM is not set | 40 | CONFIG_GENERIC_ARM=y |
| 38 | # CONFIG_ARM610 is not set | 41 | # CONFIG_ARM610 is not set |
| 39 | # CONFIG_ARM710 is not set | 42 | # CONFIG_ARM710 is not set |
| 40 | # CONFIG_ARM7TDMI is not set | 43 | # CONFIG_ARM7TDMI is not set |
| @@ -46,10 +49,12 @@ USE_BX=y | |||
| 46 | # CONFIG_ARM1136JF_S is not set | 49 | # CONFIG_ARM1136JF_S is not set |
| 47 | # CONFIG_ARM1176JZ_S is not set | 50 | # CONFIG_ARM1176JZ_S is not set |
| 48 | # CONFIG_ARM1176JZF_S is not set | 51 | # CONFIG_ARM1176JZF_S is not set |
| 52 | # CONFIG_ARM_CORTEX_M3 is not set | ||
| 53 | # CONFIG_ARM_CORTEX_M1 is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | 54 | # CONFIG_ARM_SA110 is not set |
| 50 | # CONFIG_ARM_SA1100 is not set | 55 | # CONFIG_ARM_SA1100 is not set |
| 51 | # CONFIG_ARM_XSCALE is not set | 56 | # CONFIG_ARM_XSCALE is not set |
| 52 | CONFIG_ARM_IWMMXT=y | 57 | # CONFIG_ARM_IWMMXT is not set |
| 53 | TARGET_SUBARCH="" | 58 | TARGET_SUBARCH="" |
| 54 | 59 | ||
| 55 | # | 60 | # |
| @@ -65,6 +70,7 @@ UCLIBC_HAS_FLOATS=y | |||
| 65 | # UCLIBC_HAS_FPU is not set | 70 | # UCLIBC_HAS_FPU is not set |
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | 71 | UCLIBC_HAS_SOFT_FLOAT=y |
| 67 | DO_C99_MATH=y | 72 | DO_C99_MATH=y |
| 73 | # DO_XSI_MATH is not set | ||
| 74 | # UCLIBC_HAS_FENV is not set | ||
| 68 | KERNEL_HEADERS="/usr/include" | 75 | KERNEL_HEADERS="/usr/include" |
| 69 | HAVE_DOT_CONFIG=y | 76 | HAVE_DOT_CONFIG=y |
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch b/meta/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch new file mode 100644 index 0000000000..c5d212a642 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313307agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:20 -0800 (PST) | ||
| 4 | Received: by 10.227.141.78 with SMTP id l14mr16920947wbu.128.1294533919168; | ||
| 5 | Sat, 08 Jan 2011 16:45:19 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id w30si33755908wbd.17.2011.01.08.16.45.18; | ||
| 9 | Sat, 08 Jan 2011 16:45:19 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClHDo; Sun, 09 Jan 2011 01:45:18 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 6/7] ARM: detect BX availibility at build time | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:09 +0100 | ||
| 22 | Message-Id: <1294533910-19305-7-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | The "use BX" option is now a suggestion that BX be used if available. | ||
| 28 | Use a macro to detect if BX is available at build time. If so, and | ||
| 29 | the user requested it be used, then use it. Otherwise, error out. | ||
| 30 | |||
| 31 | Macro courtesy Khem RAJ: | ||
| 32 | http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html | ||
| 33 | |||
| 34 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 35 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 36 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 37 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 38 | --- | ||
| 39 | extra/Configs/Config.arm | 4 +++- | ||
| 40 | libc/sysdeps/linux/arm/bits/arm_asm.h | 9 ++++++++- | ||
| 41 | 2 files changed, 11 insertions(+), 2 deletions(-) | ||
| 42 | |||
| 43 | diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm | ||
| 44 | index 227b90c..9aa9e56 100644 | ||
| 45 | --- a/extra/Configs/Config.arm | ||
| 46 | +++ b/extra/Configs/Config.arm | ||
| 47 | @@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE | ||
| 48 | config USE_BX | ||
| 49 | bool "Use BX in function return" | ||
| 50 | help | ||
| 51 | - Use BX instruction for THUMB aware architectures. | ||
| 52 | + Say 'y' to use BX to return from functions on your thumb-aware | ||
| 53 | + processor. Say 'y' if you need to use interworking. Say 'n' if not. | ||
| 54 | + It is safe to say 'y' even if you're not doing interworking. | ||
| 55 | diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h | ||
| 56 | index 1d87df6..921c9a3 100644 | ||
| 57 | --- a/libc/sysdeps/linux/arm/bits/arm_asm.h | ||
| 58 | +++ b/libc/sysdeps/linux/arm/bits/arm_asm.h | ||
| 59 | @@ -24,5 +24,12 @@ | ||
| 60 | #define THUMB1_ONLY 1 | ||
| 61 | #endif | ||
| 62 | |||
| 63 | -#endif /* _ARM_ASM_H */ | ||
| 64 | +#if defined(__USE_BX__) | ||
| 65 | +# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \ | ||
| 66 | + || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \ | ||
| 67 | + ) | ||
| 68 | +# error Use of BX was requested, but is not available on the target processor. | ||
| 69 | +# endif /* ARCH level */ | ||
| 70 | +#endif /* __USE_BX__ */ | ||
| 71 | |||
| 72 | +#endif /* _ARM_ASM_H */ | ||
| 73 | -- | ||
| 74 | 1.7.1 | ||
| 75 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/efika/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/efika/uClibc.machine new file mode 100644 index 0000000000..5ed7b517a3 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/efika/uClibc.machine | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Wed Dec 20 11:05:48 2006 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | # TARGET_arm is not set | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | TARGET_powerpc=y | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="powerpc" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | ARCH_BIG_ENDIAN=y | ||
| 35 | |||
| 36 | # | ||
| 37 | # Using Big Endian | ||
| 38 | # | ||
| 39 | ARCH_HAS_MMU=y | ||
| 40 | ARCH_USE_MMU=y | ||
| 41 | UCLIBC_HAS_FLOATS=y | ||
| 42 | UCLIBC_HAS_FPU=y | ||
| 43 | DO_C99_MATH=y | ||
| 44 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 45 | HAVE_DOT_CONFIG=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/x86/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/i386/uClibc.machine index 6cd19e851e..3909ccc9e1 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/x86/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/i386/uClibc.machine | |||
| @@ -1,11 +1,8 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Version: 0.9.30.1 | ||
| 4 | # Wed Jul 1 17:04:32 2009 | ||
| 5 | # | 3 | # |
| 6 | # TARGET_alpha is not set | 4 | # TARGET_alpha is not set |
| 7 | # TARGET_arm is not set | 5 | # TARGET_arm is not set |
| 8 | # TARGET_avr32 is not set | ||
| 9 | # TARGET_bfin is not set | 6 | # TARGET_bfin is not set |
| 10 | # TARGET_cris is not set | 7 | # TARGET_cris is not set |
| 11 | # TARGET_e1 is not set | 8 | # TARGET_e1 is not set |
| @@ -14,7 +11,6 @@ | |||
| 14 | # TARGET_hppa is not set | 11 | # TARGET_hppa is not set |
| 15 | TARGET_i386=y | 12 | TARGET_i386=y |
| 16 | # TARGET_i960 is not set | 13 | # TARGET_i960 is not set |
| 17 | # TARGET_ia64 is not set | ||
| 18 | # TARGET_m68k is not set | 14 | # TARGET_m68k is not set |
| 19 | # TARGET_microblaze is not set | 15 | # TARGET_microblaze is not set |
| 20 | # TARGET_mips is not set | 16 | # TARGET_mips is not set |
| @@ -25,16 +21,16 @@ TARGET_i386=y | |||
| 25 | # TARGET_sh64 is not set | 21 | # TARGET_sh64 is not set |
| 26 | # TARGET_sparc is not set | 22 | # TARGET_sparc is not set |
| 27 | # TARGET_v850 is not set | 23 | # TARGET_v850 is not set |
| 28 | # TARGET_vax is not set | ||
| 29 | # TARGET_x86_64 is not set | 24 | # TARGET_x86_64 is not set |
| 30 | # TARGET_xtensa is not set | ||
| 31 | 25 | ||
| 32 | # | 26 | # |
| 33 | # Target Architecture Features and Options | 27 | # Target Architecture Features and Options |
| 34 | # | 28 | # |
| 35 | TARGET_ARCH="i386" | 29 | TARGET_ARCH="i386" |
| 30 | # ARCH_SUPPORTS_BIG_ENDIAN is not set | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 36 | FORCE_OPTIONS_FOR_ARCH=y | 32 | FORCE_OPTIONS_FOR_ARCH=y |
| 37 | CONFIG_GENERIC_386=y | 33 | # CONFIG_GENERIC_386 is not set |
| 38 | # CONFIG_386 is not set | 34 | # CONFIG_386 is not set |
| 39 | # CONFIG_486 is not set | 35 | # CONFIG_486 is not set |
| 40 | # CONFIG_586 is not set | 36 | # CONFIG_586 is not set |
| @@ -42,7 +38,7 @@ CONFIG_GENERIC_386=y | |||
| 42 | # CONFIG_686 is not set | 38 | # CONFIG_686 is not set |
| 43 | # CONFIG_PENTIUMII is not set | 39 | # CONFIG_PENTIUMII is not set |
| 44 | # CONFIG_PENTIUMIII is not set | 40 | # CONFIG_PENTIUMIII is not set |
| 45 | # CONFIG_PENTIUM4 is not set | 41 | CONFIG_PENTIUM4=y |
| 46 | # CONFIG_K6 is not set | 42 | # CONFIG_K6 is not set |
| 47 | # CONFIG_K7 is not set | 43 | # CONFIG_K7 is not set |
| 48 | # CONFIG_ELAN is not set | 44 | # CONFIG_ELAN is not set |
| @@ -51,22 +47,13 @@ CONFIG_GENERIC_386=y | |||
| 51 | # CONFIG_WINCHIP2 is not set | 47 | # CONFIG_WINCHIP2 is not set |
| 52 | # CONFIG_CYRIXIII is not set | 48 | # CONFIG_CYRIXIII is not set |
| 53 | # CONFIG_NEHEMIAH is not set | 49 | # CONFIG_NEHEMIAH is not set |
| 54 | TARGET_SUBARCH="" | ||
| 55 | |||
| 56 | # | ||
| 57 | # Using ELF file format | ||
| 58 | # | ||
| 59 | ARCH_LITTLE_ENDIAN=y | 50 | ARCH_LITTLE_ENDIAN=y |
| 60 | 51 | # ARCH_BIG_ENDIAN is not set | |
| 61 | # | 52 | # ARCH_HAS_NO_MMU is not set |
| 62 | # Using Little Endian | ||
| 63 | # | ||
| 64 | ARCH_HAS_MMU=y | 53 | ARCH_HAS_MMU=y |
| 65 | ARCH_USE_MMU=y | ||
| 66 | UCLIBC_HAS_FLOATS=y | 54 | UCLIBC_HAS_FLOATS=y |
| 67 | UCLIBC_HAS_FPU=y | 55 | UCLIBC_HAS_FPU=y |
| 68 | DO_C99_MATH=y | 56 | DO_C99_MATH=y |
| 69 | # UCLIBC_HAS_FENV is not set | 57 | # UCLIBC_HAS_FENV is not set |
| 70 | UCLIBC_HAS_LONG_DOUBLE_MATH=y | 58 | KERNEL_HEADERS="<path/to/kernel/headers>" |
| 71 | KERNEL_HEADERS="/bla" | ||
| 72 | HAVE_DOT_CONFIG=y | 59 | HAVE_DOT_CONFIG=y |
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemumips/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/i486/uClibc.machine index 44fec169c8..776e00d6dc 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemumips/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/i486/uClibc.machine | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Fri Nov 23 15:49:33 2007 | 3 | # Fri Dec 22 23:09:11 2006 |
| 4 | # | 4 | # |
| 5 | # TARGET_alpha is not set | 5 | # TARGET_alpha is not set |
| 6 | # TARGET_arm is not set | 6 | # TARGET_arm is not set |
| @@ -31,9 +31,9 @@ TARGET_i386=y | |||
| 31 | # | 31 | # |
| 32 | TARGET_ARCH="i386" | 32 | TARGET_ARCH="i386" |
| 33 | FORCE_OPTIONS_FOR_ARCH=y | 33 | FORCE_OPTIONS_FOR_ARCH=y |
| 34 | CONFIG_GENERIC_386=y | 34 | # CONFIG_GENERIC_386 is not set |
| 35 | # CONFIG_386 is not set | 35 | # CONFIG_386 is not set |
| 36 | # CONFIG_486 is not set | 36 | CONFIG_486=y |
| 37 | # CONFIG_586 is not set | 37 | # CONFIG_586 is not set |
| 38 | # CONFIG_586MMX is not set | 38 | # CONFIG_586MMX is not set |
| 39 | # CONFIG_686 is not set | 39 | # CONFIG_686 is not set |
| @@ -48,11 +48,6 @@ CONFIG_GENERIC_386=y | |||
| 48 | # CONFIG_WINCHIP2 is not set | 48 | # CONFIG_WINCHIP2 is not set |
| 49 | # CONFIG_CYRIXIII is not set | 49 | # CONFIG_CYRIXIII is not set |
| 50 | # CONFIG_NEHEMIAH is not set | 50 | # CONFIG_NEHEMIAH is not set |
| 51 | TARGET_SUBARCH="" | ||
| 52 | |||
| 53 | # | ||
| 54 | # Using ELF file format | ||
| 55 | # | ||
| 56 | ARCH_LITTLE_ENDIAN=y | 51 | ARCH_LITTLE_ENDIAN=y |
| 57 | 52 | ||
| 58 | # | 53 | # |
| @@ -63,6 +58,5 @@ ARCH_USE_MMU=y | |||
| 63 | UCLIBC_HAS_FLOATS=y | 58 | UCLIBC_HAS_FLOATS=y |
| 64 | UCLIBC_HAS_FPU=y | 59 | UCLIBC_HAS_FPU=y |
| 65 | DO_C99_MATH=y | 60 | DO_C99_MATH=y |
| 66 | KERNEL_HEADERS="/usr/include" | 61 | KERNEL_HEADERS="<path/to/kernel/headers>" |
| 67 | HAVE_DOT_CONFIG=y | 62 | HAVE_DOT_CONFIG=y |
| 68 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemux86/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/i586/uClibc.machine index 44fec169c8..2e98e5c7e1 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemux86/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/i586/uClibc.machine | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Fri Nov 23 15:49:33 2007 | 3 | # Sat Feb 24 08:24:11 2007 |
| 4 | # | 4 | # |
| 5 | # TARGET_alpha is not set | 5 | # TARGET_alpha is not set |
| 6 | # TARGET_arm is not set | 6 | # TARGET_arm is not set |
| @@ -31,14 +31,14 @@ TARGET_i386=y | |||
| 31 | # | 31 | # |
| 32 | TARGET_ARCH="i386" | 32 | TARGET_ARCH="i386" |
| 33 | FORCE_OPTIONS_FOR_ARCH=y | 33 | FORCE_OPTIONS_FOR_ARCH=y |
| 34 | CONFIG_GENERIC_386=y | 34 | # CONFIG_GENERIC_386 is not set |
| 35 | # CONFIG_386 is not set | 35 | # CONFIG_386 is not set |
| 36 | # CONFIG_486 is not set | 36 | # CONFIG_486 is not set |
| 37 | # CONFIG_586 is not set | 37 | # CONFIG_586 is not set |
| 38 | # CONFIG_586MMX is not set | 38 | # CONFIG_586MMX is not set |
| 39 | # CONFIG_686 is not set | 39 | # CONFIG_686 is not set |
| 40 | # CONFIG_PENTIUMII is not set | 40 | # CONFIG_PENTIUMII is not set |
| 41 | # CONFIG_PENTIUMIII is not set | 41 | CONFIG_PENTIUMIII=y |
| 42 | # CONFIG_PENTIUM4 is not set | 42 | # CONFIG_PENTIUM4 is not set |
| 43 | # CONFIG_K6 is not set | 43 | # CONFIG_K6 is not set |
| 44 | # CONFIG_K7 is not set | 44 | # CONFIG_K7 is not set |
| @@ -48,11 +48,6 @@ CONFIG_GENERIC_386=y | |||
| 48 | # CONFIG_WINCHIP2 is not set | 48 | # CONFIG_WINCHIP2 is not set |
| 49 | # CONFIG_CYRIXIII is not set | 49 | # CONFIG_CYRIXIII is not set |
| 50 | # CONFIG_NEHEMIAH is not set | 50 | # CONFIG_NEHEMIAH is not set |
| 51 | TARGET_SUBARCH="" | ||
| 52 | |||
| 53 | # | ||
| 54 | # Using ELF file format | ||
| 55 | # | ||
| 56 | ARCH_LITTLE_ENDIAN=y | 51 | ARCH_LITTLE_ENDIAN=y |
| 57 | 52 | ||
| 58 | # | 53 | # |
| @@ -63,6 +58,5 @@ ARCH_USE_MMU=y | |||
| 63 | UCLIBC_HAS_FLOATS=y | 58 | UCLIBC_HAS_FLOATS=y |
| 64 | UCLIBC_HAS_FPU=y | 59 | UCLIBC_HAS_FPU=y |
| 65 | DO_C99_MATH=y | 60 | DO_C99_MATH=y |
| 66 | KERNEL_HEADERS="/usr/include" | 61 | KERNEL_HEADERS="<path/to/kernel/headers>" |
| 67 | HAVE_DOT_CONFIG=y | 62 | HAVE_DOT_CONFIG=y |
| 68 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/i686/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/i686/uClibc.machine new file mode 100644 index 0000000000..3909ccc9e1 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/i686/uClibc.machine | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # | ||
| 4 | # TARGET_alpha is not set | ||
| 5 | # TARGET_arm is not set | ||
| 6 | # TARGET_bfin is not set | ||
| 7 | # TARGET_cris is not set | ||
| 8 | # TARGET_e1 is not set | ||
| 9 | # TARGET_frv is not set | ||
| 10 | # TARGET_h8300 is not set | ||
| 11 | # TARGET_hppa is not set | ||
| 12 | TARGET_i386=y | ||
| 13 | # TARGET_i960 is not set | ||
| 14 | # TARGET_m68k is not set | ||
| 15 | # TARGET_microblaze is not set | ||
| 16 | # TARGET_mips is not set | ||
| 17 | # TARGET_nios is not set | ||
| 18 | # TARGET_nios2 is not set | ||
| 19 | # TARGET_powerpc is not set | ||
| 20 | # TARGET_sh is not set | ||
| 21 | # TARGET_sh64 is not set | ||
| 22 | # TARGET_sparc is not set | ||
| 23 | # TARGET_v850 is not set | ||
| 24 | # TARGET_x86_64 is not set | ||
| 25 | |||
| 26 | # | ||
| 27 | # Target Architecture Features and Options | ||
| 28 | # | ||
| 29 | TARGET_ARCH="i386" | ||
| 30 | # ARCH_SUPPORTS_BIG_ENDIAN is not set | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 32 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 33 | # CONFIG_GENERIC_386 is not set | ||
| 34 | # CONFIG_386 is not set | ||
| 35 | # CONFIG_486 is not set | ||
| 36 | # CONFIG_586 is not set | ||
| 37 | # CONFIG_586MMX is not set | ||
| 38 | # CONFIG_686 is not set | ||
| 39 | # CONFIG_PENTIUMII is not set | ||
| 40 | # CONFIG_PENTIUMIII is not set | ||
| 41 | CONFIG_PENTIUM4=y | ||
| 42 | # CONFIG_K6 is not set | ||
| 43 | # CONFIG_K7 is not set | ||
| 44 | # CONFIG_ELAN is not set | ||
| 45 | # CONFIG_CRUSOE is not set | ||
| 46 | # CONFIG_WINCHIPC6 is not set | ||
| 47 | # CONFIG_WINCHIP2 is not set | ||
| 48 | # CONFIG_CYRIXIII is not set | ||
| 49 | # CONFIG_NEHEMIAH is not set | ||
| 50 | ARCH_LITTLE_ENDIAN=y | ||
| 51 | # ARCH_BIG_ENDIAN is not set | ||
| 52 | # ARCH_HAS_NO_MMU is not set | ||
| 53 | ARCH_HAS_MMU=y | ||
| 54 | UCLIBC_HAS_FLOATS=y | ||
| 55 | UCLIBC_HAS_FPU=y | ||
| 56 | DO_C99_MATH=y | ||
| 57 | # UCLIBC_HAS_FENV is not set | ||
| 58 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 59 | HAVE_DOT_CONFIG=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch b/meta/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch new file mode 100644 index 0000000000..621896fb10 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313304agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:19 -0800 (PST) | ||
| 4 | Received: by 10.227.155.75 with SMTP id r11mr17188266wbw.3.1294533918432; | ||
| 5 | Sat, 08 Jan 2011 16:45:18 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id k3si33753340wbx.29.2011.01.08.16.45.17; | ||
| 9 | Sat, 08 Jan 2011 16:45:18 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClHDf; Sun, 09 Jan 2011 01:45:17 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 5/7] ARM: #include <bits/arm_asm.h> where __USE_BX__ is used | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:08 +0100 | ||
| 22 | Message-Id: <1294533910-19305-6-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | The check for __USE_BX__ will be available in bits/arm_asm.h, | ||
| 28 | so the latter must be included wherever the former is used. | ||
| 29 | |||
| 30 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 31 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 32 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 33 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 34 | --- | ||
| 35 | ldso/ldso/arm/dl-startup.h | 1 + | ||
| 36 | libc/sysdeps/linux/arm/sysdep.h | 1 + | ||
| 37 | 2 files changed, 2 insertions(+), 0 deletions(-) | ||
| 38 | |||
| 39 | diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h | ||
| 40 | index a95389d..2dfdaff 100644 | ||
| 41 | --- a/ldso/ldso/arm/dl-startup.h | ||
| 42 | +++ b/ldso/ldso/arm/dl-startup.h | ||
| 43 | @@ -7,6 +7,7 @@ | ||
| 44 | */ | ||
| 45 | |||
| 46 | #include <features.h> | ||
| 47 | +#include <bits/arm_asm.h> | ||
| 48 | |||
| 49 | #if !defined(__thumb__) | ||
| 50 | __asm__( | ||
| 51 | diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h | ||
| 52 | index 013f88c..e498695 100644 | ||
| 53 | --- a/libc/sysdeps/linux/arm/sysdep.h | ||
| 54 | +++ b/libc/sysdeps/linux/arm/sysdep.h | ||
| 55 | @@ -21,6 +21,7 @@ | ||
| 56 | #define _LINUX_ARM_SYSDEP_H 1 | ||
| 57 | |||
| 58 | #include <common/sysdep.h> | ||
| 59 | +#include <bits/arm_asm.h> | ||
| 60 | |||
| 61 | #include <sys/syscall.h> | ||
| 62 | /* For Linux we can use the system call table in the header file | ||
| 63 | -- | ||
| 64 | 1.7.1 | ||
| 65 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch b/meta/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch index cfa68ce52d..cfa68ce52d 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch +++ b/meta/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine new file mode 100644 index 0000000000..a68c7afe0c --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Wed Jul 9 13:37:36 2008 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | # TARGET_arm is not set | ||
| 7 | # TARGET_avr32 is not set | ||
| 8 | # TARGET_bfin is not set | ||
| 9 | # TARGET_cris is not set | ||
| 10 | # TARGET_e1 is not set | ||
| 11 | # TARGET_frv is not set | ||
| 12 | # TARGET_h8300 is not set | ||
| 13 | # TARGET_hppa is not set | ||
| 14 | # TARGET_i386 is not set | ||
| 15 | # TARGET_i960 is not set | ||
| 16 | # TARGET_ia64 is not set | ||
| 17 | # TARGET_m68k is not set | ||
| 18 | # TARGET_microblaze is not set | ||
| 19 | TARGET_mips=y | ||
| 20 | # TARGET_nios is not set | ||
| 21 | # TARGET_nios2 is not set | ||
| 22 | # TARGET_powerpc is not set | ||
| 23 | # TARGET_sh is not set | ||
| 24 | # TARGET_sh64 is not set | ||
| 25 | # TARGET_sparc is not set | ||
| 26 | # TARGET_v850 is not set | ||
| 27 | # TARGET_vax is not set | ||
| 28 | # TARGET_x86_64 is not set | ||
| 29 | # TARGET_xtensa is not set | ||
| 30 | |||
| 31 | # | ||
| 32 | # Target Architecture Features and Options | ||
| 33 | # | ||
| 34 | TARGET_ARCH="mips" | ||
| 35 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 36 | ARCH_CFLAGS="-mno-split-addresses" | ||
| 37 | # CONFIG_MIPS_O32_ABI is not set | ||
| 38 | # CONFIG_MIPS_N32_ABI is not set | ||
| 39 | CONFIG_MIPS_N64_ABI=y | ||
| 40 | # CONFIG_MIPS_ISA_1 is not set | ||
| 41 | # CONFIG_MIPS_ISA_2 is not set | ||
| 42 | # CONFIG_MIPS_ISA_3 is not set | ||
| 43 | # CONFIG_MIPS_ISA_4 is not set | ||
| 44 | # CONFIG_MIPS_ISA_MIPS32 is not set | ||
| 45 | CONFIG_MIPS_ISA_MIPS64=y | ||
| 46 | TARGET_SUBARCH="" | ||
| 47 | |||
| 48 | # | ||
| 49 | # Using ELF file format | ||
| 50 | # | ||
| 51 | ARCH_ANY_ENDIAN=y | ||
| 52 | # ARCH_BIG_ENDIAN is not set | ||
| 53 | ARCH_WANTS_BIG_ENDIAN=y | ||
| 54 | # ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 55 | ARCH_HAS_MMU=y | ||
| 56 | ARCH_USE_MMU=y | ||
| 57 | UCLIBC_HAS_FLOATS=y | ||
| 58 | UCLIBC_HAS_FPU=y | ||
| 59 | # DO_C99_MATH is not set | ||
| 60 | # UCLIBC_HAS_FENV is not set | ||
| 61 | KERNEL_HEADERS="/usr/include" | ||
| 62 | HAVE_DOT_CONFIG=y | ||
| 63 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv4t/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine index 898b73a33b..e148451812 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armv4t/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Mon May 14 10:23:14 2007 | 3 | # Wed Jul 9 13:37:36 2008 |
| 4 | # | 4 | # |
| 5 | # TARGET_alpha is not set | 5 | # TARGET_alpha is not set |
| 6 | TARGET_arm=y | 6 | # TARGET_arm is not set |
| 7 | # TARGET_avr32 is not set | ||
| 7 | # TARGET_bfin is not set | 8 | # TARGET_bfin is not set |
| 8 | # TARGET_cris is not set | 9 | # TARGET_cris is not set |
| 9 | # TARGET_e1 is not set | 10 | # TARGET_e1 is not set |
| @@ -15,7 +16,7 @@ TARGET_arm=y | |||
| 15 | # TARGET_ia64 is not set | 16 | # TARGET_ia64 is not set |
| 16 | # TARGET_m68k is not set | 17 | # TARGET_m68k is not set |
| 17 | # TARGET_microblaze is not set | 18 | # TARGET_microblaze is not set |
| 18 | # TARGET_mips is not set | 19 | TARGET_mips=y |
| 19 | # TARGET_nios is not set | 20 | # TARGET_nios is not set |
| 20 | # TARGET_nios2 is not set | 21 | # TARGET_nios2 is not set |
| 21 | # TARGET_powerpc is not set | 22 | # TARGET_powerpc is not set |
| @@ -25,45 +26,38 @@ TARGET_arm=y | |||
| 25 | # TARGET_v850 is not set | 26 | # TARGET_v850 is not set |
| 26 | # TARGET_vax is not set | 27 | # TARGET_vax is not set |
| 27 | # TARGET_x86_64 is not set | 28 | # TARGET_x86_64 is not set |
| 29 | # TARGET_xtensa is not set | ||
| 28 | 30 | ||
| 29 | # | 31 | # |
| 30 | # Target Architecture Features and Options | 32 | # Target Architecture Features and Options |
| 31 | # | 33 | # |
| 32 | TARGET_ARCH="arm" | 34 | TARGET_ARCH="mips" |
| 33 | FORCE_OPTIONS_FOR_ARCH=y | 35 | FORCE_OPTIONS_FOR_ARCH=y |
| 34 | # CONFIG_ARM_OABI is not set | 36 | ARCH_CFLAGS="-mno-split-addresses" |
| 35 | CONFIG_ARM_EABI=y | 37 | CONFIG_MIPS_O32_ABI=y |
| 36 | USE_BX=y | 38 | # CONFIG_MIPS_N32_ABI is not set |
| 37 | # CONFIG_GENERIC_ARM is not set | 39 | # CONFIG_MIPS_N64_ABI is not set |
| 38 | # CONFIG_ARM610 is not set | 40 | # CONFIG_MIPS_ISA_1 is not set |
| 39 | # CONFIG_ARM710 is not set | 41 | # CONFIG_MIPS_ISA_2 is not set |
| 40 | # CONFIG_ARM7TDMI is not set | 42 | # CONFIG_MIPS_ISA_3 is not set |
| 41 | # CONFIG_ARM720T is not set | 43 | # CONFIG_MIPS_ISA_4 is not set |
| 42 | CONFIG_ARM920T=y | 44 | CONFIG_MIPS_ISA_MIPS32=y |
| 43 | # CONFIG_ARM922T is not set | 45 | # CONFIG_MIPS_ISA_MIPS64 is not set |
| 44 | # CONFIG_ARM926T is not set | ||
| 45 | # CONFIG_ARM10T is not set | ||
| 46 | # CONFIG_ARM1136JF_S is not set | ||
| 47 | # CONFIG_ARM1176JZ_S is not set | ||
| 48 | # CONFIG_ARM1176JZF_S is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | ||
| 50 | # CONFIG_ARM_SA1100 is not set | ||
| 51 | # CONFIG_ARM_XSCALE is not set | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | ||
| 53 | TARGET_SUBARCH="" | 46 | TARGET_SUBARCH="" |
| 54 | 47 | ||
| 55 | # | 48 | # |
| 56 | # Using ELF file format | 49 | # Using ELF file format |
| 57 | # | 50 | # |
| 58 | ARCH_ANY_ENDIAN=y | 51 | ARCH_ANY_ENDIAN=y |
| 59 | ARCH_LITTLE_ENDIAN=y | 52 | # ARCH_BIG_ENDIAN is not set |
| 60 | # ARCH_WANTS_BIG_ENDIAN is not set | 53 | # ARCH_WANTS_BIG_ENDIAN is not set |
| 61 | ARCH_WANTS_LITTLE_ENDIAN=y | 54 | ARCH_WANTS_LITTLE_ENDIAN=y |
| 62 | ARCH_HAS_MMU=y | 55 | ARCH_HAS_MMU=y |
| 63 | ARCH_USE_MMU=y | 56 | ARCH_USE_MMU=y |
| 64 | UCLIBC_HAS_FLOATS=y | 57 | UCLIBC_HAS_FLOATS=y |
| 65 | # UCLIBC_HAS_FPU is not set | 58 | UCLIBC_HAS_FPU=y |
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | 59 | # DO_C99_MATH is not set |
| 60 | # UCLIBC_HAS_FENV is not set | ||
| 67 | KERNEL_HEADERS="/usr/include" | 61 | KERNEL_HEADERS="/usr/include" |
| 68 | HAVE_DOT_CONFIG=y | 62 | HAVE_DOT_CONFIG=y |
| 69 | 63 | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armeb/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine index 2d9f63e531..f5aa13454a 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/armeb/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine | |||
| @@ -49,6 +49,8 @@ USE_BX=y | |||
| 49 | # CONFIG_ARM_SA110 is not set | 49 | # CONFIG_ARM_SA110 is not set |
| 50 | # CONFIG_ARM_SA1100 is not set | 50 | # CONFIG_ARM_SA1100 is not set |
| 51 | CONFIG_ARM_XSCALE=y | 51 | CONFIG_ARM_XSCALE=y |
| 52 | # CONFIG_ARM_CORTEX_M3 is not set | ||
| 53 | # CONFIG_ARM_CORTEX_M1 is not set | ||
| 52 | # CONFIG_ARM_IWMMXT is not set | 54 | # CONFIG_ARM_IWMMXT is not set |
| 53 | TARGET_SUBARCH="" | 55 | TARGET_SUBARCH="" |
| 54 | 56 | ||
| @@ -65,6 +67,7 @@ UCLIBC_HAS_FLOATS=y | |||
| 65 | # UCLIBC_HAS_FPU is not set | 67 | # UCLIBC_HAS_FPU is not set |
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | 68 | UCLIBC_HAS_SOFT_FLOAT=y |
| 67 | DO_C99_MATH=y | 69 | DO_C99_MATH=y |
| 70 | # DO_XSI_MATH is not set | ||
| 71 | # UCLIBC_HAS_FENV is not set | ||
| 68 | KERNEL_HEADERS="/usr/include" | 72 | KERNEL_HEADERS="/usr/include" |
| 69 | HAVE_DOT_CONFIG=y | 73 | HAVE_DOT_CONFIG=y |
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine new file mode 100644 index 0000000000..d49bf6af53 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Tue Feb 6 19:17:06 2007 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | # TARGET_arm is not set | ||
| 7 | # TARGET_bfin is not set | ||
| 8 | # TARGET_cris is not set | ||
| 9 | # TARGET_e1 is not set | ||
| 10 | # TARGET_frv is not set | ||
| 11 | # TARGET_h8300 is not set | ||
| 12 | # TARGET_hppa is not set | ||
| 13 | # TARGET_i386 is not set | ||
| 14 | # TARGET_i960 is not set | ||
| 15 | # TARGET_ia64 is not set | ||
| 16 | # TARGET_m68k is not set | ||
| 17 | # TARGET_microblaze is not set | ||
| 18 | # TARGET_mips is not set | ||
| 19 | # TARGET_nios is not set | ||
| 20 | # TARGET_nios2 is not set | ||
| 21 | TARGET_powerpc=y | ||
| 22 | # TARGET_sh is not set | ||
| 23 | # TARGET_sh64 is not set | ||
| 24 | # TARGET_sparc is not set | ||
| 25 | # TARGET_v850 is not set | ||
| 26 | # TARGET_vax is not set | ||
| 27 | # TARGET_x86_64 is not set | ||
| 28 | |||
| 29 | # | ||
| 30 | # Target Architecture Features and Options | ||
| 31 | # | ||
| 32 | TARGET_ARCH="powerpc" | ||
| 33 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 34 | ARCH_BIG_ENDIAN=y | ||
| 35 | |||
| 36 | # | ||
| 37 | # Using Big Endian | ||
| 38 | # | ||
| 39 | ARCH_HAS_MMU=y | ||
| 40 | ARCH_USE_MMU=y | ||
| 41 | UCLIBC_HAS_FLOATS=y | ||
| 42 | UCLIBC_HAS_FPU=y | ||
| 43 | DO_C99_MATH=y | ||
| 44 | KERNEL_HEADERS="/usr/include" | ||
| 45 | HAVE_DOT_CONFIG=y | ||
| 46 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch b/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch new file mode 100644 index 0000000000..339ce7f5cb --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | Index: git/libc/sysdeps/linux/powerpc/Makefile.arch | ||
| 2 | =================================================================== | ||
| 3 | --- git.orig/libc/sysdeps/linux/powerpc/Makefile.arch | ||
| 4 | +++ git/libc/sysdeps/linux/powerpc/Makefile.arch | ||
| 5 | @@ -5,7 +5,7 @@ | ||
| 6 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
| 7 | # | ||
| 8 | |||
| 9 | -CSRC := __syscall_error.c pread_write.c ioctl.c | ||
| 10 | +CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c | ||
| 11 | |||
| 12 | ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) | ||
| 13 | CSRC += posix_fadvise.c posix_fadvise64.c | ||
| 14 | Index: git/libc/sysdeps/linux/powerpc/copysignl.c | ||
| 15 | =================================================================== | ||
| 16 | --- /dev/null | ||
| 17 | +++ git/libc/sysdeps/linux/powerpc/copysignl.c | ||
| 18 | @@ -0,0 +1,89 @@ | ||
| 19 | +/* s_copysignl.c -- long double version of s_copysign.c. | ||
| 20 | + * Conversion to long double by Ulrich Drepper, | ||
| 21 | + * Cygnus Support, drepper@cygnus.com. | ||
| 22 | + */ | ||
| 23 | + | ||
| 24 | +/* | ||
| 25 | + * ==================================================== | ||
| 26 | + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||
| 27 | + * | ||
| 28 | + * Developed at SunPro, a Sun Microsystems, Inc. business. | ||
| 29 | + * Permission to use, copy, modify, and distribute this | ||
| 30 | + * software is freely granted, provided that this notice | ||
| 31 | + * is preserved. | ||
| 32 | + * ==================================================== | ||
| 33 | + */ | ||
| 34 | + | ||
| 35 | +/* | ||
| 36 | + * copysignl(long double x, long double y) | ||
| 37 | + * copysignl(x,y) returns a value with the magnitude of x and | ||
| 38 | + * with the sign bit of y. | ||
| 39 | + */ | ||
| 40 | + | ||
| 41 | +#include <endian.h> | ||
| 42 | +#include <stdint.h> | ||
| 43 | + | ||
| 44 | +#if __FLOAT_WORD_ORDER == BIG_ENDIAN | ||
| 45 | + | ||
| 46 | +typedef union | ||
| 47 | +{ | ||
| 48 | + long double value; | ||
| 49 | + struct | ||
| 50 | + { | ||
| 51 | + int sign_exponent:16; | ||
| 52 | + unsigned int empty:16; | ||
| 53 | + uint32_t msw; | ||
| 54 | + uint32_t lsw; | ||
| 55 | + } parts; | ||
| 56 | +} ieee_long_double_shape_type; | ||
| 57 | + | ||
| 58 | +#endif | ||
| 59 | + | ||
| 60 | +#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN | ||
| 61 | + | ||
| 62 | +typedef union | ||
| 63 | +{ | ||
| 64 | + long double value; | ||
| 65 | + struct | ||
| 66 | + { | ||
| 67 | + uint32_t lsw; | ||
| 68 | + uint32_t msw; | ||
| 69 | + int sign_exponent:16; | ||
| 70 | + unsigned int empty:16; | ||
| 71 | + } parts; | ||
| 72 | +} ieee_long_double_shape_type; | ||
| 73 | + | ||
| 74 | +#endif | ||
| 75 | + | ||
| 76 | +/* Get int from the exponent of a long double. */ | ||
| 77 | + | ||
| 78 | +#define GET_LDOUBLE_EXP(exp,d) \ | ||
| 79 | +do { \ | ||
| 80 | + ieee_long_double_shape_type ge_u; \ | ||
| 81 | + ge_u.value = (d); \ | ||
| 82 | + (exp) = ge_u.parts.sign_exponent; \ | ||
| 83 | +} while (0) | ||
| 84 | + | ||
| 85 | +/* Set exponent of a long double from an int. */ | ||
| 86 | + | ||
| 87 | +#define SET_LDOUBLE_EXP(d,exp) \ | ||
| 88 | +do { \ | ||
| 89 | + ieee_long_double_shape_type se_u; \ | ||
| 90 | + se_u.value = (d); \ | ||
| 91 | + se_u.parts.sign_exponent = (exp); \ | ||
| 92 | + (d) = se_u.value; \ | ||
| 93 | +} while (0) | ||
| 94 | + | ||
| 95 | +long double copysignl(long double x, long double y); | ||
| 96 | +libc_hidden_proto(copysignl); | ||
| 97 | + | ||
| 98 | +long double copysignl(long double x, long double y) | ||
| 99 | +{ | ||
| 100 | + uint32_t es1,es2; | ||
| 101 | + GET_LDOUBLE_EXP(es1,x); | ||
| 102 | + GET_LDOUBLE_EXP(es2,y); | ||
| 103 | + SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000)); | ||
| 104 | + return x; | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +libc_hidden_def(copysignl); | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemuarm/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine index fafdd7584e..7154278f88 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/qemuarm/uClibc.machine +++ b/meta/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Sun May 13 11:16:02 2007 | 3 | # Version: 0.9.32-git |
| 4 | # Mon Jul 19 01:34:29 2010 | ||
| 4 | # | 5 | # |
| 5 | # TARGET_alpha is not set | 6 | # TARGET_alpha is not set |
| 6 | TARGET_arm=y | 7 | TARGET_arm=y |
| 8 | # TARGET_avr32 is not set | ||
| 7 | # TARGET_bfin is not set | 9 | # TARGET_bfin is not set |
| 8 | # TARGET_cris is not set | 10 | # TARGET_cris is not set |
| 9 | # TARGET_e1 is not set | 11 | # TARGET_e1 is not set |
| @@ -25,6 +27,7 @@ TARGET_arm=y | |||
| 25 | # TARGET_v850 is not set | 27 | # TARGET_v850 is not set |
| 26 | # TARGET_vax is not set | 28 | # TARGET_vax is not set |
| 27 | # TARGET_x86_64 is not set | 29 | # TARGET_x86_64 is not set |
| 30 | # TARGET_xtensa is not set | ||
| 28 | 31 | ||
| 29 | # | 32 | # |
| 30 | # Target Architecture Features and Options | 33 | # Target Architecture Features and Options |
| @@ -46,6 +49,8 @@ CONFIG_ARM926T=y | |||
| 46 | # CONFIG_ARM1136JF_S is not set | 49 | # CONFIG_ARM1136JF_S is not set |
| 47 | # CONFIG_ARM1176JZ_S is not set | 50 | # CONFIG_ARM1176JZ_S is not set |
| 48 | # CONFIG_ARM1176JZF_S is not set | 51 | # CONFIG_ARM1176JZF_S is not set |
| 52 | # CONFIG_ARM_CORTEX_M3 is not set | ||
| 53 | # CONFIG_ARM_CORTEX_M1 is not set | ||
| 49 | # CONFIG_ARM_SA110 is not set | 54 | # CONFIG_ARM_SA110 is not set |
| 50 | # CONFIG_ARM_SA1100 is not set | 55 | # CONFIG_ARM_SA1100 is not set |
| 51 | # CONFIG_ARM_XSCALE is not set | 56 | # CONFIG_ARM_XSCALE is not set |
| @@ -65,6 +70,7 @@ UCLIBC_HAS_FLOATS=y | |||
| 65 | # UCLIBC_HAS_FPU is not set | 70 | # UCLIBC_HAS_FPU is not set |
| 66 | UCLIBC_HAS_SOFT_FLOAT=y | 71 | UCLIBC_HAS_SOFT_FLOAT=y |
| 67 | DO_C99_MATH=y | 72 | DO_C99_MATH=y |
| 68 | KERNEL_HEADERS="/bad/path/to/include" | 73 | # DO_XSI_MATH is not set |
| 74 | # UCLIBC_HAS_FENV is not set | ||
| 75 | KERNEL_HEADERS="/usr/include" | ||
| 69 | HAVE_DOT_CONFIG=y | 76 | HAVE_DOT_CONFIG=y |
| 70 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine new file mode 100644 index 0000000000..1cf1addca9 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Wed Jul 9 13:37:36 2008 | ||
| 4 | # | ||
| 5 | # TARGET_alpha is not set | ||
| 6 | # TARGET_arm is not set | ||
| 7 | # TARGET_avr32 is not set | ||
| 8 | # TARGET_bfin is not set | ||
| 9 | # TARGET_cris is not set | ||
| 10 | # TARGET_e1 is not set | ||
| 11 | # TARGET_frv is not set | ||
| 12 | # TARGET_h8300 is not set | ||
| 13 | # TARGET_hppa is not set | ||
| 14 | # TARGET_i386 is not set | ||
| 15 | # TARGET_i960 is not set | ||
| 16 | # TARGET_ia64 is not set | ||
| 17 | # TARGET_m68k is not set | ||
| 18 | # TARGET_microblaze is not set | ||
| 19 | TARGET_mips=y | ||
| 20 | # TARGET_nios is not set | ||
| 21 | # TARGET_nios2 is not set | ||
| 22 | # TARGET_powerpc is not set | ||
| 23 | # TARGET_sh is not set | ||
| 24 | # TARGET_sh64 is not set | ||
| 25 | # TARGET_sparc is not set | ||
| 26 | # TARGET_v850 is not set | ||
| 27 | # TARGET_vax is not set | ||
| 28 | # TARGET_x86_64 is not set | ||
| 29 | # TARGET_xtensa is not set | ||
| 30 | |||
| 31 | # | ||
| 32 | # Target Architecture Features and Options | ||
| 33 | # | ||
| 34 | TARGET_ARCH="mips" | ||
| 35 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 36 | ARCH_CFLAGS="-mno-split-addresses" | ||
| 37 | CONFIG_MIPS_O32_ABI=y | ||
| 38 | # CONFIG_MIPS_N32_ABI is not set | ||
| 39 | # CONFIG_MIPS_N64_ABI is not set | ||
| 40 | # CONFIG_MIPS_ISA_1 is not set | ||
| 41 | # CONFIG_MIPS_ISA_2 is not set | ||
| 42 | # CONFIG_MIPS_ISA_3 is not set | ||
| 43 | # CONFIG_MIPS_ISA_4 is not set | ||
| 44 | CONFIG_MIPS_ISA_MIPS32=y | ||
| 45 | # CONFIG_MIPS_ISA_MIPS64 is not set | ||
| 46 | TARGET_SUBARCH="" | ||
| 47 | |||
| 48 | # | ||
| 49 | # Using ELF file format | ||
| 50 | # | ||
| 51 | ARCH_ANY_ENDIAN=y | ||
| 52 | # ARCH_BIG_ENDIAN is not set | ||
| 53 | ARCH_WANTS_BIG_ENDIAN=y | ||
| 54 | # ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 55 | ARCH_HAS_MMU=y | ||
| 56 | ARCH_USE_MMU=y | ||
| 57 | UCLIBC_HAS_FLOATS=y | ||
| 58 | UCLIBC_HAS_FPU=y | ||
| 59 | # DO_C99_MATH is not set | ||
| 60 | # UCLIBC_HAS_FENV is not set | ||
| 61 | KERNEL_HEADERS="/usr/include" | ||
| 62 | HAVE_DOT_CONFIG=y | ||
| 63 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine new file mode 100644 index 0000000000..3909ccc9e1 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # | ||
| 4 | # TARGET_alpha is not set | ||
| 5 | # TARGET_arm is not set | ||
| 6 | # TARGET_bfin is not set | ||
| 7 | # TARGET_cris is not set | ||
| 8 | # TARGET_e1 is not set | ||
| 9 | # TARGET_frv is not set | ||
| 10 | # TARGET_h8300 is not set | ||
| 11 | # TARGET_hppa is not set | ||
| 12 | TARGET_i386=y | ||
| 13 | # TARGET_i960 is not set | ||
| 14 | # TARGET_m68k is not set | ||
| 15 | # TARGET_microblaze is not set | ||
| 16 | # TARGET_mips is not set | ||
| 17 | # TARGET_nios is not set | ||
| 18 | # TARGET_nios2 is not set | ||
| 19 | # TARGET_powerpc is not set | ||
| 20 | # TARGET_sh is not set | ||
| 21 | # TARGET_sh64 is not set | ||
| 22 | # TARGET_sparc is not set | ||
| 23 | # TARGET_v850 is not set | ||
| 24 | # TARGET_x86_64 is not set | ||
| 25 | |||
| 26 | # | ||
| 27 | # Target Architecture Features and Options | ||
| 28 | # | ||
| 29 | TARGET_ARCH="i386" | ||
| 30 | # ARCH_SUPPORTS_BIG_ENDIAN is not set | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 32 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 33 | # CONFIG_GENERIC_386 is not set | ||
| 34 | # CONFIG_386 is not set | ||
| 35 | # CONFIG_486 is not set | ||
| 36 | # CONFIG_586 is not set | ||
| 37 | # CONFIG_586MMX is not set | ||
| 38 | # CONFIG_686 is not set | ||
| 39 | # CONFIG_PENTIUMII is not set | ||
| 40 | # CONFIG_PENTIUMIII is not set | ||
| 41 | CONFIG_PENTIUM4=y | ||
| 42 | # CONFIG_K6 is not set | ||
| 43 | # CONFIG_K7 is not set | ||
| 44 | # CONFIG_ELAN is not set | ||
| 45 | # CONFIG_CRUSOE is not set | ||
| 46 | # CONFIG_WINCHIPC6 is not set | ||
| 47 | # CONFIG_WINCHIP2 is not set | ||
| 48 | # CONFIG_CYRIXIII is not set | ||
| 49 | # CONFIG_NEHEMIAH is not set | ||
| 50 | ARCH_LITTLE_ENDIAN=y | ||
| 51 | # ARCH_BIG_ENDIAN is not set | ||
| 52 | # ARCH_HAS_NO_MMU is not set | ||
| 53 | ARCH_HAS_MMU=y | ||
| 54 | UCLIBC_HAS_FLOATS=y | ||
| 55 | UCLIBC_HAS_FPU=y | ||
| 56 | DO_C99_MATH=y | ||
| 57 | # UCLIBC_HAS_FENV is not set | ||
| 58 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 59 | HAVE_DOT_CONFIG=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch b/meta/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch new file mode 100644 index 0000000000..f4957351e9 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313309agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:20 -0800 (PST) | ||
| 4 | Received: by 10.216.173.7 with SMTP id u7mr612034wel.50.1294533919433; | ||
| 5 | Sat, 08 Jan 2011 16:45:19 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id e10si33752027wer.68.2011.01.08.16.45.19; | ||
| 9 | Sat, 08 Jan 2011 16:45:19 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClJDu; Sun, 09 Jan 2011 01:45:18 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 7/7] ARM: remove EABI/OABI selection | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:10 +0100 | ||
| 22 | Message-Id: <1294533910-19305-8-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | Rely on the compiler to be properly setup for the default ABI. | ||
| 28 | |||
| 29 | When installing-headers, there are two cases: | ||
| 30 | - NPTL: no issue, a cross-compiler is already expected | ||
| 31 | - LinuxThreads: no issue, EABI/OABI has no impact on installed headers. | ||
| 32 | |||
| 33 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 34 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 35 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 36 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 37 | --- | ||
| 38 | extra/Configs/Config.arm | 11 ----------- | ||
| 39 | libc/sysdeps/linux/arm/Makefile.arch | 9 +++++++-- | ||
| 40 | libc/sysdeps/linux/arm/bits/huge_val.h | 4 ++-- | ||
| 41 | 3 files changed, 9 insertions(+), 15 deletions(-) | ||
| 42 | |||
| 43 | Index: git/libc/sysdeps/linux/arm/Makefile.arch | ||
| 44 | =================================================================== | ||
| 45 | --- git.orig/libc/sysdeps/linux/arm/Makefile.arch | ||
| 46 | +++ git/libc/sysdeps/linux/arm/Makefile.arch | ||
| 47 | @@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) | ||
| 48 | CSRC += posix_fadvise.c posix_fadvise64.c | ||
| 49 | endif | ||
| 50 | |||
| 51 | -ifeq ($(CONFIG_ARM_EABI),y) | ||
| 52 | +# Is our compiler set up for EABI ? | ||
| 53 | +IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM </dev/null 2>/dev/null \ | ||
| 54 | + |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \ | ||
| 55 | + ) | ||
| 56 | + | ||
| 57 | +ifeq ($(IS_EABI),y) | ||
| 58 | CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \ | ||
| 59 | aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \ | ||
| 60 | aeabi_memmove.c aeabi_memset.c find_exidx.c | ||
| 61 | @@ -37,7 +42,7 @@ else | ||
| 62 | CSRC += syscall.c | ||
| 63 | endif | ||
| 64 | |||
| 65 | -ifeq ($(CONFIG_ARM_EABI),y) | ||
| 66 | +ifeq ($(IS_EABI),y) | ||
| 67 | libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \ | ||
| 68 | $(ARCH_OUT)/aeabi_sighandlers.o | ||
| 69 | libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \ | ||
| 70 | Index: git/libc/sysdeps/linux/arm/bits/huge_val.h | ||
| 71 | =================================================================== | ||
| 72 | --- git.orig/libc/sysdeps/linux/arm/bits/huge_val.h | ||
| 73 | +++ git/libc/sysdeps/linux/arm/bits/huge_val.h | ||
| 74 | @@ -32,7 +32,7 @@ | ||
| 75 | # define HUGE_VAL (__extension__ 0x1.0p2047) | ||
| 76 | #elif defined __GNUC__ | ||
| 77 | |||
| 78 | -#ifndef __CONFIG_ARM_EABI__ | ||
| 79 | +#ifndef __ARM_EABI__ | ||
| 80 | # define HUGE_VAL \ | ||
| 81 | (__extension__ \ | ||
| 82 | ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ | ||
| 83 | @@ -50,7 +50,7 @@ | ||
| 84 | |||
| 85 | typedef union { unsigned char __c[8]; double __d; } __huge_val_t; | ||
| 86 | |||
| 87 | -#ifndef __CONFIG_ARM_EABI__ | ||
| 88 | +#ifndef __ARM_EABI__ | ||
| 89 | # if __BYTE_ORDER == __BIG_ENDIAN | ||
| 90 | # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 } | ||
| 91 | # endif | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch b/meta/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch new file mode 100644 index 0000000000..16f3f41c30 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313303agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:18 -0800 (PST) | ||
| 4 | Received: by 10.227.98.158 with SMTP id q30mr1255804wbn.151.1294533917314; | ||
| 5 | Sat, 08 Jan 2011 16:45:17 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id r3si33749838wbr.54.2011.01.08.16.45.16; | ||
| 9 | Sat, 08 Jan 2011 16:45:17 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClGDS; Sun, 09 Jan 2011 01:45:16 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 3/7] ARM: remove sub-arch/variants selection from menuconfig | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:06 +0100 | ||
| 22 | Message-Id: <1294533910-19305-4-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | Rely on the compiler to be correctly set up to generate | ||
| 28 | appropriate code for the target variant. | ||
| 29 | |||
| 30 | This exposes the Thumb option, as it is no longer auto-selected. | ||
| 31 | The "Use BX" no longer depends on supported CPU to be selected, | ||
| 32 | so it now defaults to 'n' as it shall work by default on CPUs | ||
| 33 | that do not have BX. | ||
| 34 | |||
| 35 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 36 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 37 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 38 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 39 | --- | ||
| 40 | Rules.mak | 19 ------- | ||
| 41 | extra/Configs/Config.arm | 125 ++-------------------------------------------- | ||
| 42 | 2 files changed, 5 insertions(+), 139 deletions(-) | ||
| 43 | |||
| 44 | diff --git a/Rules.mak b/Rules.mak | ||
| 45 | index 2a16908..09741a6 100644 | ||
| 46 | --- a/Rules.mak | ||
| 47 | +++ b/Rules.mak | ||
| 48 | @@ -332,25 +332,6 @@ ifeq ($(TARGET_ARCH),arm) | ||
| 49 | OPTIMIZATION+=-fstrict-aliasing | ||
| 50 | CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian | ||
| 51 | CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian | ||
| 52 | - CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+= | ||
| 53 | - CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3 | ||
| 54 | - CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3 | ||
| 55 | - CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4t | ||
| 56 | - CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4t | ||
| 57 | - CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4t | ||
| 58 | - CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4t | ||
| 59 | - CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9e -march=armv5te | ||
| 60 | - CPU_CFLAGS-$(CONFIG_ARM10T)+=-mtune=arm10tdmi -march=armv5t | ||
| 61 | - CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6 | ||
| 62 | - CPU_CFLAGS-$(CONFIG_ARM1176JZ_S)+=-mtune=arm1176jz-s -march=armv6 | ||
| 63 | - CPU_CFLAGS-$(CONFIG_ARM1176JZF_S)+=-mtune=arm1176jzf-s -march=armv6 | ||
| 64 | - CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4 | ||
| 65 | - CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4 | ||
| 66 | - CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110) | ||
| 67 | - CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale | ||
| 68 | - CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt | ||
| 69 | - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 | ||
| 70 | - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 | ||
| 71 | CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb | ||
| 72 | endif | ||
| 73 | |||
| 74 | diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm | ||
| 75 | index c9c40d4..6c75a00 100644 | ||
| 76 | --- a/extra/Configs/Config.arm | ||
| 77 | +++ b/extra/Configs/Config.arm | ||
| 78 | @@ -30,129 +30,14 @@ config CONFIG_ARM_EABI | ||
| 79 | |||
| 80 | endchoice | ||
| 81 | |||
| 82 | -choice | ||
| 83 | - prompt "Target Processor Type" | ||
| 84 | - default CONFIG_GENERIC_ARM | ||
| 85 | - help | ||
| 86 | - This is the processor type of your CPU. This information is used for | ||
| 87 | - optimizing purposes. To build a library that will run on all ARMCPU | ||
| 88 | - types (albeit not optimally fast), you can specify "Generic Arm" here. | ||
| 89 | - If you pick anything other than "Generic Arm", there is no guarantee | ||
| 90 | - that uClibc will even run on anything other than the selected | ||
| 91 | - processor type. | ||
| 92 | - | ||
| 93 | - Here are the settings recommended for greatest speed: | ||
| 94 | - - "Generic Arm" select this if your compiler is already setup to | ||
| 95 | - optimize things properly, or if you want to run on pretty much | ||
| 96 | - everything, or you just don't much care. | ||
| 97 | - - For anything else, pick the ARM core type that best matches the | ||
| 98 | - cpu you will be using on your device. | ||
| 99 | - | ||
| 100 | - If you don't know what to do, choose "Generic Arm". | ||
| 101 | - | ||
| 102 | -config CONFIG_GENERIC_ARM | ||
| 103 | - bool "Generic Arm" | ||
| 104 | - | ||
| 105 | -config CONFIG_ARM610 | ||
| 106 | - bool "Arm 610" | ||
| 107 | - select ARCH_HAS_MMU | ||
| 108 | - | ||
| 109 | -config CONFIG_ARM710 | ||
| 110 | - bool "Arm 710" | ||
| 111 | - select ARCH_HAS_MMU | ||
| 112 | - | ||
| 113 | -config CONFIG_ARM7TDMI | ||
| 114 | - bool "Arm 7TDMI" | ||
| 115 | - select ARCH_HAS_NO_MMU | ||
| 116 | - select HAS_THUMB | ||
| 117 | - | ||
| 118 | -config CONFIG_ARM720T | ||
| 119 | - bool "Arm 720T" | ||
| 120 | - select ARCH_HAS_MMU | ||
| 121 | - select HAS_THUMB | ||
| 122 | - | ||
| 123 | -config CONFIG_ARM920T | ||
| 124 | - bool "Arm 920T" | ||
| 125 | - select ARCH_HAS_MMU | ||
| 126 | - select HAS_THUMB | ||
| 127 | - | ||
| 128 | -config CONFIG_ARM922T | ||
| 129 | - bool "Arm 922T" | ||
| 130 | - select ARCH_HAS_MMU | ||
| 131 | - select HAS_THUMB | ||
| 132 | - | ||
| 133 | -config CONFIG_ARM926T | ||
| 134 | - bool "Arm 926T" | ||
| 135 | - select ARCH_HAS_MMU | ||
| 136 | - select HAS_THUMB | ||
| 137 | - | ||
| 138 | -config CONFIG_ARM10T | ||
| 139 | - bool "Arm 10T" | ||
| 140 | - select ARCH_HAS_MMU | ||
| 141 | - select HAS_THUMB | ||
| 142 | - | ||
| 143 | -config CONFIG_ARM1136JF_S | ||
| 144 | - bool "Arm 1136JF-S" | ||
| 145 | - select ARCH_HAS_MMU | ||
| 146 | - select HAS_THUMB | ||
| 147 | - | ||
| 148 | -config CONFIG_ARM1176JZ_S | ||
| 149 | - bool "Arm 1176JZ-S" | ||
| 150 | - select ARCH_HAS_MMU | ||
| 151 | - select HAS_THUMB | ||
| 152 | - | ||
| 153 | -config CONFIG_ARM1176JZF_S | ||
| 154 | - bool "Arm 1176JZF-S" | ||
| 155 | - select ARCH_HAS_MMU | ||
| 156 | - select HAS_THUMB | ||
| 157 | - | ||
| 158 | -config CONFIG_ARM_CORTEX_M3 | ||
| 159 | - bool "Arm Cortex-M3" | ||
| 160 | - select ARCH_HAS_NO_MMU | ||
| 161 | - select FORCE_THUMB | ||
| 162 | - | ||
| 163 | -config CONFIG_ARM_CORTEX_M1 | ||
| 164 | - bool "Arm Cortex-M1" | ||
| 165 | - select ARCH_HAS_NO_MMU | ||
| 166 | - select FORCE_THUMB | ||
| 167 | - | ||
| 168 | -config CONFIG_ARM_SA110 | ||
| 169 | - bool "Intel StrongArm SA-110" | ||
| 170 | - select ARCH_HAS_MMU | ||
| 171 | - select HAS_THUMB | ||
| 172 | - | ||
| 173 | -config CONFIG_ARM_SA1100 | ||
| 174 | - bool "Intel StrongArm SA-1100" | ||
| 175 | - select ARCH_HAS_MMU | ||
| 176 | - select HAS_THUMB | ||
| 177 | - | ||
| 178 | -config CONFIG_ARM_XSCALE | ||
| 179 | - bool "Intel Xscale" | ||
| 180 | - select ARCH_HAS_MMU | ||
| 181 | - select HAS_THUMB | ||
| 182 | - | ||
| 183 | -config CONFIG_ARM_IWMMXT | ||
| 184 | - bool "Intel Xscale With WMMX PXA27x" | ||
| 185 | - select ARCH_HAS_MMU | ||
| 186 | - select HAS_THUMB | ||
| 187 | - | ||
| 188 | -endchoice | ||
| 189 | - | ||
| 190 | -config HAS_THUMB | ||
| 191 | - bool | ||
| 192 | - | ||
| 193 | -config FORCE_THUMB | ||
| 194 | - bool | ||
| 195 | - select HAS_THUMB | ||
| 196 | - select COMPILE_IN_THUMB_MODE | ||
| 197 | - select USE_BX | ||
| 198 | - | ||
| 199 | config COMPILE_IN_THUMB_MODE | ||
| 200 | - bool | ||
| 201 | + bool "Build using Thumb mode" | ||
| 202 | + select USE_BX | ||
| 203 | + help | ||
| 204 | + Say 'y' here to force building uClibc in thumb mode. | ||
| 205 | + Say 'n' to use your compiler's default mode. | ||
| 206 | |||
| 207 | config USE_BX | ||
| 208 | bool "Use BX in function return" | ||
| 209 | - default y | ||
| 210 | - depends on HAS_THUMB | ||
| 211 | help | ||
| 212 | Use BX instruction for THUMB aware architectures. | ||
| 213 | -- | ||
| 214 | 1.7.1 | ||
| 215 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch new file mode 100644 index 0000000000..1930383260 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | Index: git/include/features.h | ||
| 2 | =================================================================== | ||
| 3 | --- git.orig/include/features.h | ||
| 4 | +++ git/include/features.h | ||
| 5 | @@ -186,7 +186,6 @@ | ||
| 6 | # define __need_uClibc_config_h | ||
| 7 | # include <bits/uClibc_config.h> | ||
| 8 | # undef __need_uClibc_config_h | ||
| 9 | - | ||
| 10 | /* For uClibc, always optimize for size -- this should disable | ||
| 11 | * a lot of expensive inlining... | ||
| 12 | * TODO: this is wrong! __OPTIMIZE_SIZE__ is an indicator of | ||
| 13 | Index: git/libpthread/nptl/pthread_mutex_timedlock.c | ||
| 14 | =================================================================== | ||
| 15 | --- git.orig/libpthread/nptl/pthread_mutex_timedlock.c | ||
| 16 | +++ git/libpthread/nptl/pthread_mutex_timedlock.c | ||
| 17 | @@ -29,7 +29,9 @@ | ||
| 18 | * error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’ | ||
| 19 | */ | ||
| 20 | int | ||
| 21 | +#ifndef __OPTIMIZE__ | ||
| 22 | attribute_optimize("Os") | ||
| 23 | +#endif | ||
| 24 | pthread_mutex_timedlock ( | ||
| 25 | pthread_mutex_t *mutex, | ||
| 26 | const struct timespec *abstime) | ||
| 27 | Index: git/libc/sysdeps/linux/powerpc/bits/mathinline.h | ||
| 28 | =================================================================== | ||
| 29 | --- git.orig/libc/sysdeps/linux/powerpc/bits/mathinline.h | ||
| 30 | +++ git/libc/sysdeps/linux/powerpc/bits/mathinline.h | ||
| 31 | @@ -27,7 +27,7 @@ | ||
| 32 | #ifdef __cplusplus | ||
| 33 | # define __MATH_INLINE __inline | ||
| 34 | #else | ||
| 35 | -# define __MATH_INLINE extern __inline | ||
| 36 | +# define __MATH_INLINE __extern_inline | ||
| 37 | #endif /* __cplusplus */ | ||
| 38 | |||
| 39 | #if defined __GNUC__ && !defined _SOFT_FLOAT | ||
| 40 | Index: git/libc/sysdeps/linux/alpha/bits/mathinline.h | ||
| 41 | =================================================================== | ||
| 42 | --- git.orig/libc/sysdeps/linux/alpha/bits/mathinline.h | ||
| 43 | +++ git/libc/sysdeps/linux/alpha/bits/mathinline.h | ||
| 44 | @@ -25,7 +25,7 @@ | ||
| 45 | #ifdef __cplusplus | ||
| 46 | # define __MATH_INLINE __inline | ||
| 47 | #else | ||
| 48 | -# define __MATH_INLINE extern __inline | ||
| 49 | +# define __MATH_INLINE __extern_inline | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0) | ||
| 53 | Index: git/libc/sysdeps/linux/common/bits/socket.h | ||
| 54 | =================================================================== | ||
| 55 | --- git.orig/libc/sysdeps/linux/common/bits/socket.h | ||
| 56 | +++ git/libc/sysdeps/linux/common/bits/socket.h | ||
| 57 | @@ -302,7 +302,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st | ||
| 58 | libc_hidden_proto(__cmsg_nxthdr) | ||
| 59 | #ifdef __USE_EXTERN_INLINES | ||
| 60 | # ifndef _EXTERN_INLINE | ||
| 61 | -# define _EXTERN_INLINE extern __inline | ||
| 62 | +# define _EXTERN_INLINE __extern_inline | ||
| 63 | # endif | ||
| 64 | _EXTERN_INLINE struct cmsghdr * | ||
| 65 | __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) | ||
| 66 | Index: git/libc/sysdeps/linux/i386/bits/mathinline.h | ||
| 67 | =================================================================== | ||
| 68 | --- git.orig/libc/sysdeps/linux/i386/bits/mathinline.h | ||
| 69 | +++ git/libc/sysdeps/linux/i386/bits/mathinline.h | ||
| 70 | @@ -26,7 +26,7 @@ | ||
| 71 | #ifdef __cplusplus | ||
| 72 | # define __MATH_INLINE __inline | ||
| 73 | #else | ||
| 74 | -# define __MATH_INLINE extern __inline | ||
| 75 | +# define __MATH_INLINE __extern_inline | ||
| 76 | #endif | ||
| 77 | |||
| 78 | |||
| 79 | Index: git/libc/sysdeps/linux/ia64/bits/mathinline.h | ||
| 80 | =================================================================== | ||
| 81 | --- git.orig/libc/sysdeps/linux/ia64/bits/mathinline.h | ||
| 82 | +++ git/libc/sysdeps/linux/ia64/bits/mathinline.h | ||
| 83 | @@ -24,7 +24,7 @@ | ||
| 84 | #ifdef __cplusplus | ||
| 85 | # define __MATH_INLINE __inline | ||
| 86 | #else | ||
| 87 | -# define __MATH_INLINE extern __inline | ||
| 88 | +# define __MATH_INLINE __extern_inline | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2 | ||
| 92 | Index: git/libc/sysdeps/linux/m68k/bits/mathinline.h | ||
| 93 | =================================================================== | ||
| 94 | --- git.orig/libc/sysdeps/linux/m68k/bits/mathinline.h | ||
| 95 | +++ git/libc/sysdeps/linux/m68k/bits/mathinline.h | ||
| 96 | @@ -92,7 +92,7 @@ | ||
| 97 | # ifdef __cplusplus | ||
| 98 | # define __m81_inline __inline | ||
| 99 | # else | ||
| 100 | -# define __m81_inline extern __inline | ||
| 101 | +# define __m81_inline __extern_inline | ||
| 102 | # endif | ||
| 103 | # define __M81_MATH_INLINES 1 | ||
| 104 | #endif | ||
| 105 | @@ -351,14 +351,14 @@ __inline_functions (long double,l) | ||
| 106 | /* Note that there must be no whitespace before the argument passed for | ||
| 107 | NAME, to make token pasting work correctly with -traditional. */ | ||
| 108 | # define __inline_forward_c(rettype, name, args1, args2) \ | ||
| 109 | -extern __inline rettype __attribute__((__const__)) \ | ||
| 110 | +__extern_inline rettype __attribute__((__const__)) \ | ||
| 111 | name args1 \ | ||
| 112 | { \ | ||
| 113 | return __CONCAT(__,name) args2; \ | ||
| 114 | } | ||
| 115 | |||
| 116 | # define __inline_forward(rettype, name, args1, args2) \ | ||
| 117 | -extern __inline rettype name args1 \ | ||
| 118 | +__extern_inline rettype name args1 \ | ||
| 119 | { \ | ||
| 120 | return __CONCAT(__,name) args2; \ | ||
| 121 | } | ||
| 122 | Index: git/libc/sysdeps/linux/mips/bits/socket.h | ||
| 123 | =================================================================== | ||
| 124 | --- git.orig/libc/sysdeps/linux/mips/bits/socket.h | ||
| 125 | +++ git/libc/sysdeps/linux/mips/bits/socket.h | ||
| 126 | @@ -307,7 +307,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st | ||
| 127 | libc_hidden_proto(__cmsg_nxthdr) | ||
| 128 | #ifdef __USE_EXTERN_INLINES | ||
| 129 | # ifndef _EXTERN_INLINE | ||
| 130 | -# define _EXTERN_INLINE extern __inline | ||
| 131 | +# define _EXTERN_INLINE __extern_inline | ||
| 132 | # endif | ||
| 133 | _EXTERN_INLINE struct cmsghdr * | ||
| 134 | __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) | ||
| 135 | Index: git/libc/sysdeps/linux/mips/sys/tas.h | ||
| 136 | =================================================================== | ||
| 137 | --- git.orig/libc/sysdeps/linux/mips/sys/tas.h | ||
| 138 | +++ git/libc/sysdeps/linux/mips/sys/tas.h | ||
| 139 | @@ -30,7 +30,7 @@ extern int _test_and_set (int *p, int v) | ||
| 140 | #ifdef __USE_EXTERN_INLINES | ||
| 141 | |||
| 142 | # ifndef _EXTERN_INLINE | ||
| 143 | -# define _EXTERN_INLINE extern __inline | ||
| 144 | +# define _EXTERN_INLINE __extern_inline | ||
| 145 | # endif | ||
| 146 | |||
| 147 | _EXTERN_INLINE int | ||
| 148 | Index: git/libc/sysdeps/linux/sparc/bits/mathinline.h | ||
| 149 | =================================================================== | ||
| 150 | --- git.orig/libc/sysdeps/linux/sparc/bits/mathinline.h | ||
| 151 | +++ git/libc/sysdeps/linux/sparc/bits/mathinline.h | ||
| 152 | @@ -131,7 +131,7 @@ | ||
| 153 | # ifdef __cplusplus | ||
| 154 | # define __MATH_INLINE __inline | ||
| 155 | # else | ||
| 156 | -# define __MATH_INLINE extern __inline | ||
| 157 | +# define __MATH_INLINE __extern_inline | ||
| 158 | # endif /* __cplusplus */ | ||
| 159 | |||
| 160 | /* The gcc, version 2.7 or below, has problems with all this inlining | ||
| 161 | Index: git/libc/sysdeps/linux/sparc/bits/socket.h | ||
| 162 | =================================================================== | ||
| 163 | --- git.orig/libc/sysdeps/linux/sparc/bits/socket.h | ||
| 164 | +++ git/libc/sysdeps/linux/sparc/bits/socket.h | ||
| 165 | @@ -292,7 +292,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st | ||
| 166 | libc_hidden_proto(__cmsg_nxthdr) | ||
| 167 | #ifdef __USE_EXTERN_INLINES | ||
| 168 | # ifndef _EXTERN_INLINE | ||
| 169 | -# define _EXTERN_INLINE extern __inline | ||
| 170 | +# define _EXTERN_INLINE __extern_inline | ||
| 171 | # endif | ||
| 172 | _EXTERN_INLINE struct cmsghdr * | ||
| 173 | __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) | ||
| 174 | Index: git/libc/sysdeps/linux/x86_64/bits/mathinline.h | ||
| 175 | =================================================================== | ||
| 176 | --- git.orig/libc/sysdeps/linux/x86_64/bits/mathinline.h | ||
| 177 | +++ git/libc/sysdeps/linux/x86_64/bits/mathinline.h | ||
| 178 | @@ -25,7 +25,7 @@ | ||
| 179 | #ifdef __cplusplus | ||
| 180 | # define __MATH_INLINE __inline | ||
| 181 | #else | ||
| 182 | -# define __MATH_INLINE extern __inline | ||
| 183 | +# define __MATH_INLINE __extern_inline | ||
| 184 | #endif | ||
| 185 | |||
| 186 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch b/meta/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch new file mode 100644 index 0000000000..f9f19f9d08 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313299agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:16 -0800 (PST) | ||
| 4 | Received: by 10.227.134.5 with SMTP id h5mr1312651wbt.75.1294533915992; | ||
| 5 | Sat, 08 Jan 2011 16:45:15 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id m42si33753731wej.65.2011.01.08.16.45.15; | ||
| 9 | Sat, 08 Jan 2011 16:45:15 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClEDA; Sun, 09 Jan 2011 01:45:15 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 1/7] ARM: reorder "Use BX" option | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:04 +0100 | ||
| 22 | Message-Id: <1294533910-19305-2-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | "Use BX" is not available on all CPUs, so the option depends on | ||
| 28 | a correct CPU to be chosen . It is weird that e BX" then appears | ||
| 29 | _above_ the CPU selection, not below. | ||
| 30 | |||
| 31 | Move the "Use BX" after the CPU selection. | ||
| 32 | |||
| 33 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 34 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 35 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 36 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 37 | --- | ||
| 38 | extra/Configs/Config.arm | 14 +++++++------- | ||
| 39 | 1 files changed, 7 insertions(+), 7 deletions(-) | ||
| 40 | |||
| 41 | diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm | ||
| 42 | index b060ace..3b90e67 100644 | ||
| 43 | --- a/extra/Configs/Config.arm | ||
| 44 | +++ b/extra/Configs/Config.arm | ||
| 45 | @@ -30,13 +30,6 @@ config CONFIG_ARM_EABI | ||
| 46 | |||
| 47 | endchoice | ||
| 48 | |||
| 49 | -config USE_BX | ||
| 50 | - bool "Use BX in function return" | ||
| 51 | - default y | ||
| 52 | - depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 | ||
| 53 | - help | ||
| 54 | - Use BX instruction for THUMB aware architectures. | ||
| 55 | - | ||
| 56 | choice | ||
| 57 | prompt "Target Processor Type" | ||
| 58 | default CONFIG_GENERIC_ARM | ||
| 59 | @@ -131,3 +124,10 @@ config CONFIG_ARM_IWMMXT | ||
| 60 | select ARCH_HAS_MMU | ||
| 61 | |||
| 62 | endchoice | ||
| 63 | + | ||
| 64 | +config USE_BX | ||
| 65 | + bool "Use BX in function return" | ||
| 66 | + default y | ||
| 67 | + depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 | ||
| 68 | + help | ||
| 69 | + Use BX instruction for THUMB aware architectures. | ||
| 70 | -- | ||
| 71 | 1.7.1 | ||
| 72 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/select-force-thumb.patch b/meta/recipes-core/uclibc/uclibc-git/select-force-thumb.patch new file mode 100644 index 0000000000..7967794a42 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/select-force-thumb.patch | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313301agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:17 -0800 (PST) | ||
| 4 | Received: by 10.216.186.82 with SMTP id v60mr20017574wem.56.1294533916559; | ||
| 5 | Sat, 08 Jan 2011 16:45:16 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id o13si33755824wee.56.2011.01.08.16.45.16; | ||
| 9 | Sat, 08 Jan 2011 16:45:16 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClFDL; Sun, 09 Jan 2011 01:45:16 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 2/7] ARM: introduce blind options to select & force THUMB mode | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:05 +0100 | ||
| 22 | Message-Id: <1294533910-19305-3-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | Add three new blind options to set use of Thumb mode: | ||
| 28 | - COMPILE_IN_THUMB_MODE | ||
| 29 | - if set, CFLAGS will contain -mthumb | ||
| 30 | - if unset, the compiler's default is used | ||
| 31 | - HAS_THUMB | ||
| 32 | - CPUS with Thumb instruction set can select this | ||
| 33 | - use of BX depends on this | ||
| 34 | - FORCE_THUMB | ||
| 35 | - CPUs that are Thumb-only must select this | ||
| 36 | - this selects: HAS_THUMB, COMPILE_IN_THUMB_MODE and USE_BX | ||
| 37 | |||
| 38 | Also, remove leading space in Rules.mak. | ||
| 39 | |||
| 40 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 41 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 42 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 43 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 44 | --- | ||
| 45 | Rules.mak | 7 ++++--- | ||
| 46 | extra/Configs/Config.arm | 31 ++++++++++++++++++++++++++++--- | ||
| 47 | 2 files changed, 32 insertions(+), 6 deletions(-) | ||
| 48 | |||
| 49 | diff --git a/Rules.mak b/Rules.mak | ||
| 50 | index eecdc64..2a16908 100644 | ||
| 51 | --- a/Rules.mak | ||
| 52 | +++ b/Rules.mak | ||
| 53 | @@ -348,9 +348,10 @@ ifeq ($(TARGET_ARCH),arm) | ||
| 54 | CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4 | ||
| 55 | CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110) | ||
| 56 | CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale | ||
| 57 | - CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt | ||
| 58 | - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 -mthumb | ||
| 59 | - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 -mthumb | ||
| 60 | + CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt | ||
| 61 | + CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 | ||
| 62 | + CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 | ||
| 63 | + CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb | ||
| 64 | endif | ||
| 65 | |||
| 66 | ifeq ($(TARGET_ARCH),mips) | ||
| 67 | diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm | ||
| 68 | index 3b90e67..c9c40d4 100644 | ||
| 69 | --- a/extra/Configs/Config.arm | ||
| 70 | +++ b/extra/Configs/Config.arm | ||
| 71 | @@ -64,70 +64,95 @@ config CONFIG_ARM710 | ||
| 72 | config CONFIG_ARM7TDMI | ||
| 73 | bool "Arm 7TDMI" | ||
| 74 | select ARCH_HAS_NO_MMU | ||
| 75 | + select HAS_THUMB | ||
| 76 | |||
| 77 | config CONFIG_ARM720T | ||
| 78 | bool "Arm 720T" | ||
| 79 | select ARCH_HAS_MMU | ||
| 80 | + select HAS_THUMB | ||
| 81 | |||
| 82 | config CONFIG_ARM920T | ||
| 83 | bool "Arm 920T" | ||
| 84 | select ARCH_HAS_MMU | ||
| 85 | + select HAS_THUMB | ||
| 86 | |||
| 87 | config CONFIG_ARM922T | ||
| 88 | bool "Arm 922T" | ||
| 89 | select ARCH_HAS_MMU | ||
| 90 | + select HAS_THUMB | ||
| 91 | |||
| 92 | config CONFIG_ARM926T | ||
| 93 | bool "Arm 926T" | ||
| 94 | select ARCH_HAS_MMU | ||
| 95 | + select HAS_THUMB | ||
| 96 | |||
| 97 | config CONFIG_ARM10T | ||
| 98 | bool "Arm 10T" | ||
| 99 | select ARCH_HAS_MMU | ||
| 100 | + select HAS_THUMB | ||
| 101 | |||
| 102 | config CONFIG_ARM1136JF_S | ||
| 103 | bool "Arm 1136JF-S" | ||
| 104 | select ARCH_HAS_MMU | ||
| 105 | + select HAS_THUMB | ||
| 106 | |||
| 107 | config CONFIG_ARM1176JZ_S | ||
| 108 | bool "Arm 1176JZ-S" | ||
| 109 | select ARCH_HAS_MMU | ||
| 110 | + select HAS_THUMB | ||
| 111 | |||
| 112 | config CONFIG_ARM1176JZF_S | ||
| 113 | bool "Arm 1176JZF-S" | ||
| 114 | select ARCH_HAS_MMU | ||
| 115 | + select HAS_THUMB | ||
| 116 | |||
| 117 | config CONFIG_ARM_CORTEX_M3 | ||
| 118 | bool "Arm Cortex-M3" | ||
| 119 | select ARCH_HAS_NO_MMU | ||
| 120 | - select USE_BX | ||
| 121 | + select FORCE_THUMB | ||
| 122 | |||
| 123 | config CONFIG_ARM_CORTEX_M1 | ||
| 124 | bool "Arm Cortex-M1" | ||
| 125 | select ARCH_HAS_NO_MMU | ||
| 126 | - select USE_BX | ||
| 127 | + select FORCE_THUMB | ||
| 128 | |||
| 129 | config CONFIG_ARM_SA110 | ||
| 130 | bool "Intel StrongArm SA-110" | ||
| 131 | select ARCH_HAS_MMU | ||
| 132 | + select HAS_THUMB | ||
| 133 | |||
| 134 | config CONFIG_ARM_SA1100 | ||
| 135 | bool "Intel StrongArm SA-1100" | ||
| 136 | select ARCH_HAS_MMU | ||
| 137 | + select HAS_THUMB | ||
| 138 | |||
| 139 | config CONFIG_ARM_XSCALE | ||
| 140 | bool "Intel Xscale" | ||
| 141 | select ARCH_HAS_MMU | ||
| 142 | + select HAS_THUMB | ||
| 143 | |||
| 144 | config CONFIG_ARM_IWMMXT | ||
| 145 | bool "Intel Xscale With WMMX PXA27x" | ||
| 146 | select ARCH_HAS_MMU | ||
| 147 | + select HAS_THUMB | ||
| 148 | |||
| 149 | endchoice | ||
| 150 | |||
| 151 | +config HAS_THUMB | ||
| 152 | + bool | ||
| 153 | + | ||
| 154 | +config FORCE_THUMB | ||
| 155 | + bool | ||
| 156 | + select HAS_THUMB | ||
| 157 | + select COMPILE_IN_THUMB_MODE | ||
| 158 | + select USE_BX | ||
| 159 | + | ||
| 160 | +config COMPILE_IN_THUMB_MODE | ||
| 161 | + bool | ||
| 162 | + | ||
| 163 | config USE_BX | ||
| 164 | bool "Use BX in function return" | ||
| 165 | default y | ||
| 166 | - depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 | ||
| 167 | + depends on HAS_THUMB | ||
| 168 | help | ||
| 169 | Use BX instruction for THUMB aware architectures. | ||
| 170 | -- | ||
| 171 | 1.7.1 | ||
| 172 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine new file mode 100644 index 0000000000..65f1c4c3c1 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # | ||
| 4 | # TARGET_alpha is not set | ||
| 5 | # TARGET_arm is not set | ||
| 6 | # TARGET_bfin is not set | ||
| 7 | # TARGET_cris is not set | ||
| 8 | # TARGET_e1 is not set | ||
| 9 | # TARGET_frv is not set | ||
| 10 | # TARGET_h8300 is not set | ||
| 11 | # TARGET_hppa is not set | ||
| 12 | # TARGET_i386 is not set | ||
| 13 | # TARGET_i960 is not set | ||
| 14 | # TARGET_m68k is not set | ||
| 15 | # TARGET_microblaze is not set | ||
| 16 | # TARGET_mips is not set | ||
| 17 | # TARGET_nios is not set | ||
| 18 | # TARGET_nios2 is not set | ||
| 19 | # TARGET_powerpc is not set | ||
| 20 | TARGET_sh=y | ||
| 21 | # TARGET_sh64 is not set | ||
| 22 | # TARGET_sparc is not set | ||
| 23 | # TARGET_v850 is not set | ||
| 24 | # TARGET_x86_64 is not set | ||
| 25 | |||
| 26 | # | ||
| 27 | # Target Architecture Features and Options | ||
| 28 | # | ||
| 29 | TARGET_ARCH="sh" | ||
| 30 | ARCH_SUPPORTS_BIG_ENDIAN=y | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 32 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 33 | # CONFIG_SH2A is not set | ||
| 34 | # CONFIG_SH2 is not set | ||
| 35 | # CONFIG_SH3 is not set | ||
| 36 | CONFIG_SH4=y | ||
| 37 | ARCH_LITTLE_ENDIAN=y | ||
| 38 | # ARCH_BIG_ENDIAN is not set | ||
| 39 | ARCH_WANTS_LITTLE_ENDIAN=y | ||
| 40 | # ARCH_WANTS_BIG_ENDIAN is not set | ||
| 41 | # ARCH_HAS_NO_MMU is not set | ||
| 42 | ARCH_HAS_MMU=y | ||
| 43 | UCLIBC_HAS_FLOATS=y | ||
| 44 | UCLIBC_HAS_FPU=y | ||
| 45 | DO_C99_MATH=y | ||
| 46 | # UCLIBC_HAS_FENV is not set | ||
| 47 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 48 | HAVE_DOT_CONFIG=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch b/meta/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch new file mode 100644 index 0000000000..7acd5d17f6 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | Delivered-To: raj.khem@gmail.com | ||
| 2 | Received: by 10.90.86.4 with SMTP id j4cs313305agb; | ||
| 3 | Sat, 8 Jan 2011 16:45:19 -0800 (PST) | ||
| 4 | Received: by 10.216.153.210 with SMTP id f60mr573848wek.114.1294533918335; | ||
| 5 | Sat, 08 Jan 2011 16:45:18 -0800 (PST) | ||
| 6 | Return-Path: <yann.morin.1998@anciens.enib.fr> | ||
| 7 | Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) | ||
| 8 | by mx.google.com with ESMTP id n4si33737071wej.152.2011.01.08.16.45.17; | ||
| 9 | Sat, 08 Jan 2011 16:45:18 -0800 (PST) | ||
| 10 | Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123; | ||
| 11 | Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr | ||
| 12 | Received: from roazhon.bzh.lan ([90.32.245.227]) | ||
| 13 | by mwinf5d24 with ME | ||
| 14 | id tClC1f0024v5z3u03ClGDX; Sun, 09 Jan 2011 01:45:17 +0100 | ||
| 15 | From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 16 | To: uclibc@uclibc.org | ||
| 17 | Cc: Khem Raj <raj.khem@gmail.com>, | ||
| 18 | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>, | ||
| 19 | Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 20 | Subject: [PATCH 4/7] ARM: transform the EABI/OABI choice into a boolean | ||
| 21 | Date: Sun, 9 Jan 2011 01:45:07 +0100 | ||
| 22 | Message-Id: <1294533910-19305-5-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 23 | X-Mailer: git-send-email 1.7.1 | ||
| 24 | In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 25 | References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr> | ||
| 26 | |||
| 27 | The CONFIG_ARM_OABI option is never used. | ||
| 28 | |||
| 29 | Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | ||
| 30 | Cc: Khem Raj <raj.khem@gmail.com> | ||
| 31 | Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 32 | Cc: Carmelo AMOROSO <carmelo.amoroso@st.com> | ||
| 33 | --- | ||
| 34 | extra/Configs/Config.arm | 23 ++++++++--------------- | ||
| 35 | 1 files changed, 8 insertions(+), 15 deletions(-) | ||
| 36 | |||
| 37 | Index: git/extra/Configs/Config.arm | ||
| 38 | =================================================================== | ||
| 39 | --- git.orig/extra/Configs/Config.arm | ||
| 40 | +++ git/extra/Configs/Config.arm | ||
| 41 | @@ -12,23 +12,16 @@ config FORCE_OPTIONS_FOR_ARCH | ||
| 42 | default y | ||
| 43 | select ARCH_ANY_ENDIAN | ||
| 44 | |||
| 45 | -choice | ||
| 46 | - prompt "Target ABI" | ||
| 47 | - default CONFIG_ARM_EABI | ||
| 48 | +config CONFIG_ARM_EABI | ||
| 49 | + bool "Build for EABI" | ||
| 50 | help | ||
| 51 | - If you choose "EABI" here, functions and constants required by the | ||
| 52 | - ARM EABI will be built into the library. You should choose "EABI" | ||
| 53 | + If you say 'y' here, functions and constants required by the | ||
| 54 | + ARM EABI will be built into the library. You should say 'y' | ||
| 55 | if your compiler uses the ARM EABI, in which case you will also | ||
| 56 | - need a kernel supporting the EABI system call interface, or "OABI" | ||
| 57 | - for a compiler using the old Linux ABI. | ||
| 58 | - | ||
| 59 | -config CONFIG_ARM_OABI | ||
| 60 | - bool "OABI" | ||
| 61 | - | ||
| 62 | -config CONFIG_ARM_EABI | ||
| 63 | - bool "EABI" | ||
| 64 | + need a kernel supporting the EABI system call interface. | ||
| 65 | |||
| 66 | -endchoice | ||
| 67 | + If you say 'n' here, then the library will be built for the | ||
| 68 | + old Linux ABI. | ||
| 69 | |||
| 70 | config COMPILE_IN_THUMB_MODE | ||
| 71 | bool "Build using Thumb mode" | ||
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.config b/meta/recipes-core/uclibc/uclibc-git/uClibc.config index e69de29bb2..e69de29bb2 100644 --- a/meta/recipes-core/uclibc/uclibc-0.9.30.1/uClibc.config +++ b/meta/recipes-core/uclibc/uclibc-git/uClibc.config | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro new file mode 100644 index 0000000000..a1b7813a0b --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | # | ||
| 2 | # General Library Settings | ||
| 3 | # | ||
| 4 | # HAVE_NO_PIC is not set | ||
| 5 | # DOPIC is not set | ||
| 6 | # HAVE_NO_SHARED is not set | ||
| 7 | # ARCH_HAS_NO_LDSO is not set | ||
| 8 | HAVE_SHARED=y | ||
| 9 | # FORCE_SHAREABLE_TEXT_SEGMENTS is not set | ||
| 10 | LDSO_LDD_SUPPORT=y | ||
| 11 | LDSO_CACHE_SUPPORT=y | ||
| 12 | # LDSO_PRELOAD_FILE_SUPPORT is not set | ||
| 13 | LDSO_BASE_FILENAME="ld.so" | ||
| 14 | # UCLIBC_STATIC_LDCONFIG is not set | ||
| 15 | LDSO_RUNPATH=y | ||
| 16 | UCLIBC_CTOR_DTOR=y | ||
| 17 | LDSO_GNU_HASH_SUPPORT=y | ||
| 18 | # HAS_NO_THREADS is not set | ||
| 19 | UCLIBC_HAS_THREADS=y | ||
| 20 | UCLIBC_HAS_THREADS_NATIVE=y | ||
| 21 | PTHREADS_DEBUG_SUPPORT=y | ||
| 22 | # LINUXTHREADS_OLD is not set | ||
| 23 | UCLIBC_HAS_LFS=y | ||
| 24 | # MALLOC is not set | ||
| 25 | # MALLOC_SIMPLE is not set | ||
| 26 | MALLOC_STANDARD=y | ||
| 27 | MALLOC_GLIBC_COMPAT=y | ||
| 28 | UCLIBC_DYNAMIC_ATEXIT=y | ||
| 29 | COMPAT_ATEXIT=y | ||
| 30 | UCLIBC_SUSV3_LEGACY=y | ||
| 31 | UCLIBC_SUSV3_LEGACY_MACROS=y | ||
| 32 | UCLIBC_SUSV4_LEGACY=y | ||
| 33 | UCLIBC_HAS_SHADOW=y | ||
| 34 | UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y | ||
| 35 | UCLIBC_HAS___PROGNAME=y | ||
| 36 | UNIX98PTY_ONLY=y | ||
| 37 | ASSUME_DEVPTS=y | ||
| 38 | UCLIBC_HAS_LIBUTIL=y | ||
| 39 | UCLIBC_HAS_TM_EXTENSIONS=y | ||
| 40 | UCLIBC_HAS_TZ_CACHING=y | ||
| 41 | UCLIBC_HAS_TZ_FILE=y | ||
| 42 | UCLIBC_HAS_TZ_FILE_READ_MANY=y | ||
| 43 | UCLIBC_TZ_FILE_PATH="/etc/TZ" | ||
| 44 | |||
| 45 | # | ||
| 46 | # Advanced Library Settings | ||
| 47 | # | ||
| 48 | UCLIBC_PWD_BUFFER_SIZE=256 | ||
| 49 | UCLIBC_GRP_BUFFER_SIZE=256 | ||
| 50 | |||
| 51 | # | ||
| 52 | # Networking Support | ||
| 53 | # | ||
| 54 | UCLIBC_HAS_IPV6=y | ||
| 55 | UCLIBC_HAS_RPC=y | ||
| 56 | UCLIBC_HAS_FULL_RPC=y | ||
| 57 | # UCLIBC_HAS_REENTRANT_RPC is not set | ||
| 58 | UCLIBC_USE_NETLINK=y | ||
| 59 | UCLIBC_SUPPORT_AI_ADDRCONFIG=y | ||
| 60 | |||
| 61 | UCLIBC_HAS_BSD_RES_CLOSE=y | ||
| 62 | UCLIBC_HAS_LIBRESOLV_STUB=y | ||
| 63 | UCLIBC_HAS_LIBNSL_STUB=y | ||
| 64 | |||
| 65 | # | ||
| 66 | # String and Stdio Support | ||
| 67 | # | ||
| 68 | UCLIBC_HAS_STRING_GENERIC_OPT=y | ||
| 69 | UCLIBC_HAS_STRING_ARCH_OPT=y | ||
| 70 | UCLIBC_HAS_CTYPE_TABLES=y | ||
| 71 | UCLIBC_HAS_CTYPE_SIGNED=y | ||
| 72 | # UCLIBC_HAS_CTYPE_UNSAFE is not set | ||
| 73 | UCLIBC_HAS_CTYPE_CHECKED=y | ||
| 74 | # UCLIBC_HAS_CTYPE_ENFORCED is not set | ||
| 75 | UCLIBC_HAS_WCHAR=y | ||
| 76 | # UCLIBC_HAS_LOCALE is not set | ||
| 77 | UCLIBC_HAS_HEXADECIMAL_FLOATS=y | ||
| 78 | UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y | ||
| 79 | UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 | ||
| 80 | UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y | ||
| 81 | # UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set | ||
| 82 | UCLIBC_HAS_STDIO_BUFSIZ_256=y | ||
| 83 | # UCLIBC_HAS_STDIO_BUFSIZ_512 is not set | ||
| 84 | # UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set | ||
| 85 | # UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set | ||
| 86 | # UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set | ||
| 87 | # UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set | ||
| 88 | UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y | ||
| 89 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set | ||
| 90 | # UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set | ||
| 91 | # UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set | ||
| 92 | UCLIBC_HAS_STDIO_GETC_MACRO=y | ||
| 93 | UCLIBC_HAS_STDIO_PUTC_MACRO=y | ||
| 94 | UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y | ||
| 95 | # UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set | ||
| 96 | UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y | ||
| 97 | UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y | ||
| 98 | UCLIBC_HAS_PRINTF_M_SPEC=y | ||
| 99 | UCLIBC_HAS_ERRNO_MESSAGES=y | ||
| 100 | # UCLIBC_HAS_SYS_ERRLIST is not set | ||
| 101 | UCLIBC_HAS_SIGNUM_MESSAGES=y | ||
| 102 | # UCLIBC_HAS_SYS_SIGLIST is not set | ||
| 103 | UCLIBC_HAS_GNU_GETOPT=y | ||
| 104 | UCLIBC_HAS_GNU_GETSUBOPT=y | ||
| 105 | |||
| 106 | # | ||
| 107 | # Big and Tall | ||
| 108 | # | ||
| 109 | UCLIBC_HAS_REGEX=y | ||
| 110 | # UCLIBC_HAS_REGEX_OLD is not set | ||
| 111 | UCLIBC_HAS_FNMATCH=y | ||
| 112 | # UCLIBC_HAS_FNMATCH_OLD is not set | ||
| 113 | UCLIBC_HAS_WORDEXP=y | ||
| 114 | UCLIBC_HAS_NFTW=y | ||
| 115 | UCLIBC_HAS_FTW=y | ||
| 116 | UCLIBC_HAS_FTS=y | ||
| 117 | UCLIBC_HAS_GLOB=y | ||
| 118 | UCLIBC_HAS_GNU_GLOB=y | ||
| 119 | |||
| 120 | # | ||
| 121 | # Library Installation Options | ||
| 122 | # | ||
| 123 | SHARED_LIB_LOADER_PREFIX="/lib" | ||
| 124 | RUNTIME_PREFIX="/" | ||
| 125 | DEVEL_PREFIX="//usr" | ||
| 126 | |||
| 127 | # | ||
| 128 | # Security options | ||
| 129 | # | ||
| 130 | # UCLIBC_BUILD_PIE is not set | ||
| 131 | # UCLIBC_HAS_ARC4RANDOM is not set | ||
| 132 | # HAVE_NO_SSP is not set | ||
| 133 | # UCLIBC_HAS_SSP is not set | ||
| 134 | UCLIBC_BUILD_RELRO=y | ||
| 135 | UCLIBC_BUILD_NOW=y | ||
| 136 | UCLIBC_BUILD_NOEXECSTACK=y | ||
| 137 | |||
| 138 | # | ||
| 139 | # uClibc development/debugging options | ||
| 140 | # | ||
| 141 | CROSS_COMPILER_PREFIX="" | ||
| 142 | UCLIBC_EXTRA_CFLAGS="" | ||
| 143 | # DODEBUG is not set | ||
| 144 | # DODEBUG_PT is not set | ||
| 145 | # DOSTRIP is not set | ||
| 146 | # DOASSERTS is not set | ||
| 147 | # SUPPORT_LD_DEBUG is not set | ||
| 148 | # SUPPORT_LD_DEBUG_EARLY is not set | ||
| 149 | # UCLIBC_MALLOC_DEBUGGING is not set | ||
| 150 | UCLIBC_HAS_BACKTRACE=y | ||
| 151 | WARNINGS="-Wall" | ||
| 152 | # EXTRA_WARNINGS is not set | ||
| 153 | # DOMULTI is not set | ||
| 154 | # UCLIBC_MJN3_ONLY is not set | ||
| 155 | |||
| 156 | # math stuff for perl | ||
| 157 | DO_C99_MATH=y | ||
| 158 | UCLIBC_HAS_LONG_DOUBLE_MATH=y | ||
| 159 | UCLIBC_HAS_FENV=y | ||
| 160 | |||
diff --git a/meta/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch b/meta/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch new file mode 100644 index 0000000000..504d37bcd2 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | Index: uclibc-0.9.29/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h | ||
| 2 | =================================================================== | ||
| 3 | --- uclibc-0.9.29.orig/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h | ||
| 4 | +++ uclibc-0.9.29/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h | ||
| 5 | @@ -38,4 +38,8 @@ | ||
| 6 | /* define if target supports IEEE signed zero floats */ | ||
| 7 | #define __UCLIBC_HAVE_SIGNED_ZERO__ | ||
| 8 | |||
| 9 | +#ifdef __ARM_EABI__ | ||
| 10 | +# define __UCLIBC_TRUNCATE64_HAS_4_ARGS__ | ||
| 11 | +#endif | ||
| 12 | + | ||
| 13 | #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch b/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch new file mode 100644 index 0000000000..f8f3a7d1aa --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | Index: uClibc/test/math/libm-test.inc | ||
| 2 | =================================================================== | ||
| 3 | --- uClibc/test/math/libm-test.inc (revision 23784) | ||
| 4 | +++ uClibc/test/math/libm-test.inc (working copy) | ||
| 5 | @@ -3414,7 +3414,6 @@ | ||
| 6 | } | ||
| 7 | |||
| 8 | |||
| 9 | -#if 0 | ||
| 10 | static void | ||
| 11 | log2_test (void) | ||
| 12 | { | ||
| 13 | @@ -3444,7 +3443,6 @@ | ||
| 14 | |||
| 15 | END (log2); | ||
| 16 | } | ||
| 17 | -#endif | ||
| 18 | |||
| 19 | |||
| 20 | static void | ||
| 21 | @@ -4967,9 +4965,7 @@ | ||
| 22 | log_test (); | ||
| 23 | log10_test (); | ||
| 24 | log1p_test (); | ||
| 25 | -#if 0 | ||
| 26 | log2_test (); | ||
| 27 | -#endif | ||
| 28 | logb_test (); | ||
| 29 | modf_test (); | ||
| 30 | ilogb_test (); | ||
diff --git a/meta/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine new file mode 100644 index 0000000000..ac50da0608 --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # | ||
| 4 | # TARGET_alpha is not set | ||
| 5 | # TARGET_arm is not set | ||
| 6 | # TARGET_bfin is not set | ||
| 7 | # TARGET_cris is not set | ||
| 8 | # TARGET_e1 is not set | ||
| 9 | # TARGET_frv is not set | ||
| 10 | # TARGET_h8300 is not set | ||
| 11 | # TARGET_hppa is not set | ||
| 12 | # TARGET_i386 is not set | ||
| 13 | # TARGET_i960 is not set | ||
| 14 | # TARGET_m68k is not set | ||
| 15 | # TARGET_microblaze is not set | ||
| 16 | # TARGET_mips is not set | ||
| 17 | # TARGET_nios is not set | ||
| 18 | # TARGET_nios2 is not set | ||
| 19 | # TARGET_powerpc is not set | ||
| 20 | # TARGET_sh is not set | ||
| 21 | # TARGET_sh64 is not set | ||
| 22 | # TARGET_sparc is not set | ||
| 23 | # TARGET_v850 is not set | ||
| 24 | TARGET_x86_64=y | ||
| 25 | |||
| 26 | # | ||
| 27 | # Target Architecture Features and Options | ||
| 28 | # | ||
| 29 | TARGET_ARCH="x86_64" | ||
| 30 | # ARCH_SUPPORTS_BIG_ENDIAN is not set | ||
| 31 | ARCH_SUPPORTS_LITTLE_ENDIAN=y | ||
| 32 | FORCE_OPTIONS_FOR_ARCH=y | ||
| 33 | ARCH_LITTLE_ENDIAN=y | ||
| 34 | # ARCH_BIG_ENDIAN is not set | ||
| 35 | # ARCH_HAS_NO_MMU is not set | ||
| 36 | ARCH_HAS_MMU=y | ||
| 37 | UCLIBC_HAS_FLOATS=y | ||
| 38 | UCLIBC_HAS_FPU=y | ||
| 39 | DO_C99_MATH=y | ||
| 40 | # UCLIBC_HAS_FENV is not set | ||
| 41 | KERNEL_HEADERS="<path/to/kernel/headers>" | ||
| 42 | HAVE_DOT_CONFIG=y | ||
diff --git a/meta/recipes-core/uclibc/uclibc-initial_0.9.30.1.bb b/meta/recipes-core/uclibc/uclibc-initial_0.9.30.1.bb deleted file mode 100644 index 71a2f0cd3c..0000000000 --- a/meta/recipes-core/uclibc/uclibc-initial_0.9.30.1.bb +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | SECTION = "base" | ||
| 2 | require uclibc_${PV}.bb | ||
| 3 | |||
| 4 | DEPENDS = "linux-libc-headers ncurses-native virtual/${TARGET_PREFIX}gcc-initial" | ||
| 5 | PROVIDES = "virtual/${TARGET_PREFIX}libc-initial" | ||
| 6 | PACKAGES = "" | ||
| 7 | |||
| 8 | do_install() { | ||
| 9 | # Install initial headers into the cross dir | ||
| 10 | make V=1 CC="${CC}" PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | ||
| 11 | install_headers | ||
| 12 | #ln -sf include ${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/sys-include | ||
| 13 | |||
| 14 | # This conflicts with the c++ version of this header | ||
| 15 | rm -f ${D}${includedir}/bits/atomicity.h | ||
| 16 | install -d ${D}${libdir}/ | ||
| 17 | install -m 644 lib/crt[1in].o ${D}${libdir}/ | ||
| 18 | install -d ${D}${libdir}/ | ||
| 19 | install -m 644 lib/libc.so ${D}${libdir}/ | ||
| 20 | } | ||
| 21 | |||
| 22 | do_compile () { | ||
| 23 | make V=1 CC="${CC}" PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | ||
| 24 | lib/crt1.o lib/crti.o lib/crtn.o | ||
| 25 | ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \ | ||
| 26 | -o lib/libc.so | ||
| 27 | } | ||
| 28 | |||
| 29 | do_siteconfig () { | ||
| 30 | : | ||
| 31 | } | ||
diff --git a/meta/recipes-core/uclibc/uclibc-initial_git.bb b/meta/recipes-core/uclibc/uclibc-initial_git.bb new file mode 100644 index 0000000000..8e5c25121b --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-initial_git.bb | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | SECTION = "base" | ||
| 2 | require uclibc_git.bb | ||
| 3 | |||
| 4 | DEPENDS = "linux-libc-headers ncurses-native virtual/${TARGET_PREFIX}gcc-initial" | ||
| 5 | PROVIDES = "virtual/${TARGET_PREFIX}libc-initial" | ||
| 6 | |||
| 7 | PACKAGES = "" | ||
| 8 | PACKAGES_DYNAMIC = "" | ||
| 9 | |||
| 10 | STAGINGCC = "gcc-cross-initial" | ||
| 11 | STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-initial" | ||
| 12 | |||
| 13 | do_install() { | ||
| 14 | # Install initial headers into the cross dir | ||
| 15 | make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | ||
| 16 | install_headers install_startfiles | ||
| 17 | ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \ | ||
| 18 | -o lib/libc.so | ||
| 19 | ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \ | ||
| 20 | -o lib/libm.so | ||
| 21 | install -d ${D}${libdir} | ||
| 22 | install -m 755 lib/lib[cm].so ${D}${libdir} | ||
| 23 | # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this. | ||
| 24 | for t in linux asm asm-generic; do | ||
| 25 | if [ -d ${D}${includedir}/$t ]; then | ||
| 26 | rm -rf ${D}${includedir}/$t | ||
| 27 | fi | ||
| 28 | ln -sf ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/ | ||
| 29 | done | ||
| 30 | } | ||
| 31 | do_compile() { | ||
| 32 | : | ||
| 33 | } | ||
| 34 | |||
| 35 | do_siteconfig () { | ||
| 36 | : | ||
| 37 | } | ||
| 38 | |||
| 39 | do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}" | ||
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc index 5e87cf9550..e7d8846738 100644 --- a/meta/recipes-core/uclibc/uclibc.inc +++ b/meta/recipes-core/uclibc/uclibc.inc | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | SUMMARY = "C library for embedded systems" | 1 | SUMMARY = "C library for embedded systems" |
| 2 | DESCRIPTION = "The name uClibc is an abbreviation for 'the \ | 2 | DESCRIPTION = "The name uClibc is an abbreviation for 'the \ |
| 3 | microcontroller C library'. For simplicity, uClibc is pronounced \ | 3 | microcontroller C library'. For simplicity, uClibc is pronounced \ |
| 4 | 'yew-see-lib-see'. The goal of uClibc is to provide as much \ | 4 | 'yew-see-lib-see'. The goal of uClibc is to provide as much \ |
| 5 | functionality as possible in a small amount of space, and it is intended \ | 5 | functionality as possible in a small amount of space, and it is intended \ |
| 6 | primarily for embedded use. It is also highly configurable in supported \ | 6 | primarily for embedded use. It is also highly configurable in supported \ |
| @@ -11,6 +11,30 @@ embedded Linux. It is NOT compatible with binaries linked against glibc." | |||
| 11 | LICENSE = "LGPL" | 11 | LICENSE = "LGPL" |
| 12 | SECTION = "libs" | 12 | SECTION = "libs" |
| 13 | PRIORITY = "required" | 13 | PRIORITY = "required" |
| 14 | LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \ | ||
| 15 | file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \ | ||
| 16 | file://${S}/test/regex/testregex.c;startline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960" | ||
| 17 | INC_PR = "r2" | ||
| 18 | |||
| 19 | require uclibc-config.inc | ||
| 20 | STAGINGCC = "gcc-cross-intermediate" | ||
| 21 | STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-intermediate" | ||
| 22 | PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" | ||
| 23 | |||
| 24 | TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}" | ||
| 25 | |||
| 26 | # siteconfig.bbclass runs configure which needs a working compiler | ||
| 27 | # For the compiler to work we need a working libc yet libc isn't | ||
| 28 | # in the sysroots directory at this point. This means the libc.so | ||
| 29 | # linker script won't work as the --sysroot setting isn't correct. | ||
| 30 | # Here we create a hacked up libc linker script and pass in the right | ||
| 31 | # flags to let configure work. Ugly. | ||
| 32 | EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'" | ||
| 33 | siteconfig_do_siteconfig_gencache_prepend = " \ | ||
| 34 | mkdir -p ${WORKDIR}/site_config_libc; \ | ||
| 35 | cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \ | ||
| 36 | sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \ | ||
| 37 | " | ||
| 14 | 38 | ||
| 15 | # | 39 | # |
| 16 | # For now, we will skip building of a gcc package if it is a uclibc one | 40 | # For now, we will skip building of a gcc package if it is a uclibc one |
| @@ -27,165 +51,165 @@ python __anonymous () { | |||
| 27 | raise bb.parse.SkipPackage("incompatible with target %s" % | 51 | raise bb.parse.SkipPackage("incompatible with target %s" % |
| 28 | bb.data.getVar('TARGET_OS', d, 1)) | 52 | bb.data.getVar('TARGET_OS', d, 1)) |
| 29 | } | 53 | } |
| 30 | |||
| 31 | PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" | 54 | PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" |
| 32 | PROVIDES += "${@['virtual/libiconv', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']}" | ||
| 33 | DEPENDS = "virtual/${TARGET_PREFIX}binutils \ | 55 | DEPENDS = "virtual/${TARGET_PREFIX}binutils \ |
| 34 | virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers ncurses-native pax-utils-native" | 56 | virtual/${TARGET_PREFIX}gcc-intermediate \ |
| 57 | linux-libc-headers ncurses-native" | ||
| 35 | RDEPENDS_${PN}-dev = "linux-libc-headers-dev" | 58 | RDEPENDS_${PN}-dev = "linux-libc-headers-dev" |
| 36 | 59 | ||
| 37 | # Blackfin needs a wrapper around ld | ||
| 38 | #DEPENDS_append_bfin = " elf2flt " | ||
| 39 | |||
| 40 | INHIBIT_DEFAULT_DEPS = "1" | 60 | INHIBIT_DEFAULT_DEPS = "1" |
| 41 | PARALLEL_MAKE = "" | ||
| 42 | 61 | ||
| 43 | PACKAGES =+ "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db" | 62 | PACKAGES =+ "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db uclibc-argp uclibc-backtrace" |
| 44 | 63 | ||
| 45 | LEAD_SONAME = "libc.so" | 64 | LEAD_SONAME = "libc.so" |
| 46 | 65 | ||
| 47 | # The last line (gdb and lib1) is for uclinux-uclibc builds | 66 | # The last line (gdb and lib1) is for uclinux-uclibc builds |
| 48 | uclibc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so \ | 67 | uclibc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so \ |
| 49 | ${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so \ | 68 | ${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so \ |
| 50 | ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so \ | 69 | ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so \ |
| 51 | ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so \ | 70 | ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so \ |
| 52 | ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so \ | 71 | ${base_libdir}/ld*.so.* ${base_libdir}/ld*.so \ |
| 53 | ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \ | 72 | ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \ |
| 54 | ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so \ | 73 | ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so \ |
| 55 | ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so \ | 74 | ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so \ |
| 56 | ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so \ | 75 | ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so \ |
| 57 | ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so \ | 76 | ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so \ |
| 58 | ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so \ | 77 | ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so \ |
| 59 | ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \ | 78 | ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \ |
| 60 | " | 79 | " |
| 61 | FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \ | 80 | FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \ |
| 62 | ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale" | 81 | ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale" |
| 63 | FILES_ldd = "${bindir}/ldd" | 82 | FILES_ldd = "${bindir}/ldd" |
| 64 | FILES_uclibc-dev += "${libdir}/*.o" | 83 | FILES_uclibc-dev_append = "\ |
| 84 | ${libdir}/lib*.so \ | ||
| 85 | ${libdir}/*_nonshared.a \ | ||
| 86 | ${libdir}/[S]*crt[1in].o \ | ||
| 87 | ${libdir}/crtreloc*.o \ | ||
| 88 | ${libdir}/lib*.a \ | ||
| 89 | ${includedir}/*.h ${includedir}/*/*.h \ | ||
| 90 | " | ||
| 65 | FILES_uclibc-utils = "${bindir} ${sbindir}" | 91 | FILES_uclibc-utils = "${bindir} ${sbindir}" |
| 66 | FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug" | 92 | FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug" |
| 67 | FILES_uclibc-gconv = "${libdir}/gconv" | 93 | FILES_uclibc-gconv = "${libdir}/gconv" |
| 68 | FILES_uclibc-thread-db = "/lib/libthread_db*" | 94 | FILES_uclibc-thread-db = "${base_libdir}/libthread_db*" |
| 69 | RPROVIDES_uclibc-dev += "libc-dev" | 95 | FILES_uclibc-argp = "${base_libdir}/libuargp-*.so ${base_libdir}/libuargp*.so.*" |
| 96 | FILES_uclibc-backtrace = "${base_libdir}/libubacktrace-*.so ${base_libdir}/libubacktrace*.so.*" | ||
| 97 | |||
| 98 | RPROVIDES_uclibc-dev += "libc-dev virtual-libc-dev" | ||
| 99 | # uclibc does not really have libsegfault but then using the one from glibc is also not | ||
| 100 | # going to work. So we pretend that we have it to make bitbake not pull other recipes | ||
| 101 | # to satisfy this dependency for the images/tasks | ||
| 102 | RPROVIDES_${PN} += "libsegfault" | ||
| 103 | |||
| 104 | SRC_URI = "\ | ||
| 105 | http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2;name=uClibc-${PV} \ | ||
| 106 | " | ||
| 107 | |||
| 108 | # do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in | ||
| 109 | # the CFLAGS (when building the utils). | ||
| 110 | OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}'" | ||
| 111 | EXTRA_OEMAKE = "${OEMAKE_NO_CC} \ | ||
| 112 | 'HOSTCC=${BUILD_CC}' \ | ||
| 113 | 'HOST_CFLAGS=${BUILD_CFLAGS}' \ | ||
| 114 | 'CC=${CC}' \ | ||
| 115 | ARCH=${UCLIBC_ARCH}" | ||
| 70 | 116 | ||
| 71 | # | ||
| 72 | # This locale file gets copied into uClibc-${PV}/extra/locale/ prior to | ||
| 73 | # build, it does not need to be unpacked, but we can't inhibit the unpacking | ||
| 74 | # in the current build system. | ||
| 75 | # | ||
| 76 | UCLIBC_LOCALE_FILE = "uClibc-locale-030818.tgz" | ||
| 77 | UCLIBC_LOCALE_FILE_arm = "uClibc-locale-030818.arm.tgz" | ||
| 78 | UCLIBC_LOCALE_URI = "http://www.uclibc.org/downloads/${UCLIBC_LOCALE_FILE}" | ||
| 79 | UCLIBC_LOCALE_URI_arm = "http://wiki.openembedded.net/dl/uclibc-locale/${UCLIBC_LOCALE_FILE}" | ||
| 80 | |||
| 81 | SRC_URI = "${@['${UCLIBC_LOCALE_URI}', ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} \ | ||
| 82 | file://uClibc.config \ | ||
| 83 | http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2 \ | ||
| 84 | " | ||
| 85 | |||
| 86 | # do_stage barfs on a CC with whitepspace, therefore put the 'HOST_CC_ARCH' in | ||
| 87 | # the CFLAGS (for when building the utils). | ||
| 88 | OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}' \ | ||
| 89 | 'LOCALE_DATA_FILENAME=${UCLIBC_LOCALE_FILE}'" | ||
| 90 | EXTRA_OEMAKE = "${OEMAKE_NO_CC} 'CC=${CC}' \ | ||
| 91 | 'HOSTCFLAGS=-I${STAGING_INCDIR_NATIVE}' \ | ||
| 92 | ARCH=`grep TARGET_ARCH ${S}/.config|sed -e 's/TARGET_ARCH=//g'`" | ||
| 93 | EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}" | 117 | EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}" |
| 94 | 118 | ||
| 95 | KERNEL_SOURCE = "${STAGING_INCDIR}" | 119 | # enable verbose output: |
| 96 | KERNEL_HEADERS = "${STAGING_INCDIR}" | 120 | export V="2" |
| 97 | |||
| 98 | # Lets munge this via siteinfo.bbclass as well: | ||
| 99 | # ARCH_BIG_ENDIAN=y | ||
| 100 | # ARCH_WANTS_BIG_ENDIAN=y | ||
| 101 | # ARCH_WANTS_LITTLE_ENDIAN is not set | ||
| 102 | |||
| 103 | # How to enable verbose logs: | ||
| 104 | #export VERBOSE="1" | ||
| 105 | |||
| 106 | configmangle = 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE="${KERNEL_SOURCE}",g; \ | ||
| 107 | s,^KERNEL_HEADERS=.*,KERNEL_HEADERS="${KERNEL_HEADERS}",g; \ | ||
| 108 | s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX="/",g; \ | ||
| 109 | s,^DEVEL_PREFIX=.*,DEVEL_PREFIX="/${prefix}",g; \ | ||
| 110 | s,^SHARED_LIB_LOADER_PATH=.*,SHARED_LIB_LOADER_PATH="/lib",; \ | ||
| 111 | s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX="/lib",; \ | ||
| 112 | s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \ | ||
| 113 | ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \ | ||
| 114 | ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) in ['mips', 'mipsel', 'avr32']]} \ | ||
| 115 | ' | ||
| 116 | |||
| 117 | CFLAGS := "${@oe_filter_out('-I\S+', '${CFLAGS}', d)}" | ||
| 118 | 121 | ||
| 119 | python () { | 122 | # -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported |
| 120 | if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]: | 123 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860 |
| 121 | bb.data.setVar('configmangle_append', ' s,^HAS_FPU=y,# HAS_FPU is not set,;', d) | 124 | # |
| 125 | CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}" | ||
| 126 | UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}" | ||
| 127 | UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}', d)}" | ||
| 128 | do_compile_prepend () { | ||
| 129 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
| 122 | } | 130 | } |
| 123 | 131 | ||
| 124 | uclibcbuild_do_patch() { | 132 | configmangle = '/^KERNEL_HEADERS/d; \ |
| 125 | ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux | 133 | /^RUNTIME_PREFIX/d; \ |
| 126 | ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm | 134 | /^DEVEL_PREFIX/d; \ |
| 127 | 135 | /^SHARED_LIB_LOADER_PREFIX/d; \ | |
| 128 | ${@['cp %s/%s extra/locale' % (bb.data.getVar('DL_DIR', d, 1) or '', bb.data.getVar('UCLIBC_LOCALE_FILE', d, 1) or ''), ''][bb.data.getVar('USE_NLS', d, 1) != 'yes']} | 136 | /^UCLIBC_EXTRA_CFLAGS/d; \ |
| 137 | s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \ | ||
| 138 | ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \ | ||
| 139 | ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \ | ||
| 140 | /^CROSS/d; \ | ||
| 141 | /^TARGET_ARCH=/d; \ | ||
| 142 | /^TARGET_/s,^\([^=]*\).*,# \1 is not set,g; \ | ||
| 143 | s,^DOSTRIP.*,# DOSTRIP is not set,g; \ | ||
| 144 | /_[EO]*ABI/d; \ | ||
| 145 | /HAS_FPU/d; \ | ||
| 146 | ' | ||
| 147 | OE_FEATURES := "${@features_to_uclibc_conf(d)}" | ||
| 148 | OE_DEL := "${@features_to_uclibc_del(d)}" | ||
| 149 | python () { | ||
| 150 | if "${OE_DEL}": | ||
| 151 | bb.data.setVar('configmangle_append', "${OE_DEL}" + "\n", d) | ||
| 152 | if "${OE_FEATURES}": | ||
| 153 | bb.data.setVar('configmangle_append', | ||
| 154 | "/^### DISTRO FEATURES$/a\\\n%s\n\n" % | ||
| 155 | ("\\n".join((bb.data.expand("${OE_FEATURES}", d).split("\n")))), | ||
| 156 | d) | ||
| 157 | bb.data.setVar('configmangle_append', | ||
| 158 | "/^### CROSS$/a\\\n%s\n" % | ||
| 159 | ("\\n".join(["CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"", | ||
| 160 | "UCLIBC_EXTRA_CFLAGS=\"${UCLIBC_EXTRA_CFLAGS}\"", | ||
| 161 | "KERNEL_HEADERS=\"${STAGING_INCDIR}\"", | ||
| 162 | "RUNTIME_PREFIX=\"/\"", | ||
| 163 | "DEVEL_PREFIX=\"/${prefix}\"", | ||
| 164 | "SHARED_LIB_LOADER_PREFIX=\"/lib\"", | ||
| 165 | ]) | ||
| 166 | ), | ||
| 167 | d) | ||
| 168 | bb.data.setVar('configmangle_append', | ||
| 169 | "/^### TGT$/a\\\nTARGET_ARCH=\"%s\"\\nTARGET_%s=y\n" % | ||
| 170 | ("${UCLIBC_ARCH}", "${UCLIBC_ARCH}"), | ||
| 171 | d) | ||
| 172 | bb.data.setVar('configmangle_append', | ||
| 173 | "/^### FPU$/a\\\n%s\n\n" % (["UCLIBC_HAS_FPU=y","# UCLIBC_HAS_FPU is not set"][bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]]), d) | ||
| 174 | if "${UCLIBC_ENDIAN}": | ||
| 175 | bb.data.setVar('configmangle_append', | ||
| 176 | "/^### ABI$/a\\\nARCH_%s_ENDIAN=y\n\n" % ("${UCLIBC_ENDIAN}"), | ||
| 177 | d) | ||
| 178 | if "${UCLIBC_ABI}": | ||
| 179 | bb.data.setVar('configmangle_append', | ||
| 180 | "/^### ABI$/a\\\nCONFIG_%s=y\n\n" % ("${UCLIBC_ABI}"), | ||
| 181 | d) | ||
| 129 | } | 182 | } |
| 130 | 183 | ||
| 131 | python do_patch () { | 184 | do_patch_append() { |
| 132 | bb.build.exec_func('base_do_patch', d) | 185 | os.system("ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux") |
| 133 | bb.build.exec_func('uclibcbuild_do_patch', d) | 186 | os.system("ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm") |
| 134 | } | 187 | } |
| 135 | 188 | ||
| 136 | do_configure() { | 189 | do_configure() { |
| 137 | rm -f ${S}/.config | 190 | rm -f ${S}/.config |
| 138 | 191 | ||
| 139 | # For uClibc 0.9.29, OpenEmbedded splits the uClibc.config in two parts: | 192 | # OpenEmbedded splits the uClibc.config in two parts: |
| 140 | # uClibc.machine and uClibc.distro. So, if they exist use them, otherwise | 193 | # uClibc.machine, uClibc.distro |
| 141 | # use a uClibc.config | 194 | echo "### uClibc.machine ###" >${S}/merged.config |
| 142 | if [ -f ${WORKDIR}/uClibc.machine -a -f ${WORKDIR}/uClibc.distro ]; then | 195 | cat ${WORKDIR}/uClibc.machine >>${S}/merged.config |
| 143 | echo "### uClibc.machine ###" >${S}/merged.config | 196 | echo "### uClibc.distro ###" >>${S}/merged.config |
| 144 | cat ${WORKDIR}/uClibc.machine >>${S}/merged.config | 197 | cat ${WORKDIR}/uClibc.distro >>${S}/merged.config |
| 145 | echo "### uClibc.distro ###" >>${S}/merged.config | 198 | echo "### CROSS" >>${S}/merged.config |
| 146 | cat ${WORKDIR}/uClibc.distro >>${S}/merged.config | 199 | echo "### TGT" >>${S}/merged.config |
| 147 | else | 200 | echo "### MMU" >>${S}/merged.config |
| 148 | echo "### uClibc.config ###" >${S}/merged.config | 201 | echo "### FPU" >>${S}/merged.config |
| 149 | cat ${WORKDIR}/uClibc.config >>${S}/merged.config | 202 | echo "### ABI" >>${S}/merged.config |
| 150 | fi | 203 | echo "### DISTRO FEATURES" >>${S}/merged.config |
| 151 | cp ${S}/merged.config ${S}/.config | 204 | cp ${S}/merged.config ${S}/.config |
| 152 | 205 | ||
| 153 | # Mangle the resulting .config depending on OE variables | 206 | # Mangle the resulting .config depending on OE variables |
| 154 | perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=${TARGET_ARCH}\nCROSS=${TARGET_PREFIX},g' ${S}/Rules.mak | 207 | sed -i -e '${configmangle}' ${S}/.config |
| 155 | sed -i -e s:'$(CROSS)strip':true: ${S}/Rules.mak | 208 | |
| 156 | perl -i -p -e '${configmangle}' ${S}/.config | 209 | oe_runmake oldconfig |
| 157 | |||
| 158 | sed -i -e '/CONFIG_ARM_EABI/d' ${S}/.config | ||
| 159 | |||
| 160 | if [ `echo ${TARGET_ARCH} | grep -e '^arm'` ]; then | ||
| 161 | if [ `echo ${TARGET_OS} | grep -e 'eabi$'` ]; then | ||
| 162 | echo "CONFIG_ARM_EABI=y" >> ${S}/.config | ||
| 163 | else | ||
| 164 | echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config | ||
| 165 | fi | ||
| 166 | fi | ||
| 167 | yes '' | oe_runmake oldconfig | ||
| 168 | } | 210 | } |
| 169 | 211 | ||
| 170 | do_install() { | 212 | do_install() { |
| 171 | oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | 213 | oe_runmake PREFIX=${D} install |
| 172 | install_dev install_runtime | 214 | oe_runmake PREFIX=${D} "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" install_utils |
| 173 | |||
| 174 | # Need to overwrite the version from -initial | ||
| 175 | if [ ! -e ${D}${libdir}/libc.so ]; then | ||
| 176 | ln -s ../../lib/libc.so.0 ${D}${libdir}/libc.so | ||
| 177 | fi | ||
| 178 | |||
| 179 | # We don't really need this in ${includedir} | ||
| 180 | rm -f ${D}${prefix}/include/.cvsignore | ||
| 181 | |||
| 182 | # This conflicts with the c++ version of this header | ||
| 183 | rm -f ${D}${prefix}/include/bits/atomicity.h | ||
| 184 | |||
| 185 | oe_runmake "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" utils | ||
| 186 | oe_runmake STRIPTOOL=true PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \ | ||
| 187 | install_utils | ||
| 188 | |||
| 189 | # oe_runstrip needs +x on files | ||
| 190 | chmod +x ${D}/${base_libdir}/* | ||
| 191 | } | 215 | } |
diff --git a/meta/recipes-core/uclibc/uclibc_0.9.30.1.bb b/meta/recipes-core/uclibc/uclibc_0.9.30.1.bb deleted file mode 100644 index 6bdf153a2a..0000000000 --- a/meta/recipes-core/uclibc/uclibc_0.9.30.1.bb +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | # UCLIBC_BASE should be the latest released revision of uclibc (that way | ||
| 2 | # the config files will typically be correct!) uclibc-cvs takes precedence | ||
| 3 | # over uclibc-${UCLIBC_BASE}, if a config file in uclibc-cvs is out of date | ||
| 4 | # try removing it | ||
| 5 | # | ||
| 6 | # UCLIBC_BASE can be set in a distro file, but whether this works depends | ||
| 7 | # on whether the base patches apply to the selected (SRCDATE) svn release. | ||
| 8 | # | ||
| 9 | UCLIBC_BASE ?= "0.9.30.1" | ||
| 10 | |||
| 11 | require uclibc.inc | ||
| 12 | PR = "r1" | ||
| 13 | |||
| 14 | PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc" | ||
| 15 | |||
| 16 | SRC_URI += "file://uClibc.machine file://uClibc.distro \ | ||
| 17 | file://arm-linuxthreads.patch;patch=1 \ | ||
| 18 | file://linuxthreads-changes.patch;patch=1 \ | ||
| 19 | file://pthread_atfork.patch;patch=1 \ | ||
| 20 | file://uclibc_ldso_use_O0.patch;patch=1 \ | ||
| 21 | file://ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch;patch=1 \ | ||
| 22 | file://gcc-4.4-fixlet.patch;patch=1 \ | ||
| 23 | file://uclibc-c99-ldbl-math.patch;patch=1 \ | ||
| 24 | file://Use-__always_inline-instead-of-__inline__.patch;patch=1 \ | ||
| 25 | " | ||
| 26 | #recent versions uclibc require real kernel headers | ||
| 27 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 28 | |||
| 29 | #as stated above, uclibc needs real kernel-headers | ||
| 30 | #however: we can't depend on virtual/kernel when nptl hits due to depends deadlocking .... | ||
| 31 | KERNEL_SOURCE = "${STAGING_DIR_HOST}/${exec_prefix}" | ||
| 32 | |||
| 33 | S = "${WORKDIR}/uClibc-${UCLIBC_BASE}" | ||
diff --git a/meta/recipes-core/uclibc/uclibc_git.bb b/meta/recipes-core/uclibc/uclibc_git.bb new file mode 100644 index 0000000000..18619cd40f --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc_git.bb | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | SRCREV="71d63ed75648da9b0b71afabb9c60aaad792c55c" | ||
| 2 | |||
| 3 | require uclibc.inc | ||
| 4 | PV = "0.9.31+0.9.32rc3" | ||
| 5 | PR = "${INC_PR}.1" | ||
| 6 | PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc" | ||
| 7 | |||
| 8 | #recent versions uclibc require real kernel headers | ||
| 9 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 10 | FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/uclibc-git' ], d)}" | ||
| 11 | |||
| 12 | SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \ | ||
| 13 | file://uClibc.config \ | ||
| 14 | file://uClibc.machine \ | ||
| 15 | file://uClibc.distro \ | ||
| 16 | file://uclibc-arm-ftruncate64.patch \ | ||
| 17 | file://uclibc_enable_log2_test.patch \ | ||
| 18 | file://ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch \ | ||
| 19 | file://reorder-use-BX.patch \ | ||
| 20 | file://select-force-thumb.patch \ | ||
| 21 | file://remove-sub-arch-variants.patch \ | ||
| 22 | file://transform-eabi-oabi-choice.patch \ | ||
| 23 | file://include-arm-asm.h.patch \ | ||
| 24 | file://detect-bx-availibility.patch \ | ||
| 25 | file://remove-eabi-oabi-selection.patch \ | ||
| 26 | file://powerpc_copysignl.patch \ | ||
| 27 | file://argp-support.patch \ | ||
| 28 | file://argp-headers.patch \ | ||
| 29 | file://remove_attribute_optimize_Os.patch \ | ||
| 30 | " | ||
| 31 | S = "${WORKDIR}/git" | ||
